Class: OpenapiClient::AdvancedShipmentOptions
- Inherits:
-
Object
- Object
- OpenapiClient::AdvancedShipmentOptions
- Defined in:
- lib/openapi_client/models/advanced_shipment_options.rb
Overview
Advanced shipment options
Instance Attribute Summary collapse
-
#bill_to_account ⇒ Object
This field is used to [bill shipping costs to a third party](www.shipengine.com/docs/shipping/bill-to-third-party/).
-
#bill_to_country_code ⇒ Object
The two-letter [ISO 3166-1 country code](en.wikipedia.org/wiki/ISO_3166-1) of the third-party that is responsible for shipping costs.
-
#bill_to_party ⇒ Object
Indicates whether to bill shipping costs to the recipient or to a third-party.
-
#bill_to_postal_code ⇒ Object
The postal code of the third-party that is responsible for shipping costs.
-
#collect_on_delivery ⇒ Object
Returns the value of attribute collect_on_delivery.
-
#contains_alcohol ⇒ Object
Indicates that the shipment contains alcohol.
-
#custom_field1 ⇒ Object
An arbitrary field that can be used to store information about the shipment.
-
#custom_field2 ⇒ Object
An arbitrary field that can be used to store information about the shipment.
-
#custom_field3 ⇒ Object
An arbitrary field that can be used to store information about the shipment.
-
#delivered_duty_paid ⇒ Object
Indicates that the shipper is paying the international delivery duties for this shipment.
-
#dry_ice ⇒ Object
Indicates if the shipment contain dry ice.
-
#dry_ice_weight ⇒ Object
The weight of the dry ice in the shipment.
-
#freight_class ⇒ Object
The National Motor Freight Traffic Association [freight class](www.nmfta.org/pages/nmfc?AspxAutoDetectCookieSupport=1), such as "77.5", "110", or "250".
-
#non_machinable ⇒ Object
Indicates that the package cannot be processed automatically because it is too large or irregularly shaped.
-
#saturday_delivery ⇒ Object
Enables Saturday delivery, if supported by the carrier.
-
#use_ups_ground_freight_pricing ⇒ Object
Whether to use [UPS Ground Freight pricing](www.shipengine.com/docs/shipping/ups-ground-freight/).
Class Method Summary collapse
-
.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.
-
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type.
-
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash.
-
#build_from_hash(attributes) ⇒ Object
Builds the object from hash.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ AdvancedShipmentOptions
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility).
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
Returns the string representation of the object.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Constructor Details
#initialize(attributes = {}) ⇒ AdvancedShipmentOptions
Initializes the object
127 128 129 130 131 132 133 134 135 136 137 138 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 217 218 219 220 221 222 223 224 225 |
# File 'lib/openapi_client/models/advanced_shipment_options.rb', line 127 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::AdvancedShipmentOptions` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| if (!self.class.attribute_map.key?(k.to_sym)) fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::AdvancedShipmentOptions`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect end h[k.to_sym] = v } if attributes.key?(:'bill_to_account') self.bill_to_account = attributes[:'bill_to_account'] else self.bill_to_account = 'null' end if attributes.key?(:'bill_to_country_code') self.bill_to_country_code = attributes[:'bill_to_country_code'] end if attributes.key?(:'bill_to_party') self.bill_to_party = attributes[:'bill_to_party'] end if attributes.key?(:'bill_to_postal_code') self.bill_to_postal_code = attributes[:'bill_to_postal_code'] else self.bill_to_postal_code = 'null' end if attributes.key?(:'contains_alcohol') self.contains_alcohol = attributes[:'contains_alcohol'] else self.contains_alcohol = false end if attributes.key?(:'delivered_duty_paid') self.delivered_duty_paid = attributes[:'delivered_duty_paid'] else self.delivered_duty_paid = false end if attributes.key?(:'dry_ice') self.dry_ice = attributes[:'dry_ice'] else self.dry_ice = false end if attributes.key?(:'dry_ice_weight') self.dry_ice_weight = attributes[:'dry_ice_weight'] end if attributes.key?(:'non_machinable') self.non_machinable = attributes[:'non_machinable'] else self.non_machinable = false end if attributes.key?(:'saturday_delivery') self.saturday_delivery = attributes[:'saturday_delivery'] else self.saturday_delivery = false end if attributes.key?(:'use_ups_ground_freight_pricing') self.use_ups_ground_freight_pricing = attributes[:'use_ups_ground_freight_pricing'] end if attributes.key?(:'freight_class') self.freight_class = attributes[:'freight_class'] else self.freight_class = 'null' end if attributes.key?(:'custom_field1') self.custom_field1 = attributes[:'custom_field1'] else self.custom_field1 = 'null' end if attributes.key?(:'custom_field2') self.custom_field2 = attributes[:'custom_field2'] else self.custom_field2 = 'null' end if attributes.key?(:'custom_field3') self.custom_field3 = attributes[:'custom_field3'] else self.custom_field3 = 'null' end if attributes.key?(:'collect_on_delivery') self.collect_on_delivery = attributes[:'collect_on_delivery'] end end |
Instance Attribute Details
#bill_to_account ⇒ Object
This field is used to [bill shipping costs to a third party](www.shipengine.com/docs/shipping/bill-to-third-party/). This field must be used in conjunction with the ‘bill_to_country_code`, `bill_to_party`, and `bill_to_postal_code` fields.
19 20 21 |
# File 'lib/openapi_client/models/advanced_shipment_options.rb', line 19 def bill_to_account @bill_to_account end |
#bill_to_country_code ⇒ Object
The two-letter [ISO 3166-1 country code](en.wikipedia.org/wiki/ISO_3166-1) of the third-party that is responsible for shipping costs.
22 23 24 |
# File 'lib/openapi_client/models/advanced_shipment_options.rb', line 22 def bill_to_country_code @bill_to_country_code end |
#bill_to_party ⇒ Object
Indicates whether to bill shipping costs to the recipient or to a third-party. When billing to a third-party, the ‘bill_to_account`, `bill_to_country_code`, and `bill_to_postal_code` fields must also be set.
25 26 27 |
# File 'lib/openapi_client/models/advanced_shipment_options.rb', line 25 def bill_to_party @bill_to_party end |
#bill_to_postal_code ⇒ Object
The postal code of the third-party that is responsible for shipping costs.
28 29 30 |
# File 'lib/openapi_client/models/advanced_shipment_options.rb', line 28 def bill_to_postal_code @bill_to_postal_code end |
#collect_on_delivery ⇒ Object
Returns the value of attribute collect_on_delivery.
63 64 65 |
# File 'lib/openapi_client/models/advanced_shipment_options.rb', line 63 def collect_on_delivery @collect_on_delivery end |
#contains_alcohol ⇒ Object
Indicates that the shipment contains alcohol.
31 32 33 |
# File 'lib/openapi_client/models/advanced_shipment_options.rb', line 31 def contains_alcohol @contains_alcohol end |
#custom_field1 ⇒ Object
An arbitrary field that can be used to store information about the shipment.
55 56 57 |
# File 'lib/openapi_client/models/advanced_shipment_options.rb', line 55 def custom_field1 @custom_field1 end |
#custom_field2 ⇒ Object
An arbitrary field that can be used to store information about the shipment.
58 59 60 |
# File 'lib/openapi_client/models/advanced_shipment_options.rb', line 58 def custom_field2 @custom_field2 end |
#custom_field3 ⇒ Object
An arbitrary field that can be used to store information about the shipment.
61 62 63 |
# File 'lib/openapi_client/models/advanced_shipment_options.rb', line 61 def custom_field3 @custom_field3 end |
#delivered_duty_paid ⇒ Object
Indicates that the shipper is paying the international delivery duties for this shipment. This option is supported by UPS, FedEx, and DHL Express.
34 35 36 |
# File 'lib/openapi_client/models/advanced_shipment_options.rb', line 34 def delivered_duty_paid @delivered_duty_paid end |
#dry_ice ⇒ Object
Indicates if the shipment contain dry ice
37 38 39 |
# File 'lib/openapi_client/models/advanced_shipment_options.rb', line 37 def dry_ice @dry_ice end |
#dry_ice_weight ⇒ Object
The weight of the dry ice in the shipment
40 41 42 |
# File 'lib/openapi_client/models/advanced_shipment_options.rb', line 40 def dry_ice_weight @dry_ice_weight end |
#freight_class ⇒ Object
The National Motor Freight Traffic Association [freight class](www.nmfta.org/pages/nmfc?AspxAutoDetectCookieSupport=1), such as "77.5", "110", or "250".
52 53 54 |
# File 'lib/openapi_client/models/advanced_shipment_options.rb', line 52 def freight_class @freight_class end |
#non_machinable ⇒ Object
Indicates that the package cannot be processed automatically because it is too large or irregularly shaped. This is primarily for USPS shipments. See [Section 1.2 of the USPS parcel standards](pe.usps.com/text/dmm300/101.htm#ep1047495) for details.
43 44 45 |
# File 'lib/openapi_client/models/advanced_shipment_options.rb', line 43 def non_machinable @non_machinable end |
#saturday_delivery ⇒ Object
Enables Saturday delivery, if supported by the carrier.
46 47 48 |
# File 'lib/openapi_client/models/advanced_shipment_options.rb', line 46 def saturday_delivery @saturday_delivery end |
#use_ups_ground_freight_pricing ⇒ Object
Whether to use [UPS Ground Freight pricing](www.shipengine.com/docs/shipping/ups-ground-freight/). If enabled, then a ‘freight_class` must also be specified.
49 50 51 |
# File 'lib/openapi_client/models/advanced_shipment_options.rb', line 49 def use_ups_ground_freight_pricing @use_ups_ground_freight_pricing end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/openapi_client/models/advanced_shipment_options.rb', line 66 def self.attribute_map { :'bill_to_account' => :'bill_to_account', :'bill_to_country_code' => :'bill_to_country_code', :'bill_to_party' => :'bill_to_party', :'bill_to_postal_code' => :'bill_to_postal_code', :'contains_alcohol' => :'contains_alcohol', :'delivered_duty_paid' => :'delivered_duty_paid', :'dry_ice' => :'dry_ice', :'dry_ice_weight' => :'dry_ice_weight', :'non_machinable' => :'non_machinable', :'saturday_delivery' => :'saturday_delivery', :'use_ups_ground_freight_pricing' => :'use_ups_ground_freight_pricing', :'freight_class' => :'freight_class', :'custom_field1' => :'custom_field1', :'custom_field2' => :'custom_field2', :'custom_field3' => :'custom_field3', :'collect_on_delivery' => :'collect_on_delivery' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
323 324 325 |
# File 'lib/openapi_client/models/advanced_shipment_options.rb', line 323 def self.build_from_hash(attributes) new.build_from_hash(attributes) end |
.openapi_nullable ⇒ Object
List of attributes with nullable: true
110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
# File 'lib/openapi_client/models/advanced_shipment_options.rb', line 110 def self.openapi_nullable Set.new([ :'bill_to_account', :'bill_to_country_code', :'bill_to_party', :'bill_to_postal_code', :'dry_ice_weight', :'use_ups_ground_freight_pricing', :'freight_class', :'custom_field1', :'custom_field2', :'custom_field3', ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/openapi_client/models/advanced_shipment_options.rb', line 88 def self.openapi_types { :'bill_to_account' => :'String', :'bill_to_country_code' => :'String', :'bill_to_party' => :'BillToParty', :'bill_to_postal_code' => :'String', :'contains_alcohol' => :'Boolean', :'delivered_duty_paid' => :'Boolean', :'dry_ice' => :'Boolean', :'dry_ice_weight' => :'Weight', :'non_machinable' => :'Boolean', :'saturday_delivery' => :'Boolean', :'use_ups_ground_freight_pricing' => :'Boolean', :'freight_class' => :'String', :'custom_field1' => :'String', :'custom_field2' => :'String', :'custom_field3' => :'String', :'collect_on_delivery' => :'CollectOnDelivery' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 |
# File 'lib/openapi_client/models/advanced_shipment_options.rb', line 287 def ==(o) return true if self.equal?(o) self.class == o.class && bill_to_account == o.bill_to_account && bill_to_country_code == o.bill_to_country_code && bill_to_party == o.bill_to_party && bill_to_postal_code == o.bill_to_postal_code && contains_alcohol == o.contains_alcohol && delivered_duty_paid == o.delivered_duty_paid && dry_ice == o.dry_ice && dry_ice_weight == o.dry_ice_weight && non_machinable == o.non_machinable && saturday_delivery == o.saturday_delivery && use_ups_ground_freight_pricing == o.use_ups_ground_freight_pricing && freight_class == o.freight_class && custom_field1 == o.custom_field1 && custom_field2 == o.custom_field2 && custom_field3 == o.custom_field3 && collect_on_delivery == o.collect_on_delivery end |
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type
351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 |
# File 'lib/openapi_client/models/advanced_shipment_options.rb', line 351 def _deserialize(type, value) case type.to_sym when :DateTime DateTime.parse(value) when :Date Date.parse(value) when :String value.to_s when :Integer value.to_i when :Float value.to_f when :Boolean if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else false end when :Object # generic object (usually a Hash), return directly value when /\AArray<(?<inner_type>.+)>\z/ inner_type = Regexp.last_match[:inner_type] value.map { |v| _deserialize(inner_type, v) } when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/ k_type = Regexp.last_match[:k_type] v_type = Regexp.last_match[:v_type] {}.tap do |hash| value.each do |k, v| hash[_deserialize(k_type, k)] = _deserialize(v_type, v) end end else # model OpenapiClient.const_get(type).build_from_hash(value) end end |
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value
420 421 422 423 424 425 426 427 428 429 430 431 432 |
# File 'lib/openapi_client/models/advanced_shipment_options.rb', line 420 def _to_hash(value) if value.is_a?(Array) value.compact.map { |v| _to_hash(v) } elsif value.is_a?(Hash) {}.tap do |hash| value.each { |k, v| hash[k] = _to_hash(v) } end elsif value.respond_to? :to_hash value.to_hash else value end end |
#build_from_hash(attributes) ⇒ Object
Builds the object from hash
330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 |
# File 'lib/openapi_client/models/advanced_shipment_options.rb', line 330 def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.openapi_types.each_pair do |key, type| if 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[self.class.attribute_map[key]].is_a?(Array) self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end # or else data not found in attributes(hash), not an issue as the data can be optional end self end |
#eql?(o) ⇒ Boolean
310 311 312 |
# File 'lib/openapi_client/models/advanced_shipment_options.rb', line 310 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
316 317 318 |
# File 'lib/openapi_client/models/advanced_shipment_options.rb', line 316 def hash [bill_to_account, bill_to_country_code, bill_to_party, bill_to_postal_code, contains_alcohol, delivered_duty_paid, dry_ice, dry_ice_weight, non_machinable, saturday_delivery, use_ups_ground_freight_pricing, freight_class, custom_field1, custom_field2, custom_field3, collect_on_delivery].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 |
# File 'lib/openapi_client/models/advanced_shipment_options.rb', line 229 def list_invalid_properties invalid_properties = Array.new if !@custom_field1.nil? && @custom_field1.to_s.length > 100 invalid_properties.push('invalid value for "custom_field1", the character length must be smaller than or equal to 100.') end if !@custom_field2.nil? && @custom_field2.to_s.length > 100 invalid_properties.push('invalid value for "custom_field2", the character length must be smaller than or equal to 100.') end if !@custom_field3.nil? && @custom_field3.to_s.length > 100 invalid_properties.push('invalid value for "custom_field3", the character length must be smaller than or equal to 100.') end invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
396 397 398 |
# File 'lib/openapi_client/models/advanced_shipment_options.rb', line 396 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
402 403 404 405 406 407 408 409 410 411 412 413 414 |
# File 'lib/openapi_client/models/advanced_shipment_options.rb', line 402 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 |
#to_s ⇒ String
Returns the string representation of the object
390 391 392 |
# File 'lib/openapi_client/models/advanced_shipment_options.rb', line 390 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
248 249 250 251 252 253 |
# File 'lib/openapi_client/models/advanced_shipment_options.rb', line 248 def valid? return false if !@custom_field1.nil? && @custom_field1.to_s.length > 100 return false if !@custom_field2.nil? && @custom_field2.to_s.length > 100 return false if !@custom_field3.nil? && @custom_field3.to_s.length > 100 true end |