class Turbovax::Location
Representation of an individual vaccination site
Attributes
@return [String]
@return [Hash] Use this nested hash to specify appointments, appointment_count
, available, vaccine_types
@return [String]
@return [String] Turbovax-specific unique ID for identification purposes
@return [String]
@return [String]
@return [Hash] Use this attribute to add any metadata
@return [String] Human readable name
@return [Turbovax::Portal]
@return [String] Portal
specific ID
@return [String] Valid values in api.rubyonrails.org/classes/ActiveSupport/TimeZone.html
@return [String]
Public Class Methods
# File lib/turbovax/location.rb, line 37 def initialize(**params) params.each do |attribute, value| send("#{attribute}=", value) end end
Public Instance Methods
# File lib/turbovax/location.rb, line 67 def appointment_count data_hash[:appointment_count] || appointments.size end
Returns a list of appointment instances (which are defined via) data hash
# File lib/turbovax/location.rb, line 56 def appointments Array(data_hash[:appointments]).map do |appointment| if appointment.is_a?(Turbovax::Appointment) appointment.time_zone = time_zone appointment else Turbovax::Appointment.new(appointment.merge(time_zone: time_zone)) end end end
@return [Boolean] This can be manually specified via data hash or automatically calculated if appointment_count
> 0
# File lib/turbovax/location.rb, line 46 def available data_hash[:available] || appointment_count.positive? end
This can be manually specified via data hash or automatically calculated
# File lib/turbovax/location.rb, line 51 def vaccine_types data_hash[:vaccine_types] || appointments.map(&:vaccine_type).uniq end
Private Instance Methods
# File lib/turbovax/location.rb, line 73 def data_hash data || {} end