Class: Io::Flow::V0::Clients::Carriers
- Inherits:
-
Object
- Object
- Io::Flow::V0::Clients::Carriers
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Method Summary collapse
-
#get(incoming = {}) ⇒ Object
Returns a list of carriers supported by Flow.
-
#initialize(client) ⇒ Carriers
constructor
A new instance of Carriers.
Constructor Details
#initialize(client) ⇒ Carriers
Returns a new instance of Carriers.
5268 5269 5270 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5268 def initialize(client) @client = HttpClient::Preconditions.assert_class('client', client, ::Io::Flow::V0::Client) end |
Instance Method Details
#get(incoming = {}) ⇒ Object
Returns a list of carriers supported by Flow.
5273 5274 5275 5276 5277 5278 5279 5280 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5273 def get(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) query = { :q => (x = opts.delete(:q); x.nil? ? nil : HttpClient::Preconditions.assert_class('q', x, String)) }.delete_if { |k, v| v.nil? } r = @client.request("/reference/carriers").with_query(query).get r.map { |x| ::Io::Flow::V0::Models::Carrier.new(x) } end |