Class: Io::Flow::V0::Clients::Addresses
- Inherits:
-
Object
- Object
- Io::Flow::V0::Clients::Addresses
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Method Summary collapse
-
#get(incoming = {}) ⇒ Object
Geolocates the request based on the provided parameters, returning a list of potential matching addresses.
-
#initialize(client) ⇒ Addresses
constructor
A new instance of Addresses.
Constructor Details
#initialize(client) ⇒ Addresses
Returns a new instance of Addresses.
2807 2808 2809 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 2807 def initialize(client) @client = HttpClient::Preconditions.assert_class('client', client, ::Io::Flow::V0::Client) end |
Instance Method Details
#get(incoming = {}) ⇒ Object
Geolocates the request based on the provided parameters, returning a list of potential matching addresses.
2813 2814 2815 2816 2817 2818 2819 2820 2821 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 2813 def get(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) query = { :address => (x = opts.delete(:address); x.nil? ? nil : HttpClient::Preconditions.assert_class('address', x, String)), :ip => (x = opts.delete(:ip); x.nil? ? nil : HttpClient::Preconditions.assert_class('ip', x, String)) }.delete_if { |k, v| v.nil? } r = @client.request("/addresses").with_query(query).get r.map { |x| ::Io::Flow::V0::Models::Address.new(x) } end |