Class: Io::Flow::V0::Clients::ShopifyPrivateApps
- Inherits:
-
Object
- Object
- Io::Flow::V0::Clients::ShopifyPrivateApps
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Method Summary collapse
- #delete_by_id(organization, id) ⇒ Object
- #get(organization, incoming = {}) ⇒ Object
- #get_by_id(organization, id) ⇒ Object
-
#initialize(client) ⇒ ShopifyPrivateApps
constructor
A new instance of ShopifyPrivateApps.
- #put(organization, shopify_private_app_form) ⇒ Object
Constructor Details
#initialize(client) ⇒ ShopifyPrivateApps
Returns a new instance of ShopifyPrivateApps.
8565 8566 8567 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8565 def initialize(client) @client = HttpClient::Preconditions.assert_class('client', client, ::Io::Flow::V0::Client) end |
Instance Method Details
#delete_by_id(organization, id) ⇒ Object
8596 8597 8598 8599 8600 8601 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8596 def delete_by_id(organization, id) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('id', id, String) r = @client.request("/#{CGI.escape(organization)}/shopify/private/apps/#{CGI.escape(id)}").delete nil end |
#get(organization, incoming = {}) ⇒ Object
8569 8570 8571 8572 8573 8574 8575 8576 8577 8578 8579 8580 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8569 def get(organization, incoming={}) HttpClient::Preconditions.assert_class('organization', organization, String) opts = HttpClient::Helper.symbolize_keys(incoming) query = { :id => (x = opts.delete(:id); x.nil? ? nil : HttpClient::Preconditions.assert_class('id', x, Array).map { |v| HttpClient::Preconditions.assert_class('id', v, String) }), :limit => HttpClient::Preconditions.assert_class('limit', (x = opts.delete(:limit); x.nil? ? 25 : x), Integer), :offset => HttpClient::Preconditions.assert_class('offset', (x = opts.delete(:offset); x.nil? ? 0 : x), Integer), :sort => HttpClient::Preconditions.assert_class('sort', (x = opts.delete(:sort); x.nil? ? "-created_at" : x), String) }.delete_if { |k, v| v.nil? } r = @client.request("/#{CGI.escape(organization)}/shopify/private/apps").with_query(query).get r.map { |x| ::Io::Flow::V0::Models::ShopifyPrivateApp.new(x) } end |
#get_by_id(organization, id) ⇒ Object
8589 8590 8591 8592 8593 8594 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8589 def get_by_id(organization, id) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('id', id, String) r = @client.request("/#{CGI.escape(organization)}/shopify/private/apps/#{CGI.escape(id)}").get ::Io::Flow::V0::Models::ShopifyPrivateApp.new(r) end |
#put(organization, shopify_private_app_form) ⇒ Object
8582 8583 8584 8585 8586 8587 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8582 def put(organization, shopify_private_app_form) HttpClient::Preconditions.assert_class('organization', organization, String) (x = shopify_private_app_form; x.is_a?(::Io::Flow::V0::Models::ShopifyPrivateAppForm) ? x : ::Io::Flow::V0::Models::ShopifyPrivateAppForm.new(x)) r = @client.request("/#{CGI.escape(organization)}/shopify/private/apps").with_json(shopify_private_app_form.to_json).put ::Io::Flow::V0::Models::ShopifyPrivateApp.new(r) end |