Method: EasyPost::Services::Order#buy

Defined in:
lib/easypost/services/order.rb

#buy(id, params = {}) ⇒ Object

Buy an Order object



29
30
31
32
33
34
35
36
37
# File 'lib/easypost/services/order.rb', line 29

def buy(id, params = {})
  if params.instance_of?(EasyPost::Models::Rate)
    params = { carrier: params[:carrier], service: params[:service] }
  end

  response = @client.make_request(:post, "orders/#{id}/buy", params)

  EasyPost::InternalUtilities::Json.convert_json_to_object(response, MODEL_CLASS)
end