Class: CoronaPresenceTracing::CWACheckInValidator
Constant Summary
collapse
- ALLOWED_LOCATION_TYPES =
%i[
permanent_retail permanent_food_service permanent_craft permanent_workplace
permanent_educational_institution permanent_public_building permanent_other
temporary_cultural_event temporary_club_activity temporary_private_event
temporary_worship_service temporary_other
].freeze
Instance Method Summary
collapse
#initialize
Instance Method Details
#temporary_location? ⇒ Boolean
103
104
105
|
# File 'lib/corona_presence_tracing/validator.rb', line 103
def temporary_location?
@check_in.location_type.to_s.start_with?('temporary')
end
|
#validate ⇒ Object
89
90
91
92
93
94
95
96
|
# File 'lib/corona_presence_tracing/validator.rb', line 89
def validate
validate_type_of :location_type, %w[Symbol String]
validate_inclusion_of :location_type, ALLOWED_LOCATION_TYPES
validate_presence_of :default_check_in_length unless temporary_location?
validate_type_of :default_check_in_length, %w[Integer]
validate_inclusion_of :default_check_in_length, (0..1440)
super
end
|
#validate_dates ⇒ Object
98
99
100
101
|
# File 'lib/corona_presence_tracing/validator.rb', line 98
def validate_dates
validate_presence_of :start_time, :end_time if temporary_location?
super
end
|