class EasyPost::Order

Public Class Methods

all(filters={}, api_key=nil) click to toggle source
# File lib/easypost/order.rb, line 24
def self.all(filters={}, api_key=nil)
  raise NotImplementedError.new('Order.all not implemented.')
end

Public Instance Methods

buy(params={}) click to toggle source
# File lib/easypost/order.rb, line 10
def buy(params={})
  if params.instance_of?(EasyPost::Rate)
    temp = params.clone
    params = {}
    params[:carrier] = temp.carrier
    params[:service] = temp.service
  end

  response = EasyPost.make_request(:post, url + '/buy', @api_key, params)
  self.refresh_from(response, @api_key, true)

  return self
end
get_rates(params={}) click to toggle source
# File lib/easypost/order.rb, line 3
def get_rates(params={})
  response = EasyPost.make_request(:get, url + '/rates', @api_key, params)
  self.refresh_from(response, @api_key, true)

  return self
end