Class: UspsApi::FacilityClosureTimes
- Defined in:
- lib/usps_api/models/facility_closure_times.rb
Overview
The time that the facility closes for each day, including holidays.
Instance Attribute Summary collapse
-
#friday ⇒ String
Time the location closes on Friday in HHmm.
-
#holidays ⇒ String
Time the location closes on Holidays in HHmm.
-
#monday ⇒ String
Time the location closes on Monday in HHmm.
-
#saturday ⇒ String
Time the location closes on Saturday in HHmm.
-
#sunday ⇒ String
Time the location closes on Sunday in HHmm.
-
#thursday ⇒ String
Time the location closes on Thursday in HHmm.
-
#tuesday ⇒ String
Time the location closes on Tuesday in HHmm.
-
#wednesday ⇒ String
Time the location closes on Wednesday in HHmm.
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.
Instance Method Summary collapse
-
#initialize(monday: SKIP, tuesday: SKIP, wednesday: SKIP, thursday: SKIP, friday: SKIP, saturday: SKIP, sunday: SKIP, holidays: SKIP) ⇒ FacilityClosureTimes
constructor
A new instance of FacilityClosureTimes.
-
#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(monday: SKIP, tuesday: SKIP, wednesday: SKIP, thursday: SKIP, friday: SKIP, saturday: SKIP, sunday: SKIP, holidays: SKIP) ⇒ FacilityClosureTimes
Returns a new instance of FacilityClosureTimes.
77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/usps_api/models/facility_closure_times.rb', line 77 def initialize(monday: SKIP, tuesday: SKIP, wednesday: SKIP, thursday: SKIP, friday: SKIP, saturday: SKIP, sunday: SKIP, holidays: SKIP) @monday = monday unless monday == SKIP @tuesday = tuesday unless tuesday == SKIP @wednesday = wednesday unless wednesday == SKIP @thursday = thursday unless thursday == SKIP @friday = friday unless friday == SKIP @saturday = saturday unless saturday == SKIP @sunday = sunday unless sunday == SKIP @holidays = holidays unless holidays == SKIP end |
Instance Attribute Details
#friday ⇒ String
Time the location closes on Friday in HHmm.
30 31 32 |
# File 'lib/usps_api/models/facility_closure_times.rb', line 30 def friday @friday end |
#holidays ⇒ String
Time the location closes on Holidays in HHmm.
42 43 44 |
# File 'lib/usps_api/models/facility_closure_times.rb', line 42 def holidays @holidays end |
#monday ⇒ String
Time the location closes on Monday in HHmm.
14 15 16 |
# File 'lib/usps_api/models/facility_closure_times.rb', line 14 def monday @monday end |
#saturday ⇒ String
Time the location closes on Saturday in HHmm.
34 35 36 |
# File 'lib/usps_api/models/facility_closure_times.rb', line 34 def saturday @saturday end |
#sunday ⇒ String
Time the location closes on Sunday in HHmm.
38 39 40 |
# File 'lib/usps_api/models/facility_closure_times.rb', line 38 def sunday @sunday end |
#thursday ⇒ String
Time the location closes on Thursday in HHmm.
26 27 28 |
# File 'lib/usps_api/models/facility_closure_times.rb', line 26 def thursday @thursday end |
#tuesday ⇒ String
Time the location closes on Tuesday in HHmm.
18 19 20 |
# File 'lib/usps_api/models/facility_closure_times.rb', line 18 def tuesday @tuesday end |
#wednesday ⇒ String
Time the location closes on Wednesday in HHmm.
22 23 24 |
# File 'lib/usps_api/models/facility_closure_times.rb', line 22 def wednesday @wednesday end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/usps_api/models/facility_closure_times.rb', line 90 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. monday = hash.key?('Monday') ? hash['Monday'] : SKIP tuesday = hash.key?('Tuesday') ? hash['Tuesday'] : SKIP wednesday = hash.key?('Wednesday') ? hash['Wednesday'] : SKIP thursday = hash.key?('Thursday') ? hash['Thursday'] : SKIP friday = hash.key?('Friday') ? hash['Friday'] : SKIP saturday = hash.key?('Saturday') ? hash['Saturday'] : SKIP sunday = hash.key?('Sunday') ? hash['Sunday'] : SKIP holidays = hash.key?('holidays') ? hash['holidays'] : SKIP # Create object from extracted values. FacilityClosureTimes.new(monday: monday, tuesday: tuesday, wednesday: wednesday, thursday: thursday, friday: friday, saturday: saturday, sunday: sunday, holidays: holidays) end |
.names ⇒ Object
A mapping from model property names to API property names.
45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/usps_api/models/facility_closure_times.rb', line 45 def self.names @_hash = {} if @_hash.nil? @_hash['monday'] = 'Monday' @_hash['tuesday'] = 'Tuesday' @_hash['wednesday'] = 'Wednesday' @_hash['thursday'] = 'Thursday' @_hash['friday'] = 'Friday' @_hash['saturday'] = 'Saturday' @_hash['sunday'] = 'Sunday' @_hash['holidays'] = 'holidays' @_hash end |
.nullables ⇒ Object
An array for nullable fields
73 74 75 |
# File 'lib/usps_api/models/facility_closure_times.rb', line 73 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/usps_api/models/facility_closure_times.rb', line 59 def self.optionals %w[ monday tuesday wednesday thursday friday saturday sunday holidays ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
123 124 125 126 127 128 129 |
# File 'lib/usps_api/models/facility_closure_times.rb', line 123 def inspect class_name = self.class.name.split('::').last "<#{class_name} monday: #{@monday.inspect}, tuesday: #{@tuesday.inspect}, wednesday:"\ " #{@wednesday.inspect}, thursday: #{@thursday.inspect}, friday: #{@friday.inspect},"\ " saturday: #{@saturday.inspect}, sunday: #{@sunday.inspect}, holidays:"\ " #{@holidays.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
115 116 117 118 119 120 |
# File 'lib/usps_api/models/facility_closure_times.rb', line 115 def to_s class_name = self.class.name.split('::').last "<#{class_name} monday: #{@monday}, tuesday: #{@tuesday}, wednesday: #{@wednesday},"\ " thursday: #{@thursday}, friday: #{@friday}, saturday: #{@saturday}, sunday: #{@sunday},"\ " holidays: #{@holidays}>" end |