Class: Io::Flow::V0::Clients::ShopifyLocalizationSettings

Inherits:
Object
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ ShopifyLocalizationSettings

Returns a new instance of ShopifyLocalizationSettings.



8031
8032
8033
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8031

def initialize(client)
  @client = HttpClient::Preconditions.assert_class('client', client, ::Io::Flow::V0::Client)
end

Instance Method Details

#delete_by_id(organization, id) ⇒ Object



8072
8073
8074
8075
8076
8077
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8072

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



8035
8036
8037
8038
8039
8040
8041
8042
8043
8044
8045
8046
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8035

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



8056
8057
8058
8059
8060
8061
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8056

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.



8049
8050
8051
8052
8053
8054
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8049

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.



8064
8065
8066
8067
8068
8069
8070
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8064

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