Exception: Flattr::Error
- Inherits:
-
StandardError
- Object
- StandardError
- Flattr::Error
- Defined in:
- lib/flattr/error.rb
Overview
Custom error class for rescuing from all Flattr errors
Direct Known Subclasses
Defined Under Namespace
Classes: BadGateway, BadRequest, ClientError, Forbidden, InternalServerError, NotAcceptable, NotFound, ServerError, Unauthorized
Instance Attribute Summary collapse
-
#http_headers ⇒ Object
readonly
Returns the value of attribute http_headers.
Instance Method Summary collapse
-
#initialize(message, http_headers) ⇒ Error
constructor
Private: Initializes a new Error object.
- #ratelimit_limit ⇒ Integer
- #ratelimit_remaining ⇒ Integer
Constructor Details
Instance Attribute Details
#http_headers ⇒ Object (readonly)
Returns the value of attribute http_headers.
4 5 6 |
# File 'lib/flattr/error.rb', line 4 def http_headers @http_headers end |
Instance Method Details
#ratelimit_limit ⇒ Integer
18 19 20 |
# File 'lib/flattr/error.rb', line 18 def ratelimit_limit @http_headers.values_at('x-ratelimit-limit', 'X-RateLimit-Limit').detect{|value| value}.to_i end |
#ratelimit_remaining ⇒ Integer
23 24 25 |
# File 'lib/flattr/error.rb', line 23 def ratelimit_remaining @http_headers.values_at('x-ratelimit-remaining', 'X-RateLimit-Remaining').detect{|value| value}.to_i end |