Class: Lighthouse::Facilities::Facility

Inherits:
Common::Base show all
Includes:
ActiveModel::Serializers::JSON
Defined in:
lib/lighthouse/facilities/facility.rb

Instance Attribute Summary

Attributes inherited from Common::Base

#errors_hash, #metadata

Instance Method Summary collapse

Methods inherited from Common::Base

#changed, #changed?, #changes, default_sort, filterable_attributes, max_per_page, per_page, sortable_attributes

Constructor Details

#initialize(fac) ⇒ Facility

Returns a new instance of Facility.



35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/lighthouse/facilities/facility.rb', line 35

def initialize(fac)
  super(fac)
  fac['attributes'].each_key do |key|
    self[key] = fac['attributes'][key] if attributes.include?(key.to_sym)
  end

  self.id = fac['id']
  self.type = fac['type']
  self.feedback = fac['attributes']['satisfaction']
  self.access = fac['attributes']['wait_times']
  self.facility_type_prefix, self.unique_id = fac['id'].split('_')
end