class GooglePlus::Error
Custom error class for rescuing from all GooglePlus
errors
Attributes
http_headers[R]
Public Class Methods
new(message, http_headers)
click to toggle source
Initializes a new Error
object
@param message [String] @param http_headers
[Hash] @return [Twitter::Error]
Calls superclass method
# File lib/google_plus/error.rb, line 11 def initialize(message, http_headers) @http_headers = Hash[http_headers] super(message) end
Public Instance Methods
ratelimit_limit()
click to toggle source
@return [Integer]
# File lib/google_plus/error.rb, line 22 def ratelimit_limit @http_headers.values_at('x-ratelimit-limit', 'X-RateLimit-Limit').detect{|value| value}.to_i end
ratelimit_remaining()
click to toggle source
@return [Integer]
# File lib/google_plus/error.rb, line 27 def ratelimit_remaining @http_headers.values_at('x-ratelimit-remaining', 'X-RateLimit-Remaining').detect{|value| value}.to_i end
ratelimit_reset()
click to toggle source
@return [Time]
# File lib/google_plus/error.rb, line 17 def ratelimit_reset Time.at(@http_headers.values_at('x-ratelimit-reset', 'X-RateLimit-Reset').detect{|value| value}.to_i) end
retry_after()
click to toggle source
@return [Integer]
# File lib/google_plus/error.rb, line 32 def retry_after [(ratelimit_reset - Time.now).ceil, 0].max end