Module: Shippo::API::Operations::Rates

Defined in:
lib/shippo/api/operations/rates.rb

Instance Method Summary collapse

Instance Method Details

#rates(shipment_object_id, currency = nil, params = {}) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/shippo/api/operations/rates.rb', line 5

def rates(shipment_object_id, currency = nil, params = {})
  if !currency.nil?
    response = Shippo::API.get("#{url}/#{shipment_object_id}/rates/#{currency}/", params)
  else
    response = Shippo::API.get("#{url}/#{shipment_object_id}/rates/", params)
  end
  Shippo::Rate.from(response[:results])
end