Class: WalmartApIs::PurchaseShipmentRequest
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- WalmartApIs::PurchaseShipmentRequest
- Defined in:
- lib/walmart_ap_is/models/purchase_shipment_request.rb
Overview
PurchaseShipmentRequest Model.
Instance Attribute Summary collapse
-
#additional_inputs ⇒ Object
Carrier/service-specific inputs validated against the schema returned by getAdditionalInputs.
-
#rate_id ⇒ String
The chosen rateId from the getRates response.
-
#request_token ⇒ String
requestToken returned by the prior getRates response.
-
#requested_document_specification ⇒ RequestedDocumentSpecification
The chosen rateId from the getRates response.
-
#requested_value_added_services ⇒ Array[RequestedValueAddedService]
The chosen rateId from the getRates response.
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(request_token:, rate_id:, requested_document_specification:, requested_value_added_services: SKIP, additional_inputs: SKIP, additional_properties: nil) ⇒ PurchaseShipmentRequest
constructor
A new instance of PurchaseShipmentRequest.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#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(request_token:, rate_id:, requested_document_specification:, requested_value_added_services: SKIP, additional_inputs: SKIP, additional_properties: nil) ⇒ PurchaseShipmentRequest
Returns a new instance of PurchaseShipmentRequest.
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/walmart_ap_is/models/purchase_shipment_request.rb', line 58 def initialize(request_token:, rate_id:, requested_document_specification:, requested_value_added_services: SKIP, additional_inputs: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @request_token = request_token @rate_id = rate_id @requested_document_specification = requested_document_specification unless requested_value_added_services == SKIP @requested_value_added_services = requested_value_added_services end @additional_inputs = additional_inputs unless additional_inputs == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#additional_inputs ⇒ Object
Carrier/service-specific inputs validated against the schema returned by getAdditionalInputs.
31 32 33 |
# File 'lib/walmart_ap_is/models/purchase_shipment_request.rb', line 31 def additional_inputs @additional_inputs end |
#rate_id ⇒ String
The chosen rateId from the getRates response.
18 19 20 |
# File 'lib/walmart_ap_is/models/purchase_shipment_request.rb', line 18 def rate_id @rate_id end |
#request_token ⇒ String
requestToken returned by the prior getRates response.
14 15 16 |
# File 'lib/walmart_ap_is/models/purchase_shipment_request.rb', line 14 def request_token @request_token end |
#requested_document_specification ⇒ RequestedDocumentSpecification
The chosen rateId from the getRates response.
22 23 24 |
# File 'lib/walmart_ap_is/models/purchase_shipment_request.rb', line 22 def requested_document_specification @requested_document_specification end |
#requested_value_added_services ⇒ Array[RequestedValueAddedService]
The chosen rateId from the getRates response.
26 27 28 |
# File 'lib/walmart_ap_is/models/purchase_shipment_request.rb', line 26 def requested_value_added_services @requested_value_added_services end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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 107 108 109 110 111 112 |
# File 'lib/walmart_ap_is/models/purchase_shipment_request.rb', line 76 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. request_token = hash.key?('requestToken') ? hash['requestToken'] : nil rate_id = hash.key?('rateId') ? hash['rateId'] : nil if hash['requestedDocumentSpecification'] requested_document_specification = RequestedDocumentSpecification.from_hash(hash['requestedDocumentSpecification']) end # Parameter is an array, so we need to iterate through it requested_value_added_services = nil unless hash['requestedValueAddedServices'].nil? requested_value_added_services = [] hash['requestedValueAddedServices'].each do |structure| requested_value_added_services << (RequestedValueAddedService.from_hash(structure) if structure) end end requested_value_added_services = SKIP unless hash.key?('requestedValueAddedServices') additional_inputs = hash.key?('additionalInputs') ? hash['additionalInputs'] : SKIP # 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. PurchaseShipmentRequest.new(request_token: request_token, rate_id: rate_id, requested_document_specification: requested_document_specification, requested_value_added_services: requested_value_added_services, additional_inputs: additional_inputs, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
34 35 36 37 38 39 40 41 42 43 |
# File 'lib/walmart_ap_is/models/purchase_shipment_request.rb', line 34 def self.names @_hash = {} if @_hash.nil? @_hash['request_token'] = 'requestToken' @_hash['rate_id'] = 'rateId' @_hash['requested_document_specification'] = 'requestedDocumentSpecification' @_hash['requested_value_added_services'] = 'requestedValueAddedServices' @_hash['additional_inputs'] = 'additionalInputs' @_hash end |
.nullables ⇒ Object
An array for nullable fields
54 55 56 |
# File 'lib/walmart_ap_is/models/purchase_shipment_request.rb', line 54 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
46 47 48 49 50 51 |
# File 'lib/walmart_ap_is/models/purchase_shipment_request.rb', line 46 def self.optionals %w[ requested_value_added_services additional_inputs ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
124 125 126 127 128 129 130 131 |
# File 'lib/walmart_ap_is/models/purchase_shipment_request.rb', line 124 def inspect class_name = self.class.name.split('::').last "<#{class_name} request_token: #{@request_token.inspect}, rate_id: #{@rate_id.inspect},"\ " requested_document_specification: #{@requested_document_specification.inspect},"\ " requested_value_added_services: #{@requested_value_added_services.inspect},"\ " additional_inputs: #{@additional_inputs.inspect}, additional_properties:"\ " #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
115 116 117 118 119 120 121 |
# File 'lib/walmart_ap_is/models/purchase_shipment_request.rb', line 115 def to_s class_name = self.class.name.split('::').last "<#{class_name} request_token: #{@request_token}, rate_id: #{@rate_id},"\ " requested_document_specification: #{@requested_document_specification},"\ " requested_value_added_services: #{@requested_value_added_services}, additional_inputs:"\ " #{@additional_inputs}, additional_properties: #{@additional_properties}>" end |