Class: Redox::Models::Model
- Inherits:
-
AbstractModel
- Object
- Hashie::Trash
- AbstractModel
- Redox::Models::Model
- Defined in:
- lib/redox/models/model.rb
Constant Summary
Constants inherited from AbstractModel
AbstractModel::HIGH_LEVEL_KEYS
Instance Method Summary collapse
-
#initialize(data = {}) ⇒ Model
constructor
A new instance of Model.
- #to_h ⇒ Object
Methods inherited from AbstractModel
from_response, from_response_inflected, #insurances, #to_json
Constructor Details
#initialize(data = {}) ⇒ Model
Returns a new instance of Model.
93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/redox/models/model.rb', line 93 def initialize(data = {}) if data.is_a?(Hash) if data.include?(key) data = data[key] elsif data.include?(key.to_sym) data = data[key.to_sym] end end super(data) end |
Instance Method Details
#to_h ⇒ Object
105 106 107 |
# File 'lib/redox/models/model.rb', line 105 def to_h return { key => super.to_h } end |