Sha256: 21d80e46cbeb6798f8865bb2a6648dc588cad73a4ea1189ff5241ed01d268200

Contents?: true

Size: 718 Bytes

Versions: 2

Compression:

Stored size: 718 Bytes

Contents

module EasyPost
  class Order < 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
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
easypost-3.1.4 lib/easypost/order.rb
easypost-3.1.3 lib/easypost/order.rb