class Calendly::ApiError
Calendly
apis client error object.
Attributes
cause_exception[R]
@return [OAuth2::Error, JSON::ParserError]
response[R]
@return [Faraday::Response]
status[R]
@return [Integer]
title[R]
@return [String]
Public Class Methods
new(response, cause_exception, message: nil)
click to toggle source
Calls superclass method
# File lib/calendly/api_error.rb, line 20 def initialize(response, cause_exception, message: nil) @response = response @cause_exception = cause_exception @message = message set_attributes_from_response @message ||= cause_exception.message if cause_exception super @message end
Public Instance Methods
inspect()
click to toggle source
# File lib/calendly/api_error.rb, line 29 def inspect "\#<#{self.class}:#{object_id} title:#{title}, status:#{status}>" end
Private Instance Methods
set_attributes_from_response()
click to toggle source
# File lib/calendly/api_error.rb, line 35 def set_attributes_from_response # rubocop:disable Metrics/CyclomaticComplexity return unless response return unless response.respond_to? :body @status = response.status if response.respond_to? :status parsed = JSON.parse response.body, symbolize_names: true @title = parsed[:title] || parsed[:error] @message ||= parsed[:message] || parsed[:error_description] rescue JSON::ParserError nil end