class EventbriteSDK::EventbriteAPIError
Attributes
message[R]
response[R]
Public Class Methods
new(msg = '', response = :none)
click to toggle source
# File lib/eventbrite_sdk/exceptions.rb, line 5 def initialize(msg = '', response = :none) @message = msg @response = response end
Public Instance Methods
parsed_error()
click to toggle source
Returns a hash with AT LEAST 'error_description'. When an error is raised manually there will be no response! This is handled by using the specified message as the error_description.
# File lib/eventbrite_sdk/exceptions.rb, line 13 def parsed_error default = %({"error_description": "#{message}"}) value = response_value(:body, fallback: default) JSON.parse(value) end
status_code()
click to toggle source
Returns the status code of the response, or :none if there is no response.
# File lib/eventbrite_sdk/exceptions.rb, line 21 def status_code response_value(:code) end
Private Instance Methods
response_value(key, fallback: :none)
click to toggle source
# File lib/eventbrite_sdk/exceptions.rb, line 27 def response_value(key, fallback: :none) if response.respond_to?(key) response.send(key) else fallback end end