Sha256: dc8bf452896528ca063674725d1f8bce62ba22927326dd3b3a9c04bcbe75e2d4

Contents?: true

Size: 676 Bytes

Versions: 6

Compression:

Stored size: 676 Bytes

Contents

class EasyPost::Order < EasyPost::Resource

  def get_rates(params={})
    response = EasyPost.make_request(:get, url + '/rates', @api_key, params)
    self.refresh_from(response, @api_key, true)

    return self
  end

  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

  def self.all(filters={}, api_key=nil)
    raise NotImplementedError.new('Order.all not implemented.')
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
easypost-3.5.1 lib/easypost/order.rb
easypost-3.5.0 lib/easypost/order.rb
easypost-3.4.0 lib/easypost/order.rb
easypost-3.3.0 lib/easypost/order.rb
easypost-3.2.0 lib/easypost/order.rb
easypost-3.1.5 lib/easypost/order.rb