Sha256: 24087db576925919f2fab238fac60a3574013b903b8bb9ca0e3b30882407cc33

Contents?: true

Size: 609 Bytes

Versions: 7

Compression:

Stored size: 609 Bytes

Contents

module EasyPost
  class Order < Resource

    def get_rates(params={})
      response, api_key = EasyPost.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, api_key = EasyPost.request(:post, url + '/buy', @api_key, params)
      self.refresh_from(response, @api_key, true)

      return self
    end

  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
easypost-3.0.1 lib/easypost/order.rb
easypost-3.0.0 lib/easypost/order.rb
easypost-2.7.3 lib/easypost/order.rb
easypost-2.7.2 lib/easypost/order.rb
easypost-2.7.1 lib/easypost/order.rb
easypost-2.7.0 lib/easypost/order.rb
easypost-2.6.2 lib/easypost/order.rb