Exception: Formi9::Error

Inherits:
StandardError
  • Object
show all
Defined in:
lib/formi9/error.rb

Overview

Part1 API error Custom error class for rescuing from all formi9.com errors

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ Error

Returns a new instance of Error.



7
8
9
10
11
12
# File 'lib/formi9/error.rb', line 7

def initialize(response)
  super
  @response = response.dup
  @http_method = response.method.to_s
  @url = response.url
end

Instance Attribute Details

#errorsObject (readonly)

Returns the value of attribute errors.



5
6
7
# File 'lib/formi9/error.rb', line 5

def errors
  @errors
end

#http_methodObject (readonly)

Returns the value of attribute http_method.



5
6
7
# File 'lib/formi9/error.rb', line 5

def http_method
  @http_method
end

#urlObject (readonly)

Returns the value of attribute url.



5
6
7
# File 'lib/formi9/error.rb', line 5

def url
  @url
end

Instance Method Details

#messageObject



14
15
16
17
18
19
20
21
# File 'lib/formi9/error.rb', line 14

def message
  <<-HEREDOC
URL: #{@response.url}
method: #{@response.method}
response status: #{@response.status}
response body: #{@response.response.body}
  HEREDOC
end