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.



792
793
794
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 792

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.



797
798
799
800
801
802
803
804
805
806
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 797

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