Exception: SmartHR::Error

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

Direct Known Subclasses

APIConnectionError

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, status = nil, error_response = nil) ⇒ Error

Returns a new instance of Error.



15
16
17
18
19
# File 'lib/smarthr.rb', line 15

def initialize(message, status = nil, error_response = nil)
  @status = status
  @error_response = error_response
  super(message)
end

Instance Attribute Details

#error_responseObject (readonly)

Returns the value of attribute error_response.



13
14
15
# File 'lib/smarthr.rb', line 13

def error_response
  @error_response
end

#statusObject (readonly)

Returns the value of attribute status.



12
13
14
# File 'lib/smarthr.rb', line 12

def status
  @status
end

Class Method Details

.from_response(status, body) ⇒ Object



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

def self.from_response(status, body)
  APIConnectionError.new("Invalid response #{body.to_hash} (status: #{status})")
end