Exception: Amply::Exceptions::APIException

Inherits:
StandardError
  • Object
show all
Defined in:
lib/amply/exceptions/api_exception.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ APIException



6
7
8
9
10
11
# File 'lib/amply/exceptions/api_exception.rb', line 6

def initialize(response)
  @status = response.code.to_i
  @text = response.message

  super
end

Instance Attribute Details

#statusObject (readonly)

Returns the value of attribute status.



4
5
6
# File 'lib/amply/exceptions/api_exception.rb', line 4

def status
  @status
end

#textObject (readonly)

Returns the value of attribute text.



4
5
6
# File 'lib/amply/exceptions/api_exception.rb', line 4

def text
  @text
end

Instance Method Details

#messageObject



13
14
15
# File 'lib/amply/exceptions/api_exception.rb', line 13

def message
  'An error occurred while making an API request'
end