Module: Shippo::API
- Defined in:
- lib/shippo/api.rb,
lib/shippo/api/request.rb,
lib/shippo/api/version.rb,
lib/shippo/api/api_hash.rb,
lib/shippo/api/category.rb,
lib/shippo/api/resource.rb,
lib/shippo/api/api_object.rb,
lib/shippo/api/extend/url.rb,
lib/shippo/api/operations.rb,
lib/shippo/api/category/base.rb,
lib/shippo/api/category/state.rb,
lib/shippo/api/category/source.rb,
lib/shippo/api/category/status.rb,
lib/shippo/api/operations/list.rb,
lib/shippo/api/category/purpose.rb,
lib/shippo/api/extend/operation.rb,
lib/shippo/api/operations/batch.rb,
lib/shippo/api/operations/rates.rb,
lib/shippo/api/operations/track.rb,
lib/shippo/api/operations/create.rb,
lib/shippo/api/operations/update.rb,
lib/shippo/api/transformers/list.rb,
lib/shippo/api/extend/transformers.rb,
lib/shippo/api/operations/validate.rb
Defined Under Namespace
Modules: Category, Extend, Operations, Transformers Classes: ApiHash, ApiObject, Request, Resource
Constant Summary collapse
- VERSION =
'4.0.0'
Class Attribute Summary collapse
-
.base ⇒ Object
Returns the value of attribute base.
-
.debug ⇒ Object
Returns the value of attribute debug.
-
.open_timeout ⇒ Object
Returns the value of attribute open_timeout.
-
.read_timeout ⇒ Object
Returns the value of attribute read_timeout.
- .token ⇒ Object
-
.version ⇒ Object
Returns the value of attribute version.
-
.warnings ⇒ Object
Returns the value of attribute warnings.
Class Method Summary collapse
- .debug? ⇒ Boolean
- .request(method, uri, params = {}, headers = {}) ⇒ Object
- .with_token(token) ⇒ Object
Class Attribute Details
.base ⇒ Object
Returns the value of attribute base.
24 25 26 |
# File 'lib/shippo/api.rb', line 24 def base @base end |
.debug ⇒ Object
Returns the value of attribute debug.
24 25 26 |
# File 'lib/shippo/api.rb', line 24 def debug @debug end |
.open_timeout ⇒ Object
Returns the value of attribute open_timeout.
24 25 26 |
# File 'lib/shippo/api.rb', line 24 def open_timeout @open_timeout end |
.read_timeout ⇒ Object
Returns the value of attribute read_timeout.
24 25 26 |
# File 'lib/shippo/api.rb', line 24 def read_timeout @read_timeout end |
.token ⇒ Object
26 27 28 |
# File 'lib/shippo/api.rb', line 26 def token Thread.current[:shippo_api_token] || @token end |
.version ⇒ Object
Returns the value of attribute version.
24 25 26 |
# File 'lib/shippo/api.rb', line 24 def version @version end |
.warnings ⇒ Object
Returns the value of attribute warnings.
24 25 26 |
# File 'lib/shippo/api.rb', line 24 def warnings @warnings end |
Class Method Details
.debug? ⇒ Boolean
56 57 58 |
# File 'lib/shippo/api.rb', line 56 def debug? self.debug end |
.request(method, uri, params = {}, headers = {}) ⇒ Object
42 43 44 45 46 47 |
# 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 |
.with_token(token) ⇒ Object
30 31 32 33 34 35 36 |
# 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 |