Class: WalmartApIs::Payload31
- Defined in:
- lib/walmart_ap_is/models/payload31.rb
Overview
Payload31 Model.
Instance Attribute Summary collapse
-
#alternate_leg_tracking_id ⇒ String
TODO: Write general description for this method.
-
#event_history ⇒ Array[Event]
TODO: Write general description for this method.
-
#promised_delivery_date ⇒ DateTime
TODO: Write general description for this method.
-
#proof_of_delivery ⇒ ProofOfDelivery
TODO: Write general description for this method.
-
#summary ⇒ TrackingSummary
TODO: Write general description for this method.
-
#tracking_id ⇒ String
TODO: Write general description for this method.
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(tracking_id: SKIP, alternate_leg_tracking_id: SKIP, event_history: SKIP, promised_delivery_date: SKIP, summary: SKIP, proof_of_delivery: SKIP, additional_properties: nil) ⇒ Payload31
constructor
A new instance of Payload31.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_promised_delivery_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(tracking_id: SKIP, alternate_leg_tracking_id: SKIP, event_history: SKIP, promised_delivery_date: SKIP, summary: SKIP, proof_of_delivery: SKIP, additional_properties: nil) ⇒ Payload31
Returns a new instance of Payload31.
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/walmart_ap_is/models/payload31.rb', line 66 def initialize(tracking_id: SKIP, alternate_leg_tracking_id: SKIP, event_history: SKIP, promised_delivery_date: SKIP, summary: SKIP, proof_of_delivery: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @tracking_id = tracking_id unless tracking_id == SKIP unless alternate_leg_tracking_id == SKIP @alternate_leg_tracking_id = alternate_leg_tracking_id end @event_history = event_history unless event_history == SKIP @promised_delivery_date = promised_delivery_date unless promised_delivery_date == SKIP @summary = summary unless summary == SKIP @proof_of_delivery = proof_of_delivery unless proof_of_delivery == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#alternate_leg_tracking_id ⇒ String
TODO: Write general description for this method
19 20 21 |
# File 'lib/walmart_ap_is/models/payload31.rb', line 19 def alternate_leg_tracking_id @alternate_leg_tracking_id end |
#event_history ⇒ Array[Event]
TODO: Write general description for this method
23 24 25 |
# File 'lib/walmart_ap_is/models/payload31.rb', line 23 def event_history @event_history end |
#promised_delivery_date ⇒ DateTime
TODO: Write general description for this method
27 28 29 |
# File 'lib/walmart_ap_is/models/payload31.rb', line 27 def promised_delivery_date @promised_delivery_date end |
#proof_of_delivery ⇒ ProofOfDelivery
TODO: Write general description for this method
35 36 37 |
# File 'lib/walmart_ap_is/models/payload31.rb', line 35 def proof_of_delivery @proof_of_delivery end |
#summary ⇒ TrackingSummary
TODO: Write general description for this method
31 32 33 |
# File 'lib/walmart_ap_is/models/payload31.rb', line 31 def summary @summary end |
#tracking_id ⇒ String
TODO: Write general description for this method
15 16 17 |
# File 'lib/walmart_ap_is/models/payload31.rb', line 15 def tracking_id @tracking_id end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/walmart_ap_is/models/payload31.rb', line 86 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. tracking_id = hash.key?('trackingId') ? hash['trackingId'] : SKIP alternate_leg_tracking_id = hash.key?('alternateLegTrackingId') ? hash['alternateLegTrackingId'] : SKIP # Parameter is an array, so we need to iterate through it event_history = nil unless hash['eventHistory'].nil? event_history = [] hash['eventHistory'].each do |structure| event_history << (Event.from_hash(structure) if structure) end end event_history = SKIP unless hash.key?('eventHistory') promised_delivery_date = if hash.key?('promisedDeliveryDate') (DateTimeHelper.from_rfc3339(hash['promisedDeliveryDate']) if hash['promisedDeliveryDate']) else SKIP end summary = TrackingSummary.from_hash(hash['summary']) if hash['summary'] proof_of_delivery = ProofOfDelivery.from_hash(hash['proofOfDelivery']) if hash['proofOfDelivery'] # 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. Payload31.new(tracking_id: tracking_id, alternate_leg_tracking_id: alternate_leg_tracking_id, event_history: event_history, promised_delivery_date: promised_delivery_date, summary: summary, proof_of_delivery: proof_of_delivery, 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 47 |
# File 'lib/walmart_ap_is/models/payload31.rb', line 38 def self.names @_hash = {} if @_hash.nil? @_hash['tracking_id'] = 'trackingId' @_hash['alternate_leg_tracking_id'] = 'alternateLegTrackingId' @_hash['event_history'] = 'eventHistory' @_hash['promised_delivery_date'] = 'promisedDeliveryDate' @_hash['summary'] = 'summary' @_hash['proof_of_delivery'] = 'proofOfDelivery' @_hash end |
.nullables ⇒ Object
An array for nullable fields
62 63 64 |
# File 'lib/walmart_ap_is/models/payload31.rb', line 62 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
50 51 52 53 54 55 56 57 58 59 |
# File 'lib/walmart_ap_is/models/payload31.rb', line 50 def self.optionals %w[ tracking_id alternate_leg_tracking_id event_history promised_delivery_date summary proof_of_delivery ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
143 144 145 146 147 148 149 150 |
# File 'lib/walmart_ap_is/models/payload31.rb', line 143 def inspect class_name = self.class.name.split('::').last "<#{class_name} tracking_id: #{@tracking_id.inspect}, alternate_leg_tracking_id:"\ " #{@alternate_leg_tracking_id.inspect}, event_history: #{@event_history.inspect},"\ " promised_delivery_date: #{@promised_delivery_date.inspect}, summary: #{@summary.inspect},"\ " proof_of_delivery: #{@proof_of_delivery.inspect}, additional_properties:"\ " #{@additional_properties}>" end |
#to_custom_promised_delivery_date ⇒ Object
129 130 131 |
# File 'lib/walmart_ap_is/models/payload31.rb', line 129 def to_custom_promised_delivery_date DateTimeHelper.to_rfc3339(promised_delivery_date) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
134 135 136 137 138 139 140 |
# File 'lib/walmart_ap_is/models/payload31.rb', line 134 def to_s class_name = self.class.name.split('::').last "<#{class_name} tracking_id: #{@tracking_id}, alternate_leg_tracking_id:"\ " #{@alternate_leg_tracking_id}, event_history: #{@event_history}, promised_delivery_date:"\ " #{@promised_delivery_date}, summary: #{@summary}, proof_of_delivery:"\ " #{@proof_of_delivery}, additional_properties: #{@additional_properties}>" end |