Class: Zippendo::CreateShipmentRequest
- Inherits:
-
ApiModelBase
- Object
- ApiModelBase
- Zippendo::CreateShipmentRequest
- Defined in:
- lib/zippendo/models/create_shipment_request.rb
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#address_id ⇒ Object
Sender address identifier.
-
#carrier_settings ⇒ Object
Returns the value of attribute carrier_settings.
-
#document_printer_id ⇒ Object
Printer to assign for documents.
-
#label_printer_id ⇒ Object
Printer to assign for labels.
-
#order_id ⇒ Object
Order to derive parties and parcels from.
-
#parcels ⇒ Object
Parcels to include.
-
#parties ⇒ Object
Parties involved in the shipment.
-
#pickup_details ⇒ Object
Returns the value of attribute pickup_details.
-
#reference ⇒ Object
Customer-facing shipment reference.
-
#service_point_id ⇒ Object
Selected carrier service point identifier.
-
#status ⇒ Object
Lifecycle status of the shipment.
-
#term_of_trade ⇒ Object
Incoterm governing the shipment.
-
#type ⇒ Object
Direction of the shipment relative to the organization.
Class Method Summary collapse
-
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about.
-
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about.
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.build_from_hash(attributes) ⇒ Object
Builds the object from hash.
-
.openapi_nullable ⇒ Object
List of attributes with nullable: true.
-
.openapi_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ CreateShipmentRequest
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Methods inherited from ApiModelBase
_deserialize, #_to_hash, #to_body, #to_s
Constructor Details
#initialize(attributes = {}) ⇒ CreateShipmentRequest
Initializes the object
139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 |
# File 'lib/zippendo/models/create_shipment_request.rb', line 139 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `Zippendo::CreateShipmentRequest` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| if (!acceptable_attribute_map.key?(k.to_sym)) fail ArgumentError, "`#{k}` is not a valid attribute in `Zippendo::CreateShipmentRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } if attributes.key?(:'reference') self.reference = attributes[:'reference'] end if attributes.key?(:'address_id') self.address_id = attributes[:'address_id'] end if attributes.key?(:'service_point_id') self.service_point_id = attributes[:'service_point_id'] end if attributes.key?(:'parties') if (value = attributes[:'parties']).is_a?(Array) self.parties = value end end if attributes.key?(:'type') self.type = attributes[:'type'] else self.type = nil end if attributes.key?(:'carrier_settings') self.carrier_settings = attributes[:'carrier_settings'] else self.carrier_settings = nil end if attributes.key?(:'parcels') if (value = attributes[:'parcels']).is_a?(Array) self.parcels = value end end if attributes.key?(:'pickup_details') self.pickup_details = attributes[:'pickup_details'] end if attributes.key?(:'term_of_trade') self.term_of_trade = attributes[:'term_of_trade'] else self.term_of_trade = 'DAP' end if attributes.key?(:'status') self.status = attributes[:'status'] else self.status = 'pending' end if attributes.key?(:'order_id') self.order_id = attributes[:'order_id'] end if attributes.key?(:'label_printer_id') self.label_printer_id = attributes[:'label_printer_id'] end if attributes.key?(:'document_printer_id') self.document_printer_id = attributes[:'document_printer_id'] end end |
Instance Attribute Details
#address_id ⇒ Object
Sender address identifier.
22 23 24 |
# File 'lib/zippendo/models/create_shipment_request.rb', line 22 def address_id @address_id end |
#carrier_settings ⇒ Object
Returns the value of attribute carrier_settings.
33 34 35 |
# File 'lib/zippendo/models/create_shipment_request.rb', line 33 def carrier_settings @carrier_settings end |
#document_printer_id ⇒ Object
Printer to assign for documents.
53 54 55 |
# File 'lib/zippendo/models/create_shipment_request.rb', line 53 def document_printer_id @document_printer_id end |
#label_printer_id ⇒ Object
Printer to assign for labels.
50 51 52 |
# File 'lib/zippendo/models/create_shipment_request.rb', line 50 def label_printer_id @label_printer_id end |
#order_id ⇒ Object
Order to derive parties and parcels from.
47 48 49 |
# File 'lib/zippendo/models/create_shipment_request.rb', line 47 def order_id @order_id end |
#parcels ⇒ Object
Parcels to include. Optional when orderId is provided.
36 37 38 |
# File 'lib/zippendo/models/create_shipment_request.rb', line 36 def parcels @parcels end |
#parties ⇒ Object
Parties involved in the shipment. Optional when orderId is provided.
28 29 30 |
# File 'lib/zippendo/models/create_shipment_request.rb', line 28 def parties @parties end |
#pickup_details ⇒ Object
Returns the value of attribute pickup_details.
38 39 40 |
# File 'lib/zippendo/models/create_shipment_request.rb', line 38 def pickup_details @pickup_details end |
#reference ⇒ Object
Customer-facing shipment reference.
19 20 21 |
# File 'lib/zippendo/models/create_shipment_request.rb', line 19 def reference @reference end |
#service_point_id ⇒ Object
Selected carrier service point identifier.
25 26 27 |
# File 'lib/zippendo/models/create_shipment_request.rb', line 25 def service_point_id @service_point_id end |
#status ⇒ Object
Lifecycle status of the shipment.
44 45 46 |
# File 'lib/zippendo/models/create_shipment_request.rb', line 44 def status @status end |
#term_of_trade ⇒ Object
Incoterm governing the shipment.
41 42 43 |
# File 'lib/zippendo/models/create_shipment_request.rb', line 41 def term_of_trade @term_of_trade end |
#type ⇒ Object
Direction of the shipment relative to the organization.
31 32 33 |
# File 'lib/zippendo/models/create_shipment_request.rb', line 31 def type @type end |
Class Method Details
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about
97 98 99 |
# File 'lib/zippendo/models/create_shipment_request.rb', line 97 def self.acceptable_attribute_map attribute_map end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
102 103 104 |
# File 'lib/zippendo/models/create_shipment_request.rb', line 102 def self.acceptable_attributes acceptable_attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/zippendo/models/create_shipment_request.rb', line 78 def self.attribute_map { :'reference' => :'reference', :'address_id' => :'addressId', :'service_point_id' => :'servicePointId', :'parties' => :'parties', :'type' => :'type', :'carrier_settings' => :'carrierSettings', :'parcels' => :'parcels', :'pickup_details' => :'pickupDetails', :'term_of_trade' => :'termOfTrade', :'status' => :'status', :'order_id' => :'orderId', :'label_printer_id' => :'labelPrinterId', :'document_printer_id' => :'documentPrinterId' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 |
# File 'lib/zippendo/models/create_shipment_request.rb', line 369 def self.build_from_hash(attributes) return nil unless attributes.is_a?(Hash) attributes = attributes.transform_keys(&:to_sym) transformed_hash = {} openapi_types.each_pair do |key, type| if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? transformed_hash["#{key}"] = nil elsif type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the attribute # is documented as an array but the input is not if attributes[attribute_map[key]].is_a?(Array) transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } end elsif !attributes[attribute_map[key]].nil? transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) end end new(transformed_hash) end |
.openapi_nullable ⇒ Object
List of attributes with nullable: true
126 127 128 129 130 131 132 133 134 135 |
# File 'lib/zippendo/models/create_shipment_request.rb', line 126 def self.openapi_nullable Set.new([ :'address_id', :'service_point_id', :'pickup_details', :'order_id', :'label_printer_id', :'document_printer_id' ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
# File 'lib/zippendo/models/create_shipment_request.rb', line 107 def self.openapi_types { :'reference' => :'String', :'address_id' => :'String', :'service_point_id' => :'String', :'parties' => :'Array<CreateShipmentRequestPartiesInner>', :'type' => :'String', :'carrier_settings' => :'CreateShipmentRequestCarrierSettings', :'parcels' => :'Array<CreateShipmentRequestParcelsInner>', :'pickup_details' => :'CreateShipmentRequestPickupDetails', :'term_of_trade' => :'String', :'status' => :'String', :'order_id' => :'String', :'label_printer_id' => :'String', :'document_printer_id' => :'String' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 |
# File 'lib/zippendo/models/create_shipment_request.rb', line 336 def ==(o) return true if self.equal?(o) self.class == o.class && reference == o.reference && address_id == o.address_id && service_point_id == o.service_point_id && parties == o.parties && type == o.type && carrier_settings == o.carrier_settings && parcels == o.parcels && pickup_details == o.pickup_details && term_of_trade == o.term_of_trade && status == o.status && order_id == o.order_id && label_printer_id == o.label_printer_id && document_printer_id == o.document_printer_id end |
#eql?(o) ⇒ Boolean
356 357 358 |
# File 'lib/zippendo/models/create_shipment_request.rb', line 356 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
362 363 364 |
# File 'lib/zippendo/models/create_shipment_request.rb', line 362 def hash [reference, address_id, service_point_id, parties, type, carrier_settings, parcels, pickup_details, term_of_trade, status, order_id, label_printer_id, document_printer_id].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 |
# File 'lib/zippendo/models/create_shipment_request.rb', line 220 def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new if !@reference.nil? && @reference.to_s.length < 1 invalid_properties.push('invalid value for "reference", the character length must be greater than or equal to 1.') end if !@parties.nil? && @parties.length < 1 invalid_properties.push('invalid value for "parties", number of items must be greater than or equal to 1.') end if @type.nil? invalid_properties.push('invalid value for "type", type cannot be nil.') end if @carrier_settings.nil? invalid_properties.push('invalid value for "carrier_settings", carrier_settings cannot be nil.') end if !@parcels.nil? && @parcels.length < 1 invalid_properties.push('invalid value for "parcels", number of items must be greater than or equal to 1.') end invalid_properties end |
#to_hash ⇒ Hash
Returns the object in the form of hash
391 392 393 394 395 396 397 398 399 400 401 402 403 |
# File 'lib/zippendo/models/create_shipment_request.rb', line 391 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) if value.nil? is_nullable = self.class.openapi_nullable.include?(attr) next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) end hash[param] = _to_hash(value) end hash end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
248 249 250 251 252 253 254 255 256 257 258 259 260 |
# File 'lib/zippendo/models/create_shipment_request.rb', line 248 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' return false if !@reference.nil? && @reference.to_s.length < 1 return false if !@parties.nil? && @parties.length < 1 return false if @type.nil? type_validator = EnumAttributeValidator.new('String', ["outbound", "inbound"]) return false unless type_validator.valid?(@type) return false if @carrier_settings.nil? return false if !@parcels.nil? && @parcels.length < 1 status_validator = EnumAttributeValidator.new('String', ["draft", "pending", "processing", "dispatched", "partly_dispatched", "error", "cancelled", "on_hold"]) return false unless status_validator.valid?(@status) true end |