Class: Utility::Error

Inherits:
Object
  • Object
show all
Defined in:
lib/utility/errors.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(status_code, code, message) ⇒ Error

Returns a new instance of Error.



99
100
101
102
103
# File 'lib/utility/errors.rb', line 99

def initialize(status_code, code, message)
  @status_code = status_code
  @code = code
  @message = message
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



97
98
99
# File 'lib/utility/errors.rb', line 97

def code
  @code
end

#messageObject (readonly)

Returns the value of attribute message.



97
98
99
# File 'lib/utility/errors.rb', line 97

def message
  @message
end

#status_codeObject (readonly)

Returns the value of attribute status_code.



97
98
99
# File 'lib/utility/errors.rb', line 97

def status_code
  @status_code
end

Instance Method Details

#to_hObject



105
106
107
108
109
110
# File 'lib/utility/errors.rb', line 105

def to_h
  {
    'code' => @code,
    'message' => @message
  }
end