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


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

def initialize(response)
  @response = response
end

Instance Attribute Details

#responseObject (readonly)

Returns the value of attribute response


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

def response
  @response
end

Instance Method Details

#messageObject


12
13
14
# File 'lib/slack/web/api/errors/too_many_requests_error.rb', line 12

def message
  "Retry after #{retry_after} seconds"
end

#retry_afterObject


16
17
18
# File 'lib/slack/web/api/errors/too_many_requests_error.rb', line 16

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