Class: WalmartApIs::SelfShipAppointmentSlotsAvailability
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- WalmartApIs::SelfShipAppointmentSlotsAvailability
- Defined in:
- lib/walmart_ap_is/models/self_ship_appointment_slots_availability.rb
Overview
The self ship appointment time slots availability and an expiration date for which the slots can be scheduled.
Instance Attribute Summary collapse
-
#expires_at ⇒ DateTime
The time at which the self ship appointment slot expires.
-
#slots ⇒ Array[AppointmentSlot]
A list of appointment slots.
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(expires_at: SKIP, slots: SKIP, additional_properties: nil) ⇒ SelfShipAppointmentSlotsAvailability
constructor
A new instance of SelfShipAppointmentSlotsAvailability.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_expires_at ⇒ Object
-
#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(expires_at: SKIP, slots: SKIP, additional_properties: nil) ⇒ SelfShipAppointmentSlotsAvailability
Returns a new instance of SelfShipAppointmentSlotsAvailability.
44 45 46 47 48 49 50 51 |
# File 'lib/walmart_ap_is/models/self_ship_appointment_slots_availability.rb', line 44 def initialize(expires_at: SKIP, slots: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @expires_at = expires_at unless expires_at == SKIP @slots = slots unless slots == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#expires_at ⇒ DateTime
The time at which the self ship appointment slot expires. In ISO 8601 datetime format.
17 18 19 |
# File 'lib/walmart_ap_is/models/self_ship_appointment_slots_availability.rb', line 17 def expires_at @expires_at end |
#slots ⇒ Array[AppointmentSlot]
A list of appointment slots.
21 22 23 |
# File 'lib/walmart_ap_is/models/self_ship_appointment_slots_availability.rb', line 21 def slots @slots end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/walmart_ap_is/models/self_ship_appointment_slots_availability.rb', line 54 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. expires_at = if hash.key?('expiresAt') (DateTimeHelper.from_rfc3339(hash['expiresAt']) if hash['expiresAt']) else SKIP end # Parameter is an array, so we need to iterate through it slots = nil unless hash['slots'].nil? slots = [] hash['slots'].each do |structure| slots << (AppointmentSlot.from_hash(structure) if structure) end end slots = SKIP unless hash.key?('slots') # Create a new hash for additional properties, removing known properties. new_hash = hash.reject { |k, _| names.value?(k) } additional_properties = APIHelper.get_additional_properties( new_hash, proc { |value| value } ) # Create object from extracted values. SelfShipAppointmentSlotsAvailability.new(expires_at: expires_at, slots: slots, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
24 25 26 27 28 29 |
# File 'lib/walmart_ap_is/models/self_ship_appointment_slots_availability.rb', line 24 def self.names @_hash = {} if @_hash.nil? @_hash['expires_at'] = 'expiresAt' @_hash['slots'] = 'slots' @_hash end |
.nullables ⇒ Object
An array for nullable fields
40 41 42 |
# File 'lib/walmart_ap_is/models/self_ship_appointment_slots_availability.rb', line 40 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
32 33 34 35 36 37 |
# File 'lib/walmart_ap_is/models/self_ship_appointment_slots_availability.rb', line 32 def self.optionals %w[ expires_at slots ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
99 100 101 102 103 |
# File 'lib/walmart_ap_is/models/self_ship_appointment_slots_availability.rb', line 99 def inspect class_name = self.class.name.split('::').last "<#{class_name} expires_at: #{@expires_at.inspect}, slots: #{@slots.inspect},"\ " additional_properties: #{@additional_properties}>" end |
#to_custom_expires_at ⇒ Object
87 88 89 |
# File 'lib/walmart_ap_is/models/self_ship_appointment_slots_availability.rb', line 87 def to_custom_expires_at DateTimeHelper.to_rfc3339(expires_at) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
92 93 94 95 96 |
# File 'lib/walmart_ap_is/models/self_ship_appointment_slots_availability.rb', line 92 def to_s class_name = self.class.name.split('::').last "<#{class_name} expires_at: #{@expires_at}, slots: #{@slots}, additional_properties:"\ " #{@additional_properties}>" end |