Class: WalmartApIs::ContentUpdatePreview
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- WalmartApIs::ContentUpdatePreview
- Defined in:
- lib/walmart_ap_is/models/content_update_preview.rb
Overview
Preview of the changes that will be applied to the shipment.
Instance Attribute Summary collapse
-
#content_update_preview_id ⇒ String
Identifier of a content update preview.
-
#expiration ⇒ DateTime
The time at which the content update expires.
-
#requested_updates ⇒ RequestedUpdates
Objects that were included in the update request.
-
#transportation_option ⇒ TransportationOption
Contains information pertaining to a transportation option and the related carrier.
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(content_update_preview_id:, expiration:, requested_updates:, transportation_option:, additional_properties: nil) ⇒ ContentUpdatePreview
constructor
A new instance of ContentUpdatePreview.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_expiration ⇒ 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(content_update_preview_id:, expiration:, requested_updates:, transportation_option:, additional_properties: nil) ⇒ ContentUpdatePreview
Returns a new instance of ContentUpdatePreview.
51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/walmart_ap_is/models/content_update_preview.rb', line 51 def initialize(content_update_preview_id:, expiration:, requested_updates:, transportation_option:, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @content_update_preview_id = content_update_preview_id @expiration = expiration @requested_updates = requested_updates @transportation_option = transportation_option @additional_properties = additional_properties end |
Instance Attribute Details
#content_update_preview_id ⇒ String
Identifier of a content update preview.
15 16 17 |
# File 'lib/walmart_ap_is/models/content_update_preview.rb', line 15 def content_update_preview_id @content_update_preview_id end |
#expiration ⇒ DateTime
The time at which the content update expires. In ISO 8601 datetime format
with pattern yyyy-MM-ddTHH:mm:ss.sssZ.
20 21 22 |
# File 'lib/walmart_ap_is/models/content_update_preview.rb', line 20 def expiration @expiration end |
#requested_updates ⇒ RequestedUpdates
Objects that were included in the update request.
24 25 26 |
# File 'lib/walmart_ap_is/models/content_update_preview.rb', line 24 def requested_updates @requested_updates end |
#transportation_option ⇒ TransportationOption
Contains information pertaining to a transportation option and the related carrier.
29 30 31 |
# File 'lib/walmart_ap_is/models/content_update_preview.rb', line 29 def transportation_option @transportation_option end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/walmart_ap_is/models/content_update_preview.rb', line 64 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. content_update_preview_id = hash.key?('contentUpdatePreviewId') ? hash['contentUpdatePreviewId'] : nil expiration = if hash.key?('expiration') (DateTimeHelper.from_rfc3339(hash['expiration']) if hash['expiration']) end requested_updates = RequestedUpdates.from_hash(hash['requestedUpdates']) if hash['requestedUpdates'] transportation_option = TransportationOption.from_hash(hash['transportationOption']) if hash['transportationOption'] # 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. ContentUpdatePreview.new(content_update_preview_id: content_update_preview_id, expiration: expiration, requested_updates: requested_updates, transportation_option: transportation_option, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
32 33 34 35 36 37 38 39 |
# File 'lib/walmart_ap_is/models/content_update_preview.rb', line 32 def self.names @_hash = {} if @_hash.nil? @_hash['content_update_preview_id'] = 'contentUpdatePreviewId' @_hash['expiration'] = 'expiration' @_hash['requested_updates'] = 'requestedUpdates' @_hash['transportation_option'] = 'transportationOption' @_hash end |
.nullables ⇒ Object
An array for nullable fields
47 48 49 |
# File 'lib/walmart_ap_is/models/content_update_preview.rb', line 47 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
42 43 44 |
# File 'lib/walmart_ap_is/models/content_update_preview.rb', line 42 def self.optionals [] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
106 107 108 109 110 111 112 |
# File 'lib/walmart_ap_is/models/content_update_preview.rb', line 106 def inspect class_name = self.class.name.split('::').last "<#{class_name} content_update_preview_id: #{@content_update_preview_id.inspect},"\ " expiration: #{@expiration.inspect}, requested_updates: #{@requested_updates.inspect},"\ " transportation_option: #{@transportation_option.inspect}, additional_properties:"\ " #{@additional_properties}>" end |
#to_custom_expiration ⇒ Object
93 94 95 |
# File 'lib/walmart_ap_is/models/content_update_preview.rb', line 93 def to_custom_expiration DateTimeHelper.to_rfc3339(expiration) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
98 99 100 101 102 103 |
# File 'lib/walmart_ap_is/models/content_update_preview.rb', line 98 def to_s class_name = self.class.name.split('::').last "<#{class_name} content_update_preview_id: #{@content_update_preview_id}, expiration:"\ " #{@expiration}, requested_updates: #{@requested_updates}, transportation_option:"\ " #{@transportation_option}, additional_properties: #{@additional_properties}>" end |