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.
7321 7322 7323 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7321 def initialize(client) @client = HttpClient::Preconditions.assert_class('client', client, ::Io::Flow::V0::Client) end |
Instance Method Details
#delete_by_id(organization, id) ⇒ Object
7352 7353 7354 7355 7356 7357 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7352 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
7325 7326 7327 7328 7329 7330 7331 7332 7333 7334 7335 7336 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7325 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
7345 7346 7347 7348 7349 7350 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7345 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
7338 7339 7340 7341 7342 7343 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7338 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 |