Class: Peddler::MWS
- Inherits:
-
Object
- Object
- Peddler::MWS
- Defined in:
- lib/peddler/mws.rb
Overview
Parses MWS metadata provided in the headers of a response
Instance Method Summary collapse
-
#quota_max ⇒ Integer?
The max hourly request quota for the requested operation.
-
#quota_remaining ⇒ Integer?
The remaining hourly request quota for the requested operation.
-
#quota_resets_on ⇒ Time?
When the hourly request quota for the requested operation resets.
-
#request_id ⇒ String?
The ID of the request.
-
#response_context ⇒ String?
The context of the response.
-
#timestamp ⇒ Time?
The timestamp of the request.
Instance Method Details
#quota_max ⇒ Integer?
The max hourly request quota for the requested operation
16 17 18 19 20 |
# File 'lib/peddler/mws.rb', line 16 def quota_max return unless headers['x-mws-quota-max'] headers['x-mws-quota-max'].to_i end |
#quota_remaining ⇒ Integer?
The remaining hourly request quota for the requested operation
24 25 26 27 28 |
# File 'lib/peddler/mws.rb', line 24 def quota_remaining return unless headers['x-mws-quota-remaining'] headers['x-mws-quota-remaining'].to_i end |
#quota_resets_on ⇒ Time?
When the hourly request quota for the requested operation resets
32 33 34 35 36 |
# File 'lib/peddler/mws.rb', line 32 def quota_resets_on return unless headers['x-mws-quota-resetsOn'] Time.parse(headers['x-mws-quota-resetsOn']) end |
#request_id ⇒ String?
The ID of the request
40 41 42 |
# File 'lib/peddler/mws.rb', line 40 def request_id headers['x-mws-request-id'] end |
#response_context ⇒ String?
The context of the response
54 55 56 |
# File 'lib/peddler/mws.rb', line 54 def response_context headers['x-mws-response-context'] end |
#timestamp ⇒ Time?
The timestamp of the request
46 47 48 49 50 |
# File 'lib/peddler/mws.rb', line 46 def return unless headers['x-mws-timestamp'] Time.parse(headers['x-mws-timestamp']) end |