Class: Slack::Web::Api::Errors::TooManyRequestsError

Inherits:
Faraday::Error
  • Object
show all
Defined in:
lib/slack/web/api/errors/too_many_requests_error.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ TooManyRequestsError

Returns a new instance of TooManyRequestsError.



9
10
11
12
# File 'lib/slack/web/api/errors/too_many_requests_error.rb', line 9

def initialize(response)
  @response = response
  super "Retry after #{retry_after} seconds"
end

Instance Attribute Details

#responseObject (readonly)

Returns the value of attribute response.



7
8
9
# File 'lib/slack/web/api/errors/too_many_requests_error.rb', line 7

def response
  @response
end

Instance Method Details

#retry_afterObject



14
15
16
# File 'lib/slack/web/api/errors/too_many_requests_error.rb', line 14

def retry_after
  response.headers['retry-after'].to_i
end