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
12
# 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)


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

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)


24
25
26
27
28
# File 'lib/peddler/headers.rb', line 24

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)


32
33
34
# File 'lib/peddler/headers.rb', line 32

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

#mws_response_contextString?

The context of the response

Returns:

  • (String, nil)


46
47
48
# File 'lib/peddler/headers.rb', line 46

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

#mws_timestampTime?

The timestamp of the request

Returns:

  • (Time, nil)


38
39
40
41
42
# File 'lib/peddler/headers.rb', line 38

def mws_timestamp
  return unless headers['x-mws-timestamp']

  Time.parse(headers['x-mws-timestamp'])
end