Class: Io::Flow::V0::Clients::AddressConfigurations

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

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ AddressConfigurations

Returns a new instance of AddressConfigurations.



656
657
658
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 656

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

Instance Method Details

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

Search checkout address configurations.



661
662
663
664
665
666
667
668
669
670
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 661

def get(organization, incoming={})
  HttpClient::Preconditions.assert_class('organization', organization, String)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  query = {
    :country => (x = opts.delete(:country); x.nil? ? nil : HttpClient::Preconditions.assert_class('country', x, Array).map { |v| HttpClient::Preconditions.assert_class('country', v, String) }),
    :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)}/address/configurations").with_query(query).get
  r.map { |x| ::Io::Flow::V0::Models::AddressConfiguration.new(x) }
end