module Shippo::API

Constants

VERSION

Attributes

base[RW]
debug[RW]
open_timeout[RW]
read_timeout[RW]
token[W]
version[RW]
warnings[RW]

Public Class Methods

debug?() click to toggle source
# File lib/shippo/api.rb, line 56
def debug?
  self.debug
end
request(method, uri, params = {}, headers = {}) click to toggle source

@param [Symbol] method One of :get, :put, :post @param [String] uri the URL component after the first slash but before params @param [Hash] params hash of optional parameters to add to the URL @param [Hash] headers optionally added headers

# File lib/shippo/api.rb, line 42
def request(method, uri, params = {}, headers = {})
  ::Shippo::API::Request.new(method:  method,
                             uri:     uri,
                             params:  params,
                             headers: headers).execute
end
token() click to toggle source
# File lib/shippo/api.rb, line 26
def token
  Thread.current[:shippo_api_token] || @token
end
with_token(token) { || ... } click to toggle source
# File lib/shippo/api.rb, line 30
def with_token(token)
  old_thread_token = Thread.current[:shippo_api_token]
  Thread.current[:shippo_api_token] = token
  yield
ensure
  Thread.current[:shippo_api_token] = old_thread_token
end