Exception: Redd::Error::RateLimited

Inherits:
Redd::Error
  • Object
show all
Defined in:
lib/redd/error.rb

Overview

Raised when the client needs to wait before making another request

Direct Known Subclasses

QuotaFilled

Constant Summary

Constants inherited from Redd::Error

Archived, AuthenticationRequired, BadGateway, BadRequest, Conflict, ExpiredCode, InternalServerError, InvalidCaptcha, InvalidClassName, InvalidCredentials, InvalidGrantType, InvalidMultiredditName, InvalidOAuth2Credentials, InvalidRequest, InvalidResponseType, InvalidScope, JSONError, NoTokenGiven, NotFound, OAuth2AccessDenied, PermissionDenied, RequestError, ServiceUnavailable, TimedOut, TooManyClassNames

Instance Attribute Summary collapse

Attributes inherited from Redd::Error

#body, #code, #headers

Instance Method Summary collapse

Methods inherited from Redd::Error

from_response, parse_error

Constructor Details

#initialize(env) ⇒ RateLimited

Returns a new instance of RateLimited.



127
128
129
130
# File 'lib/redd/error.rb', line 127

def initialize(env)
  super
  @time = env[:body][:json][:ratelimit] || 3600
end

Instance Attribute Details

#timeInteger (readonly)

Returns the seconds to wait before making another request.

Returns:

  • (Integer)

    the seconds to wait before making another request.



125
126
127
# File 'lib/redd/error.rb', line 125

def time
  @time
end