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

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_hObject



105
106
107
# File 'lib/redox/models/model.rb', line 105

def to_h
  return { key => super.to_h }
end