Class: MistApi::Hours
- Defined in:
- lib/mist_api/models/hours.rb
Overview
Days/Hours of operation filter, the available days (mon, tue, wed, thu, fri, sat, sun)
Instance Attribute Summary collapse
-
#fri ⇒ String
Hour range of the day (e.g. ‘09:00-17:00`).
-
#mon ⇒ String
Hour range of the day (e.g. ‘09:00-17:00`).
-
#sat ⇒ String
Hour range of the day (e.g. ‘09:00-17:00`).
-
#sun ⇒ String
Hour range of the day (e.g. ‘09:00-17:00`).
-
#thu ⇒ String
Hour range of the day (e.g. ‘09:00-17:00`).
-
#tue ⇒ String
Hour range of the day (e.g. ‘09:00-17:00`).
-
#wed ⇒ String
Hour range of the day (e.g. ‘09:00-17:00`).
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
-
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
Instance Method Summary collapse
-
#initialize(fri = SKIP, mon = SKIP, sat = SKIP, sun = SKIP, thu = SKIP, tue = SKIP, wed = SKIP) ⇒ Hours
constructor
A new instance of Hours.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(fri = SKIP, mon = SKIP, sat = SKIP, sun = SKIP, thu = SKIP, tue = SKIP, wed = SKIP) ⇒ Hours
Returns a new instance of Hours.
79 80 81 82 83 84 85 86 87 88 |
# File 'lib/mist_api/models/hours.rb', line 79 def initialize(fri = SKIP, mon = SKIP, sat = SKIP, sun = SKIP, thu = SKIP, tue = SKIP, wed = SKIP) @fri = fri unless fri == SKIP @mon = mon unless mon == SKIP @sat = sat unless sat == SKIP @sun = sun unless sun == SKIP @thu = thu unless thu == SKIP @tue = tue unless tue == SKIP @wed = wed unless wed == SKIP end |
Instance Attribute Details
#fri ⇒ String
Hour range of the day (e.g. ‘09:00-17:00`). If the hour is not defined then it’s treated as 00:00-23:59.
16 17 18 |
# File 'lib/mist_api/models/hours.rb', line 16 def fri @fri end |
#mon ⇒ String
Hour range of the day (e.g. ‘09:00-17:00`). If the hour is not defined then it’s treated as 00:00-23:59.
21 22 23 |
# File 'lib/mist_api/models/hours.rb', line 21 def mon @mon end |
#sat ⇒ String
Hour range of the day (e.g. ‘09:00-17:00`). If the hour is not defined then it’s treated as 00:00-23:59.
26 27 28 |
# File 'lib/mist_api/models/hours.rb', line 26 def sat @sat end |
#sun ⇒ String
Hour range of the day (e.g. ‘09:00-17:00`). If the hour is not defined then it’s treated as 00:00-23:59.
31 32 33 |
# File 'lib/mist_api/models/hours.rb', line 31 def sun @sun end |
#thu ⇒ String
Hour range of the day (e.g. ‘09:00-17:00`). If the hour is not defined then it’s treated as 00:00-23:59.
36 37 38 |
# File 'lib/mist_api/models/hours.rb', line 36 def thu @thu end |
#tue ⇒ String
Hour range of the day (e.g. ‘09:00-17:00`). If the hour is not defined then it’s treated as 00:00-23:59.
41 42 43 |
# File 'lib/mist_api/models/hours.rb', line 41 def tue @tue end |
#wed ⇒ String
Hour range of the day (e.g. ‘09:00-17:00`). If the hour is not defined then it’s treated as 00:00-23:59.
46 47 48 |
# File 'lib/mist_api/models/hours.rb', line 46 def wed @wed end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/mist_api/models/hours.rb', line 91 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. fri = hash.key?('fri') ? hash['fri'] : SKIP mon = hash.key?('mon') ? hash['mon'] : SKIP sat = hash.key?('sat') ? hash['sat'] : SKIP sun = hash.key?('sun') ? hash['sun'] : SKIP thu = hash.key?('thu') ? hash['thu'] : SKIP tue = hash.key?('tue') ? hash['tue'] : SKIP wed = hash.key?('wed') ? hash['wed'] : SKIP # Create object from extracted values. Hours.new(fri, mon, sat, sun, thu, tue, wed) end |
.names ⇒ Object
A mapping from model property names to API property names.
49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/mist_api/models/hours.rb', line 49 def self.names @_hash = {} if @_hash.nil? @_hash['fri'] = 'fri' @_hash['mon'] = 'mon' @_hash['sat'] = 'sat' @_hash['sun'] = 'sun' @_hash['thu'] = 'thu' @_hash['tue'] = 'tue' @_hash['wed'] = 'wed' @_hash end |
.nullables ⇒ Object
An array for nullable fields
75 76 77 |
# File 'lib/mist_api/models/hours.rb', line 75 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/mist_api/models/hours.rb', line 62 def self.optionals %w[ fri mon sat sun thu tue wed ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
115 116 117 118 119 120 121 |
# File 'lib/mist_api/models/hours.rb', line 115 def self.validate(value) return true if value.instance_of? self return false unless value.instance_of? Hash true end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
131 132 133 134 135 |
# File 'lib/mist_api/models/hours.rb', line 131 def inspect class_name = self.class.name.split('::').last "<#{class_name} fri: #{@fri.inspect}, mon: #{@mon.inspect}, sat: #{@sat.inspect}, sun:"\ " #{@sun.inspect}, thu: #{@thu.inspect}, tue: #{@tue.inspect}, wed: #{@wed.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
124 125 126 127 128 |
# File 'lib/mist_api/models/hours.rb', line 124 def to_s class_name = self.class.name.split('::').last "<#{class_name} fri: #{@fri}, mon: #{@mon}, sat: #{@sat}, sun: #{@sun}, thu: #{@thu}, tue:"\ " #{@tue}, wed: #{@wed}>" end |