Exception: Slack::TooManyRequestsError

Inherits:
APIError
  • Object
show all
Defined in:
lib/laziness/errors.rb

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ TooManyRequestsError

Returns a new instance of TooManyRequestsError.



99
100
101
# File 'lib/laziness/errors.rb', line 99

def initialize(response)
  @response = response
end

Instance Method Details

#messageObject



103
104
105
# File 'lib/laziness/errors.rb', line 103

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

#retry_after_in_secondsObject



107
108
109
110
# File 'lib/laziness/errors.rb', line 107

def retry_after_in_seconds
  retry_after = response.headers["retry-after"]
  (retry_after || 0).to_i
end