Class: WalmartApIs::SelectedDeliveryWindow
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- WalmartApIs::SelectedDeliveryWindow
- Defined in:
- lib/walmart_ap_is/models/selected_delivery_window.rb
Overview
Selected delivery window attributes.
Instance Attribute Summary collapse
-
#availability_type ⇒ String
The type of delivery window availability.
-
#delivery_window_option_id ⇒ String
Identifier of a delivery window option.
-
#editable_until ⇒ DateTime
The timestamp at which this window can no longer be edited.
-
#end_date ⇒ DateTime
The end timestamp of the window.
-
#start_date ⇒ DateTime
The start timestamp of the window.
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:, editable_until: SKIP, additional_properties: nil) ⇒ SelectedDeliveryWindow
constructor
A new instance of SelectedDeliveryWindow.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_editable_until ⇒ Object
- #to_custom_end_date ⇒ Object
- #to_custom_start_date ⇒ 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:, editable_until: SKIP, additional_properties: nil) ⇒ SelectedDeliveryWindow
Returns a new instance of SelectedDeliveryWindow.
57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/walmart_ap_is/models/selected_delivery_window.rb', line 57 def initialize(availability_type:, delivery_window_option_id:, end_date:, start_date:, editable_until: SKIP, 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 @editable_until = editable_until unless editable_until == SKIP @end_date = end_date @start_date = start_date @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/selected_delivery_window.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/selected_delivery_window.rb', line 20 def delivery_window_option_id @delivery_window_option_id end |
#editable_until ⇒ DateTime
The timestamp at which this window can no longer be edited.
24 25 26 |
# File 'lib/walmart_ap_is/models/selected_delivery_window.rb', line 24 def editable_until @editable_until end |
#end_date ⇒ DateTime
The end timestamp of the window.
28 29 30 |
# File 'lib/walmart_ap_is/models/selected_delivery_window.rb', line 28 def end_date @end_date end |
#start_date ⇒ DateTime
The start timestamp of the window.
32 33 34 |
# File 'lib/walmart_ap_is/models/selected_delivery_window.rb', line 32 def start_date @start_date 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 105 106 |
# File 'lib/walmart_ap_is/models/selected_delivery_window.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 editable_until = if hash.key?('editableUntil') (DateTimeHelper.from_rfc3339(hash['editableUntil']) if hash['editableUntil']) else SKIP 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. SelectedDeliveryWindow.new(availability_type: availability_type, delivery_window_option_id: delivery_window_option_id, end_date: end_date, start_date: start_date, editable_until: editable_until, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
35 36 37 38 39 40 41 42 43 |
# File 'lib/walmart_ap_is/models/selected_delivery_window.rb', line 35 def self.names @_hash = {} if @_hash.nil? @_hash['availability_type'] = 'availabilityType' @_hash['delivery_window_option_id'] = 'deliveryWindowOptionId' @_hash['editable_until'] = 'editableUntil' @_hash['end_date'] = 'endDate' @_hash['start_date'] = 'startDate' @_hash end |
.nullables ⇒ Object
An array for nullable fields
53 54 55 |
# File 'lib/walmart_ap_is/models/selected_delivery_window.rb', line 53 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
46 47 48 49 50 |
# File 'lib/walmart_ap_is/models/selected_delivery_window.rb', line 46 def self.optionals %w[ editable_until ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
129 130 131 132 133 134 135 |
# File 'lib/walmart_ap_is/models/selected_delivery_window.rb', line 129 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}, editable_until:"\ " #{@editable_until.inspect}, end_date: #{@end_date.inspect}, start_date:"\ " #{@start_date.inspect}, additional_properties: #{@additional_properties}>" end |
#to_custom_editable_until ⇒ Object
108 109 110 |
# File 'lib/walmart_ap_is/models/selected_delivery_window.rb', line 108 def to_custom_editable_until DateTimeHelper.to_rfc3339(editable_until) end |
#to_custom_end_date ⇒ Object
112 113 114 |
# File 'lib/walmart_ap_is/models/selected_delivery_window.rb', line 112 def to_custom_end_date DateTimeHelper.to_rfc3339(end_date) end |
#to_custom_start_date ⇒ Object
116 117 118 |
# File 'lib/walmart_ap_is/models/selected_delivery_window.rb', line 116 def to_custom_start_date DateTimeHelper.to_rfc3339(start_date) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
121 122 123 124 125 126 |
# File 'lib/walmart_ap_is/models/selected_delivery_window.rb', line 121 def to_s class_name = self.class.name.split('::').last "<#{class_name} availability_type: #{@availability_type}, delivery_window_option_id:"\ " #{@delivery_window_option_id}, editable_until: #{@editable_until}, end_date: #{@end_date},"\ " start_date: #{@start_date}, additional_properties: #{@additional_properties}>" end |