Class: Io::Flow::V0::Clients::ShopifyLocationFlowCenterMappings
- Inherits:
-
Object
- Object
- Io::Flow::V0::Clients::ShopifyLocationFlowCenterMappings
- 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) ⇒ ShopifyLocationFlowCenterMappings
constructor
A new instance of ShopifyLocationFlowCenterMappings.
-
#post(organization, shopify_location_flow_center_mapping_form) ⇒ Object
Add a Shopify location/Flow Center mapping.
-
#put_by_id(organization, id, shopify_location_flow_center_mapping_form) ⇒ Object
Update a Shopify location/Flow Center mapping.
Constructor Details
#initialize(client) ⇒ ShopifyLocationFlowCenterMappings
Returns a new instance of ShopifyLocationFlowCenterMappings.
8513 8514 8515 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8513 def initialize(client) @client = HttpClient::Preconditions.assert_class('client', client, ::Io::Flow::V0::Client) end |
Instance Method Details
#delete_by_id(organization, id) ⇒ Object
8554 8555 8556 8557 8558 8559 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8554 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/locations/mappings/#{CGI.escape(id)}").delete nil end |
#get(organization, incoming = {}) ⇒ Object
8517 8518 8519 8520 8521 8522 8523 8524 8525 8526 8527 8528 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8517 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/locations/mappings").with_query(query).get r.map { |x| ::Io::Flow::V0::Models::ShopifyLocationFlowCenterMapping.new(x) } end |
#get_by_id(organization, id) ⇒ Object
8538 8539 8540 8541 8542 8543 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8538 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/locations/mappings/#{CGI.escape(id)}").get ::Io::Flow::V0::Models::ShopifyLocationFlowCenterMapping.new(r) end |
#post(organization, shopify_location_flow_center_mapping_form) ⇒ Object
Add a Shopify location/Flow Center mapping.
8531 8532 8533 8534 8535 8536 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8531 def post(organization, shopify_location_flow_center_mapping_form) HttpClient::Preconditions.assert_class('organization', organization, String) (x = shopify_location_flow_center_mapping_form; x.is_a?(::Io::Flow::V0::Models::ShopifyLocationFlowCenterMappingForm) ? x : ::Io::Flow::V0::Models::ShopifyLocationFlowCenterMappingForm.new(x)) r = @client.request("/#{CGI.escape(organization)}/shopify/locations/mappings").with_json(shopify_location_flow_center_mapping_form.to_json).post ::Io::Flow::V0::Models::ShopifyLocationFlowCenterMapping.new(r) end |
#put_by_id(organization, id, shopify_location_flow_center_mapping_form) ⇒ Object
Update a Shopify location/Flow Center mapping.
8546 8547 8548 8549 8550 8551 8552 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8546 def put_by_id(organization, id, shopify_location_flow_center_mapping_form) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('id', id, String) (x = shopify_location_flow_center_mapping_form; x.is_a?(::Io::Flow::V0::Models::ShopifyLocationFlowCenterMappingForm) ? x : ::Io::Flow::V0::Models::ShopifyLocationFlowCenterMappingForm.new(x)) r = @client.request("/#{CGI.escape(organization)}/shopify/locations/mappings/#{CGI.escape(id)}").with_json(shopify_location_flow_center_mapping_form.to_json).put ::Io::Flow::V0::Models::ShopifyLocationFlowCenterMapping.new(r) end |