Class: Io::Flow::V0::Clients::ExperienceCheckoutSettings

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

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ ExperienceCheckoutSettings

Returns a new instance of ExperienceCheckoutSettings.



1672
1673
1674
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1672

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

Instance Method Details

#get(organization, experience_key, incoming = {}) ⇒ Object



1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1676

def get(organization, experience_key, incoming={})
  HttpClient::Preconditions.assert_class('organization', organization, String)
  HttpClient::Preconditions.assert_class('experience_key', experience_key, String)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  query = {
    :context => (x = opts.delete(:context); x.nil? ? nil : HttpClient::Preconditions.assert_class('context', x, String))
  }.delete_if { |k, v| v.nil? }
  r = @client.request("/#{CGI.escape(organization)}/experiences/#{CGI.escape(experience_key)}/settings/checkout").with_query(query).get
  ::Io::Flow::V0::Models::ExperienceCheckoutSettings.new(r)
end

#put(organization, experience_key, experience_checkout_settings_form, incoming = {}) ⇒ Object



1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 1687

def put(organization, experience_key, experience_checkout_settings_form, incoming={})
  HttpClient::Preconditions.assert_class('organization', organization, String)
  HttpClient::Preconditions.assert_class('experience_key', experience_key, String)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  query = {
    :context => (x = opts.delete(:context); x.nil? ? nil : HttpClient::Preconditions.assert_class('context', x, String))
  }.delete_if { |k, v| v.nil? }
  (x = experience_checkout_settings_form; x.is_a?(::Io::Flow::V0::Models::ExperienceCheckoutSettingsForm) ? x : ::Io::Flow::V0::Models::ExperienceCheckoutSettingsForm.new(x))
  r = @client.request("/#{CGI.escape(organization)}/experiences/#{CGI.escape(experience_key)}/settings/checkout").with_query(query).with_json(experience_checkout_settings_form.to_json).put
  ::Io::Flow::V0::Models::ExperienceCheckoutSettings.new(r)
end