class Turbovax::Appointment

Class that encapsulates a singular appointment

Attributes

is_second_dose[RW]

@return [Boolean]

time[RW]

@return [DateTime]

time_zone[RW]

@return [String] Can automatically be set by Turbovax::Location instance

vaccine_type[RW]

@return [String]

Public Class Methods

new(**params) click to toggle source

@param params hash mapping of attribute => value

# File lib/turbovax/appointment.rb, line 19
def initialize(**params)
  params.each do |attribute, value|
    value_to_save =
      if attribute.to_s == "time"
        if value.is_a?(DateTime) || value.is_a?(Time)
          value
        else
          DateTime.parse(value)
        end
      else
        value
      end

    send("#{attribute}=", value_to_save)
  end
end

Public Instance Methods

time_in_time_zone() click to toggle source

If time_zone is set on instance, returns appointment time in time zone @return [DateTime]

# File lib/turbovax/appointment.rb, line 38
def time_in_time_zone
  time_zone ? time.in_time_zone(time_zone) : time
end

Private Instance Methods

<=>(other) click to toggle source
# File lib/turbovax/appointment.rb, line 44
def <=>(other)
  time <=> other.time
end