Module: Peddler::Headers

Included in:
FlatFileParser, XMLParser
Defined in:
lib/peddler/headers.rb

Overview

Parses MWS-specific headers

Instance Method Summary collapse

Instance Method Details

#mws_quota_maxInteger?

The max hourly request quota for the requested operation

Returns:

  • (Integer, nil)


8
9
10
11
# File 'lib/peddler/headers.rb', line 8

def mws_quota_max
  return unless headers['x-mws-quota-max']
  headers['x-mws-quota-max'].to_i
end

#mws_quota_remainingInteger?

The remaining hourly request quota for the requested operation

Returns:

  • (Integer, nil)


15
16
17
18
# File 'lib/peddler/headers.rb', line 15

def mws_quota_remaining
  return unless headers['x-mws-quota-remaining']
  headers['x-mws-quota-remaining'].to_i
end

#mws_quota_resets_onTime?

When the hourly request quota for the requested operation resets

Returns:

  • (Time, nil)


22
23
24
25
# File 'lib/peddler/headers.rb', line 22

def mws_quota_resets_on
  return unless headers['x-mws-quota-resetsOn']
  Time.parse(headers['x-mws-quota-resetsOn'])
end

#mws_request_idString?

The ID of the request

Returns:

  • (String, nil)


29
30
31
# File 'lib/peddler/headers.rb', line 29

def mws_request_id
  headers['x-mws-request-id']
end

#mws_response_contextString?

The context of the response

Returns:

  • (String, nil)


42
43
44
# File 'lib/peddler/headers.rb', line 42

def mws_response_context
  headers['x-mws-response-context']
end

#mws_timestampTime?

The timestamp of the request

Returns:

  • (Time, nil)


35
36
37
38
# File 'lib/peddler/headers.rb', line 35

def mws_timestamp
  return unless headers['x-mws-timestamp']
  Time.parse(headers['x-mws-timestamp'])
end