Class: Io::Flow::V0::Clients::CarrierServices

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

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ CarrierServices

Returns a new instance of CarrierServices.



4929
4930
4931
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4929

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 carrier services supported by Flow.



4934
4935
4936
4937
4938
4939
4940
4941
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4934

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/carrier/services").with_query(query).get
  r.map { |x| ::Io::Flow::V0::Models::CarrierService.new(x) }
end