Exception: Caplinked::Error

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code = nil, message = '', headers = {}) ⇒ Error

Returns a new instance of Error.



11
12
13
14
15
# File 'lib/caplinked/error.rb', line 11

def initialize(code = nil, message = '', headers = {})
  super(message)
  @code = code
  @headers = headers
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



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

def code
  @code
end

#headersObject (readonly)

Returns the value of attribute headers.



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

def headers
  @headers
end

#messageObject (readonly)

Returns the value of attribute message.



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

def message
  @message
end

Class Method Details

.from_response(body, headers) ⇒ Object



6
7
8
# File 'lib/caplinked/error.rb', line 6

def from_response(body, headers)
  new(body[:error][:code], body[:error][:message], headers)
end