Class: Redox::Models::Model

Inherits:
AbstractModel show all
Defined in:
lib/redox/models/model.rb

Direct Known Subclasses

Insurance, Meta, Patient, Provider, Visit

Constant Summary

Constants inherited from AbstractModel

AbstractModel::HIGH_LEVEL_KEYS

Instance Method Summary collapse

Methods inherited from AbstractModel

add_helpers, from_response, from_response_inflected, get_inflected_class, #insurances, #to_json

Constructor Details

#initialize(data = {}) ⇒ Model

Returns a new instance of Model.



101
102
103
104
105
106
107
108
109
110
111
# File 'lib/redox/models/model.rb', line 101

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
end

Instance Method Details

#to_hObject



113
114
115
# File 'lib/redox/models/model.rb', line 113

def to_h
  { key => super.to_h }
end