Class: WalmartApIs::DeliveryWindowOption
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- WalmartApIs::DeliveryWindowOption
- Defined in:
- lib/walmart_ap_is/models/delivery_window_option.rb
Overview
Contains information pertaining to a delivery window option.
Instance Attribute Summary collapse
-
#availability_type ⇒ String
The type of delivery window availability.
-
#delivery_window_option_id ⇒ String
Identifier of a delivery window option.
-
#end_date ⇒ DateTime
The time at which this delivery window option ends.
-
#start_date ⇒ DateTime
The time at which this delivery window option starts.
-
#valid_until ⇒ DateTime
The time at which this delivery window option is no longer valid.
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(availability_type:, delivery_window_option_id:, end_date:, start_date:, valid_until:, additional_properties: nil) ⇒ DeliveryWindowOption
constructor
A new instance of DeliveryWindowOption.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_end_date ⇒ Object
- #to_custom_start_date ⇒ Object
- #to_custom_valid_until ⇒ 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(availability_type:, delivery_window_option_id:, end_date:, start_date:, valid_until:, additional_properties: nil) ⇒ DeliveryWindowOption
Returns a new instance of DeliveryWindowOption.
58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/walmart_ap_is/models/delivery_window_option.rb', line 58 def initialize(availability_type:, delivery_window_option_id:, end_date:, start_date:, valid_until:, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @availability_type = availability_type @delivery_window_option_id = delivery_window_option_id @end_date = end_date @start_date = start_date @valid_until = valid_until @additional_properties = additional_properties end |
Instance Attribute Details
#availability_type ⇒ String
The type of delivery window availability. Values: AVAILABLE, BLOCKED,
CONGESTED, DISCOUNTED.
16 17 18 |
# File 'lib/walmart_ap_is/models/delivery_window_option.rb', line 16 def availability_type @availability_type end |
#delivery_window_option_id ⇒ String
Identifier of a delivery window option.
20 21 22 |
# File 'lib/walmart_ap_is/models/delivery_window_option.rb', line 20 def delivery_window_option_id @delivery_window_option_id end |
#end_date ⇒ DateTime
The time at which this delivery window option ends. In ISO 8601 datetime
format with pattern yyyy-MM-ddTHH:mmZ.
25 26 27 |
# File 'lib/walmart_ap_is/models/delivery_window_option.rb', line 25 def end_date @end_date end |
#start_date ⇒ DateTime
The time at which this delivery window option starts. In ISO 8601 datetime
format with pattern yyyy-MM-ddTHH:mmZ.
30 31 32 |
# File 'lib/walmart_ap_is/models/delivery_window_option.rb', line 30 def start_date @start_date end |
#valid_until ⇒ DateTime
The time at which this delivery window option is no longer valid. In ISO
8601 datetime format with pattern yyyy-MM-ddTHH:mmZ.
35 36 37 |
# File 'lib/walmart_ap_is/models/delivery_window_option.rb', line 35 def valid_until @valid_until end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/walmart_ap_is/models/delivery_window_option.rb', line 72 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. availability_type = hash.key?('availabilityType') ? hash['availabilityType'] : nil delivery_window_option_id = hash.key?('deliveryWindowOptionId') ? hash['deliveryWindowOptionId'] : nil end_date = if hash.key?('endDate') (DateTimeHelper.from_rfc3339(hash['endDate']) if hash['endDate']) end start_date = if hash.key?('startDate') (DateTimeHelper.from_rfc3339(hash['startDate']) if hash['startDate']) end valid_until = if hash.key?('validUntil') (DateTimeHelper.from_rfc3339(hash['validUntil']) if hash['validUntil']) end # 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. DeliveryWindowOption.new(availability_type: availability_type, delivery_window_option_id: delivery_window_option_id, end_date: end_date, start_date: start_date, valid_until: valid_until, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
38 39 40 41 42 43 44 45 46 |
# File 'lib/walmart_ap_is/models/delivery_window_option.rb', line 38 def self.names @_hash = {} if @_hash.nil? @_hash['availability_type'] = 'availabilityType' @_hash['delivery_window_option_id'] = 'deliveryWindowOptionId' @_hash['end_date'] = 'endDate' @_hash['start_date'] = 'startDate' @_hash['valid_until'] = 'validUntil' @_hash end |
.nullables ⇒ Object
An array for nullable fields
54 55 56 |
# File 'lib/walmart_ap_is/models/delivery_window_option.rb', line 54 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
49 50 51 |
# File 'lib/walmart_ap_is/models/delivery_window_option.rb', line 49 def self.optionals [] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
127 128 129 130 131 132 133 |
# File 'lib/walmart_ap_is/models/delivery_window_option.rb', line 127 def inspect class_name = self.class.name.split('::').last "<#{class_name} availability_type: #{@availability_type.inspect},"\ " delivery_window_option_id: #{@delivery_window_option_id.inspect}, end_date:"\ " #{@end_date.inspect}, start_date: #{@start_date.inspect}, valid_until:"\ " #{@valid_until.inspect}, additional_properties: #{@additional_properties}>" end |
#to_custom_end_date ⇒ Object
106 107 108 |
# File 'lib/walmart_ap_is/models/delivery_window_option.rb', line 106 def to_custom_end_date DateTimeHelper.to_rfc3339(end_date) end |
#to_custom_start_date ⇒ Object
110 111 112 |
# File 'lib/walmart_ap_is/models/delivery_window_option.rb', line 110 def to_custom_start_date DateTimeHelper.to_rfc3339(start_date) end |
#to_custom_valid_until ⇒ Object
114 115 116 |
# File 'lib/walmart_ap_is/models/delivery_window_option.rb', line 114 def to_custom_valid_until DateTimeHelper.to_rfc3339(valid_until) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
119 120 121 122 123 124 |
# File 'lib/walmart_ap_is/models/delivery_window_option.rb', line 119 def to_s class_name = self.class.name.split('::').last "<#{class_name} availability_type: #{@availability_type}, delivery_window_option_id:"\ " #{@delivery_window_option_id}, end_date: #{@end_date}, start_date: #{@start_date},"\ " valid_until: #{@valid_until}, additional_properties: #{@additional_properties}>" end |