Exception: Callcredit::CallcreditError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/callcredit/errors/callcredit_error.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message = nil, status = nil, response = nil) ⇒ CallcreditError

Returns a new instance of CallcreditError.



7
8
9
10
11
# File 'lib/callcredit/errors/callcredit_error.rb', line 7

def initialize(message = nil, status = nil, response = nil)
  @message = message
  @status = status
  @response = response
end

Instance Attribute Details

#messageObject (readonly)

Returns the value of attribute message.



3
4
5
# File 'lib/callcredit/errors/callcredit_error.rb', line 3

def message
  @message
end

#responseObject (readonly)

Returns the value of attribute response.



5
6
7
# File 'lib/callcredit/errors/callcredit_error.rb', line 5

def response
  @response
end

#statusObject (readonly)

Returns the value of attribute status.



4
5
6
# File 'lib/callcredit/errors/callcredit_error.rb', line 4

def status
  @status
end

Instance Method Details

#response_bodyObject



13
14
15
# File 'lib/callcredit/errors/callcredit_error.rb', line 13

def response_body
  response.fetch(:body, nil) if response.responds_to?(:fetch)
end

#to_sObject



17
18
19
20
# File 'lib/callcredit/errors/callcredit_error.rb', line 17

def to_s
  status_string = @status.nil? ? "" : "(Status #{@status}) "
  "#{status_string}#{@message}"
end