Class: Lighthouse::Facilities::Client
- Inherits:
-
Common::Client::Base
- Object
- Common::Client::Base
- Lighthouse::Facilities::Client
- Defined in:
- lib/lighthouse/facilities/client.rb
Overview
Documentation located at: developer.va.gov/explore/facilities/docs/facilities
Instance Method Summary collapse
-
#get_by_id(id) ⇒ Lighthouse::Facilities::Facility
Request a single facility.
-
#get_facilities(params) ⇒ Array<Lighthouse::Facilities::Facility>
Request a list of facilities matching the params provided.
-
#nearby(params) ⇒ Array<Lighthouse::Facilities::NearbyFacility>
Request a list of nearby facilities based on calculated drive time bands * Returns only health facilities * Returns only facilities within a 90-minute drive time * Does not respect per_page parameter.
Methods inherited from Common::Client::Base
#config, configuration, #connection, #delete, #get, #perform, #post, #put, #raise_backend_exception, #raise_not_authenticated, #request, #sanitize_headers!, #service_name
Methods included from SentryLogging
#log_exception_to_sentry, #log_message_to_sentry, #non_nil_hash?, #normalize_level, #rails_logger, #set_sentry_metadata
Instance Method Details
#get_by_id(id) ⇒ Lighthouse::Facilities::Facility
Request a single facility
21 22 23 24 |
# File 'lib/lighthouse/facilities/client.rb', line 21 def get_by_id(id) response = perform(:get, "/services/va_facilities/v0/facilities/#{id}", nil) Lighthouse::Facilities::Response.new(response.body, response.status).facility end |
#get_facilities(params) ⇒ Array<Lighthouse::Facilities::Facility>
Request a list of facilities matching the params provided
35 36 37 38 39 40 |
# File 'lib/lighthouse/facilities/client.rb', line 35 def get_facilities(params) response = perform(:get, '/services/va_facilities/v0/facilities', params) facilities = Lighthouse::Facilities::Response.new(response.body, response.status).facilities facilities.reject!(&:mobile?) if params['exclude_mobile'] facilities end |
#nearby(params) ⇒ Array<Lighthouse::Facilities::NearbyFacility>
Request a list of nearby facilities based on calculated drive time bands
-
Returns only health facilities
-
Returns only facilities within a 90-minute drive time
-
Does not respect per_page parameter
53 54 55 56 |
# File 'lib/lighthouse/facilities/client.rb', line 53 def nearby(params) response = perform(:get, '/services/va_facilities/v0/nearby', params) Lighthouse::Facilities::NearbyResponse.new(response.body, response.status).facilities end |