Exception: Holodex::ResourceError

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(http_code, data) ⇒ ResourceError



5
6
7
8
9
# File 'lib/holodex/resource/error.rb', line 5

def initialize(http_code, data)
  @http_code = http_code
  @data = data
  super("Holodex returned an HTTP #@http_code with the following payload: #@data")
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



3
4
5
# File 'lib/holodex/resource/error.rb', line 3

def data
  @data
end

#http_codeObject (readonly)

Returns the value of attribute http_code.



3
4
5
# File 'lib/holodex/resource/error.rb', line 3

def http_code
  @http_code
end

Instance Method Details

#[](key) ⇒ Object



11
12
13
# File 'lib/holodex/resource/error.rb', line 11

def [](key)
  @data[key]
end