Class: ChangeHealth::Models::Model
- Inherits:
-
Hashie::Trash
- Object
- Hashie::Trash
- ChangeHealth::Models::Model
show all
- Defined in:
- lib/change_health/models/model.rb
Direct Known Subclasses
Claim::Address, Claim::BillingPayToAddressName, Claim::ClaimCodeInformation, Claim::ClaimDateInformation, Claim::ClaimInformation, Claim::ClaimSupplementalInformation, Claim::ContactInformation, Claim::Dependent, Claim::Diagnosis, Claim::DrugIdentification, Claim::InstitutionalService, Claim::LineAdjudicationInformation, Claim::OtherPayerName, Claim::OtherSubscriberInformation, Claim::OtherSubscriberName, Claim::ProfessionalService, Claim::Provider, Claim::Receiver, Claim::ReportInformation, Claim::ServiceFacilityLocation, Claim::ServiceLine, Claim::Submitter, Claim::Subscriber, Eligibility::Encounter, Eligibility::Subscriber
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.hashify(model) ⇒ Object
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
# File 'lib/change_health/models/model.rb', line 59
def self.hashify(model)
model.map do |key, value|
formatted_value = case value
when Hash
hashify(model[key])
when Array
value.map do |element|
if element.is_a?(Hash)
hashify(element)
else format_value(key, element)
end
end
else
format_value(key, value)
end
[key, formatted_value]
end.to_h
end
|
Instance Method Details
#as_json(_args = {}) ⇒ Object
93
94
95
|
# File 'lib/change_health/models/model.rb', line 93
def as_json(_args = {})
to_h
end
|
#to_h ⇒ Object
55
56
57
|
# File 'lib/change_health/models/model.rb', line 55
def to_h
self.class.hashify(self)
end
|
#to_json(*_args) ⇒ Object
97
98
99
|
# File 'lib/change_health/models/model.rb', line 97
def to_json(*_args)
to_h.to_json
end
|