Exception: PreventGo::ResponseError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/prevent_go/response_error.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(request_url, code, details) ⇒ ResponseError

Returns a new instance of ResponseError.



5
6
7
8
9
10
11
12
# File 'lib/prevent_go/response_error.rb', line 5

def initialize(request_url, code, details)
  @request_url, @code, @details = request_url, code, details

  @details['Code'] = code
  @details['Url'] = request_url.request_uri

  super(message) if message
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



3
4
5
# File 'lib/prevent_go/response_error.rb', line 3

def code
  @code
end

#detailsObject (readonly)

Returns the value of attribute details.



3
4
5
# File 'lib/prevent_go/response_error.rb', line 3

def details
  @details
end

#request_urlObject (readonly)

Returns the value of attribute request_url.



3
4
5
# File 'lib/prevent_go/response_error.rb', line 3

def request_url
  @request_url
end

Instance Method Details

#messageObject



18
19
20
# File 'lib/prevent_go/response_error.rb', line 18

def message
  @details.dig('error', 'message')
end

#typeObject



14
15
16
# File 'lib/prevent_go/response_error.rb', line 14

def type
  @details.dig('error', 'code')
end