Class: Lighthouse::Facilities::NearbyResponse

Inherits:
Common::Base
  • Object
show all
Defined in:
lib/lighthouse/facilities/nearby_response.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(body, status) ⇒ NearbyResponse

Returns a new instance of NearbyResponse.



18
19
20
21
22
23
24
25
26
27
# File 'lib/lighthouse/facilities/nearby_response.rb', line 18

def initialize(body, status)
  super()
  self.body = body
  self.status = status
  parsed_body = JSON.parse(body)
  self.data = parsed_body['data']
  self.meta = parsed_body['meta']
  self.links = parsed_body['links']
  # This endpoint is not currently responding with a JSONAPI meta element
end

Instance Method Details

#facilitiesObject



29
30
31
32
33
# File 'lib/lighthouse/facilities/nearby_response.rb', line 29

def facilities
  data.map do |facility|
    Lighthouse::Facilities::NearbyFacility.new(facility)
  end
end