Class: Io::Flow::V0::Clients::ShopifyLocalizationSettings
- Inherits:
-
Object
- Object
- Io::Flow::V0::Clients::ShopifyLocalizationSettings
- 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) ⇒ ShopifyLocalizationSettings
constructor
A new instance of ShopifyLocalizationSettings.
-
#post(organization, shopify_localization_setting_form) ⇒ Object
Add a localization setting.
-
#put_by_id(organization, id, shopify_localization_setting_form) ⇒ Object
Update a localization setting.
Constructor Details
#initialize(client) ⇒ ShopifyLocalizationSettings
Returns a new instance of ShopifyLocalizationSettings.
7736 7737 7738 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7736 def initialize(client) @client = HttpClient::Preconditions.assert_class('client', client, ::Io::Flow::V0::Client) end |
Instance Method Details
#delete_by_id(organization, id) ⇒ Object
7777 7778 7779 7780 7781 7782 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7777 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/localization/settings/#{CGI.escape(id)}").delete nil end |
#get(organization, incoming = {}) ⇒ Object
7740 7741 7742 7743 7744 7745 7746 7747 7748 7749 7750 7751 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7740 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/localization/settings").with_query(query).get r.map { |x| ::Io::Flow::V0::Models::ShopifyLocalizationSetting.new(x) } end |
#get_by_id(organization, id) ⇒ Object
7761 7762 7763 7764 7765 7766 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7761 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/localization/settings/#{CGI.escape(id)}").get ::Io::Flow::V0::Models::ShopifyLocalizationSetting.new(r) end |
#post(organization, shopify_localization_setting_form) ⇒ Object
Add a localization setting.
7754 7755 7756 7757 7758 7759 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7754 def post(organization, shopify_localization_setting_form) HttpClient::Preconditions.assert_class('organization', organization, String) (x = shopify_localization_setting_form; x.is_a?(::Io::Flow::V0::Models::ShopifyLocalizationSettingForm) ? x : ::Io::Flow::V0::Models::ShopifyLocalizationSettingForm.new(x)) r = @client.request("/#{CGI.escape(organization)}/shopify/localization/settings").with_json(shopify_localization_setting_form.to_json).post ::Io::Flow::V0::Models::ShopifyLocalizationSetting.new(r) end |
#put_by_id(organization, id, shopify_localization_setting_form) ⇒ Object
Update a localization setting.
7769 7770 7771 7772 7773 7774 7775 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7769 def put_by_id(organization, id, shopify_localization_setting_form) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('id', id, String) (x = shopify_localization_setting_form; x.is_a?(::Io::Flow::V0::Models::ShopifyLocalizationSettingForm) ? x : ::Io::Flow::V0::Models::ShopifyLocalizationSettingForm.new(x)) r = @client.request("/#{CGI.escape(organization)}/shopify/localization/settings/#{CGI.escape(id)}").with_json(shopify_localization_setting_form.to_json).put ::Io::Flow::V0::Models::ShopifyLocalizationSetting.new(r) end |