Exception: ExternalServices::Api::Error

Inherits:
StandardError
  • Object
show all
Defined in:
lib/external_services/api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ Error

Returns a new instance of Error.



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/external_services/api.rb', line 10

def initialize(response)
  @response = response

  if response.respond_to?(:env)
    @status = response.status
    @url = response.env.url.to_s
    @method = response.env.method.to_s.upcase
    @body = response.body
  end

  super(build_message)
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



8
9
10
# File 'lib/external_services/api.rb', line 8

def body
  @body
end

#methodObject (readonly)

Returns the value of attribute method.



8
9
10
# File 'lib/external_services/api.rb', line 8

def method
  @method
end

#responseObject (readonly)

Returns the value of attribute response.



8
9
10
# File 'lib/external_services/api.rb', line 8

def response
  @response
end

#statusObject (readonly)

Returns the value of attribute status.



8
9
10
# File 'lib/external_services/api.rb', line 8

def status
  @status
end

#urlObject (readonly)

Returns the value of attribute url.



8
9
10
# File 'lib/external_services/api.rb', line 8

def url
  @url
end