Class: UspsApi::LabelsPackageDescription

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/usps_api/models/labels_package_description.rb

Overview

LabelsPackageDescription Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(weight:, length:, height:, width:, mail_class:, processing_category:, destination_entry_facility_type:, mailing_date:, weight_uom: WeightUom::LB, dimensions_uom: DimensionsUom::ENUM_IN, girth: SKIP, has_nonstandard_characteristics: false, destination_entry_facility_address: SKIP, package_options: SKIP, customer_reference: SKIP, extra_services: SKIP, carrier_release: SKIP, physical_signature_required: SKIP, induction_zip_code: SKIP, shipper_visibility_method: SKIP, mail_owner_mid: SKIP, logistics_manager_mid: SKIP, additional_properties: nil) ⇒ LabelsPackageDescription

Returns a new instance of LabelsPackageDescription.



369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
# File 'lib/usps_api/models/labels_package_description.rb', line 369

def initialize(weight:, length:, height:, width:, mail_class:,
               processing_category:, destination_entry_facility_type:,
               mailing_date:, weight_uom: WeightUom::LB,
               dimensions_uom: DimensionsUom::ENUM_IN, girth: SKIP,
               has_nonstandard_characteristics: false,
               destination_entry_facility_address: SKIP,
               package_options: SKIP, customer_reference: SKIP,
               extra_services: SKIP, carrier_release: SKIP,
               physical_signature_required: SKIP, induction_zip_code: SKIP,
               shipper_visibility_method: SKIP, mail_owner_mid: SKIP,
               logistics_manager_mid: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @weight_uom = weight_uom unless weight_uom == SKIP
  @weight = weight
  @dimensions_uom = dimensions_uom unless dimensions_uom == SKIP
  @length = length
  @height = height
  @width = width
  @girth = girth unless girth == SKIP
  unless has_nonstandard_characteristics == SKIP
    @has_nonstandard_characteristics =
      has_nonstandard_characteristics
  end
  @mail_class = mail_class
  @processing_category = processing_category
  @destination_entry_facility_type = destination_entry_facility_type
  unless destination_entry_facility_address == SKIP
    @destination_entry_facility_address =
      destination_entry_facility_address
  end
  @package_options = package_options unless package_options == SKIP
  @customer_reference = customer_reference unless customer_reference == SKIP
  @extra_services = extra_services unless extra_services == SKIP
  @mailing_date = mailing_date
  @carrier_release = carrier_release unless carrier_release == SKIP
  unless physical_signature_required == SKIP
    @physical_signature_required =
      physical_signature_required
  end
  @induction_zip_code = induction_zip_code unless induction_zip_code == SKIP
  unless shipper_visibility_method == SKIP
    @shipper_visibility_method =
      shipper_visibility_method
  end
  @mail_owner_mid = mail_owner_mid unless mail_owner_mid == SKIP
  @logistics_manager_mid = logistics_manager_mid unless logistics_manager_mid == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#carrier_releaseTrueClass | FalseClass

Indicates whether recipients authorize a carrier to leave a shipment if no one is available to receive it at the time of delivery. Priority Mail Express® shipments or items requiring a signature at delivery are not eligible (e.g. Signature Confirmation, Insurance > $500). Note:

* Carrier release is currently not supported when 'holdForPickup' is set

to true

* Carrier Release is currently not supported with mail class values of

‘PRIORITY_MAIL’, ‘PRIORITY_MAIL_EXPRESS’, or ‘USPS_GROUND_ADVANTAGE’

* Carrier Release is currently not supported with 'extraServices' 910,

911, 912, 913, 921, 922, 923, 924, 925, 930, 931, 934, 955, or 981

Returns:

  • (TrueClass | FalseClass)


251
252
253
# File 'lib/usps_api/models/labels_package_description.rb', line 251

def carrier_release
  @carrier_release
end

#customer_referenceArray[LabelsCustomerReference]

Used for shippers to print a value on a label and included in the Shipping Services File (SSF). Note:

* Customer Reference #3-4 are only supported with label types `4X5LABEL`,

‘4X6LABEL`, and `6X4LABEL`.

* Customer Reference #3-4 cannot be used with a customs form.
* Customer Reference #3-4 will not be added to the SSF.
* Customer Reference will not display with

‘imageInfo.brandingImageFormat` value of `RECTANGLE`.

* When Customer Reference #4 is provided with a Destination Entry

Facility, the Drop-Off Location will not be displayed on the label.

Returns:



158
159
160
# File 'lib/usps_api/models/labels_package_description.rb', line 158

def customer_reference
  @customer_reference
end

#destination_entry_facility_addressInternationalLabelsDomesticAddress

Address fields for US locations



140
141
142
# File 'lib/usps_api/models/labels_package_description.rb', line 140

def destination_entry_facility_address
  @destination_entry_facility_address
end

#destination_entry_facility_typeDestinationEntryFacilityType1

Types of Facilities:

  • ‘NONE` - Translate to Destination Rate Indicator N

  • ‘DESTINATION_NETWORK_DISTRIBUTION_CENTER` - Translate to Destination

Rate Indicator B

  • ‘DESTINATION_SECTIONAL_CENTER_FACILITY` - Translate to Destination Rate

Indicator S

  • ‘DESTINATION_DELIVERY_UNIT` - Translate to Destination Rate Indicator D

  • ‘DESTINATION_SERVICE_HUB` - Translate to Destination Rate Indicator H

  • ‘DESTINATION_REGIONAL_PROCESSING_DISTRIBUTION_CENTER` - Translate to

Destination Rate Indicator B Note:

  • If any value other than ‘NONE` is selected, a

destinationEntryFacilityAddress is required.

  • The destinationEntryFacilityAddress must be a valid facility to drop

your package

  • The destination entry facility type must be set to ‘NONE` when there is

a value provided for the ‘inductionZipCode’ field

  • Effective 01/19/2025: ‘DESTINATION_DELIVERY_UNIT` is the only valid

enumeration when using the ‘USPS_CONNECT_MAIL’ mail class

  • Effective 01/18/2026: ‘DESTINATION_NETWORK_DISTRIBUTION_CENTER` with

‘PARCEL_SELECT` is no longer eligible.

  • Effective 01/18/2026: (NSA Only)

‘DESTINATION_REGIONAL_PROCESSING_DISTRIBUTION_CENTER` with `PARCEL_SELECT` is available as an option.



136
137
138
# File 'lib/usps_api/models/labels_package_description.rb', line 136

def destination_entry_facility_type
  @destination_entry_facility_type
end

#dimensions_uomDimensionsUom

Dimensions unit of measure

  • in - Inches

Returns:



25
26
27
# File 'lib/usps_api/models/labels_package_description.rb', line 25

def dimensions_uom
  @dimensions_uom
end

#extra_servicesArray[LabelsExtraServiceCodes]

Extra Service Code requested.

  • 365 - Global Direct Entry

  • 415 - USPS Label Delivery

  • 480 - Tracking Plus 6 Months

  • 481 - Tracking Plus 1 Year

  • 482 - Tracking Plus 3 Years

  • 483 - Tracking Plus 5 Years

  • 484 - Tracking Plus 7 Years

  • 485 - Tracking Plus 10 Years

  • 486 - Tracking Plus Signature 3 Years

  • 487 - Tracking Plus Signature 5 Years

  • 488 - Tracking Plus Signature 7 Years

  • 489 - Tracking Plus Signature 10 Years

  • 810 - HAZMAT Air Eligible Ethanol Package

  • 811 - HAZMAT Class 1 - Toy Propellant/Safety Fuse Package

  • 812 - HAZMAT Class 3 – Flammable Liquid Package

  • 813 - HAZMAT Class 7 - Radioactive Materials Package

  • 814 - HAZMAT Class 8 - Corrosive Materials Package

  • 815 - HAZMAT Class 8 - Nonspillable Wet Battery Package

  • 816 - HAZMAT Class 9 - Lithium Battery Marked - Ground Only Package

  • 817 - HAZMAT Class 9 - Lithium Battery - Returns Package

  • 818 - HAZMAT Class 9 - Lithium batteries, marked package

  • 819 - HAZMAT Class 9 - Dry Ice Package

  • 820 - HAZMAT Class 9 - Lithium batteries, unmarked package

  • 821 - HAZMAT Class 9 - Magnetized Materials Package

  • 822 - HAZMAT Division 4.1 – Flammable Solids or Safety Matches Package

  • 823 - HAZMAT Division 5.1 - Oxidizers Package

  • 824 - HAZMAT Division 5.2 - Organic Peroxides Package

  • 825 - HAZMAT Division 6.1 – Toxic Materials Package

  • 826 - HAZMAT Division 6.2 – Infectious Substances Package

  • 827 - HAZMAT Excepted Quantity Provision Package

  • 828 - HAZMAT Ground Only

  • 829 - HAZMAT ID8000 Consumer Commodity Package

  • 830 - HAZMAT Lighters Package

  • 831 - HAZMAT LTD QTY Ground Package

  • 832 - HAZMAT Small Quantity Provision Package

  • 857 - Hazardous Material

  • 910 - Certified Mail

  • 911 - Certified Mail Restricted Delivery

  • 912 - Certified Mail Adult Signature Required

  • 913 - Certified Mail Adult Signature Restricted Delivery

  • 920 - USPS Tracking

  • 921 - Signature Confirmation

  • 922 - Adult Signature Required 21 or Over

  • 923 - Adult Signature Restricted Delivery 21 or Over

  • 924 - Signature Confirmation Restricted Delivery

  • 925 - Priority Mail Express Merchandise Insurance

  • 930 - Insurance <= $500

  • 931 - Insurance > $500

  • 934 - Insurance Restricted Delivery

  • 955 - Return Receipt

  • 957 - Return Receipt Electronic

  • 981 - Signature Requested (PRIORITY_MAIL_EXPRESS only)

  • 986 - PO to Addressee (PRIORITY_MAIL_EXPRESS only)

  • 991 - Sunday Delivery

Note:

  • When the extra service code “930” is provided in the request, if the

item value is over $500, “930” will automatically be replaced with “931” - Insurance (Greater than $500).

  • USPS Label Delivery (Print and Deliver, extra service code “415”): When

requesting this service, no images will be returned in the API response. The label and receipt will be printed and mailed to the ‘fromAddress` provided. The mailed label will always include a receipt on the page. This service is not available at all locations.

  • Some service codes require a combination with extra services such as

“955” and “957”. For all valid combinations, visit [postalpro.usps.com/IMPB_Service_Type_Codes](https://postalpro.usp s.com/IMPB_Service_Type_Codes).

Returns:



229
230
231
# File 'lib/usps_api/models/labels_package_description.rb', line 229

def extra_services
  @extra_services
end

#girthFloat

The girth of the container, in dimensionsUOM. If partial dimensions are provided, an error response will return. Length, Width, Height are required for accurate pricing of a rectangular package when any dimension of the item exceeds 12 inches. In addition, Girth is required only for a non- rectangular package in addition to Length, Width, Height when any dimension of the package exceeds 12 inches. For rectangular packages, the Girth dimension must be left blank as this dimension is to only be used for non- rectangular packages.

Returns:

  • (Float)


69
70
71
# File 'lib/usps_api/models/labels_package_description.rb', line 69

def girth
  @girth
end

#has_nonstandard_characteristicsTrueClass | FalseClass

Package is nonstandard. Nonstandard packages include cylindrical tubes and rolls, certain high-density items, cartons containing more than 24 ounces of liquids in one or more glass containers, cartons containing 1 gallon or more of liquid in metal or plastic containers, and items in [201.7.6.2](pe.usps.com/text/dmm300/201.htm#7.6.2).

Returns:

  • (TrueClass | FalseClass)


77
78
79
# File 'lib/usps_api/models/labels_package_description.rb', line 77

def has_nonstandard_characteristics
  @has_nonstandard_characteristics
end

#heightFloat

The height of the container, in dimensionsUOM. If partial dimensions are provided, an error response will return. Length, Width, and Height are required for accurate pricing of a rectangular package when any dimension of the item exceeds 12 inches. Girth is required only for a non-rectangular package in addition to Length, Width, and Height when any dimension of the package exceeds 12 inches. For rectangular packages, the Girth dimension must be left blank as this dimension is to only be used for non-rectangular packages.

Returns:

  • (Float)


47
48
49
# File 'lib/usps_api/models/labels_package_description.rb', line 47

def height
  @height
end

#induction_zip_codeString

The 5-Digit ZIP Code representing the location where the package is being inducted (i.e. dropped off) into the mailstream. When provided, this ZIP Code will be used for pricing instead of ‘fromAddress.ZIPCode`.

Returns:

  • (String)


279
280
281
# File 'lib/usps_api/models/labels_package_description.rb', line 279

def induction_zip_code
  @induction_zip_code
end

#lengthFloat

The length of the container, in dimensionsUOM. If partial dimensions are provided, an error response will return. Length, Width, and Height are required for accurate pricing of a rectangular package when any dimension of the item exceeds 12 inches. Girth is required only for a non-rectangular package in addition to Length, Width, and Height when any dimension of the package exceeds 12 inches. For rectangular packages, the Girth dimension must be left blank as this dimension is to only be used for non-rectangular packages.

Returns:

  • (Float)


36
37
38
# File 'lib/usps_api/models/labels_package_description.rb', line 36

def length
  @length
end

#logistics_manager_midString

This is the mailer ID associated with the logistics manager for this label This provides an additional copy of the scan extract file to the MID’s outbound folder.

Returns:

  • (String)


311
312
313
# File 'lib/usps_api/models/labels_package_description.rb', line 311

def logistics_manager_mid
  @logistics_manager_mid
end

#mail_classMailClass5

The mail service requested. Note:

  • ‘PARCEL_SELECT` with a `destinationEntryFacilityType` of `NONE` will

convert to ‘USPS_GROUND_ADVANTAGE`.

  • ‘PARCEL_SELECT_LIGHTWEIGHT` is deprecated and will convert to

‘PARCEL_SELECT`.

  • ‘FIRST-CLASS_PACKAGE_SERVICE` is deprecated and will convert to

‘USPS_GROUND_ADVANTAGE`.

  • Certain mail classes, such as ‘MEDIA_MAIL`, `BOUND_PRINTED_MATTER`, and

‘LIBRARY_MAIL`, have eligibility rules on what can be mailed using that service. For more details on these mail classes, please visit [What are Package Services?](faq.usps.com/s/article/What-are-Package-Services).

Returns:



93
94
95
# File 'lib/usps_api/models/labels_package_description.rb', line 93

def mail_class
  @mail_class
end

#mail_owner_midString

This is the mailer ID associated with the mail owner for this label This provides an additional copy of the scan extract file to the MID’s outbound folder.

Returns:

  • (String)


305
306
307
# File 'lib/usps_api/models/labels_package_description.rb', line 305

def mail_owner_mid
  @mail_owner_mid
end

#mailing_dateObject

The local date on which the package will be mailed. If the time is not provided, it will be defaulted to 10:00 p.m. local time. Local time will be based on the ‘destinationEntryFacilityAddress.ZIPCode` or `inductionZIPCode` when provided, otherwise `fromAddress.ZIPCode` will be used as the origin ZIP Code.

Returns:

  • (Object)


237
238
239
# File 'lib/usps_api/models/labels_package_description.rb', line 237

def mailing_date
  @mailing_date
end

#package_optionsPackageOptions

Address fields for US locations

Returns:



144
145
146
# File 'lib/usps_api/models/labels_package_description.rb', line 144

def package_options
  @package_options
end

#physical_signature_requiredTrueClass | FalseClass

Indicates the method for the signature that will be used when signing for the package. For customers that are not specifically requiring a physical signature upon delivery, the “SIGNATURE_REQUIRED” option will indicate that the package is eligible for both an electronic signature online or a physical signature. For more information regarding USPS Electronic Signature Online (USPS eSOL) eligibility, please visit: faq.usps.com/s/article/USPS-Electronic-Signature-Online. For all mail classes, excluding Priority Mail Express, the default value is “SIGNATURE_REQUIRED”. A value of “SIGNATURE_WAIVED” will not require the customer to sign for the package. “SIGNATURE_WAIVED” is only eligible for Priority Mail Express packages and is the default value. The ‘carrierRelease’ option is not eligible to be used in conjunction with ‘signatureType’. The ‘physicalSignatureRequired’ field is required to include signature extra service code values such as 910, 911, 912, 913, 921, 922, 923, 924, 925, 931, 934, 955, 981 or an extraServiceCode value of 930 with a packageValue greater than 500.

Returns:

  • (TrueClass | FalseClass)


273
274
275
# File 'lib/usps_api/models/labels_package_description.rb', line 273

def physical_signature_required
  @physical_signature_required
end

#processing_categoryProcessingCategory3

Value designates if shipment is ‘MACHINABLE`, `NONSTANDARD`, `LETTERS`, or `FLATS`. Note:

  • When requesting the mail class ‘USPS_CONNECT_MAIL`, users are required

to use a processing category of ‘FLATS`.

  • The processing category ‘LETTERS` is only valid for mail classes

‘PRIORITY_MAIL` and `PRIORITY_MAIL_EXPRESS` for outbound shipments.

  • The processing category ‘FLATS` is not valid for mail class

‘USPS_GROUND_ADVANTAGE`.

  • ‘IRREGULAR` is deprecated and will convert to `NONSTANDARD` as of

01/19/2025.

  • ‘NON_MACHINABLE` is deprecated and will convert to `NONSTANDARD` as of

01/19/2025.

Returns:



109
110
111
# File 'lib/usps_api/models/labels_package_description.rb', line 109

def processing_category
  @processing_category
end

#shipper_visibility_methodShipperVisibilityMethod

When generating labels for a third party shipper the label provider must capture and provide contact details of the individual or entity to whom they provide the label. There are two methods for reporting shipper information to USPS:

  1. The label provider creates a unique USPS Mailer ID (MID) using the

name, validated address, phone, and email contact information of each shipper. When using this method the Mailer ID should be submitted in the MID field in the LABEL_OWNER role when generating the payment authorization token and this field should be populated with ‘MID_INFORMATION’

  1. An alternative method allows for the label provider to assign a unique

alphanumeric value known as a platformUserId to each shipper and to report the platformUserId together with the required shipper contact details. When using this method the shipper contact details are required in the ‘senderAddress` object (including `streetAddress`, `city`, `state`, `ZIPCode`, `phone`, `email`, `platformUserId` & `firstName`/`lastName` or `firm`) and this field should be populated with ’SENDER_INFORMATION’.



299
300
301
# File 'lib/usps_api/models/labels_package_description.rb', line 299

def shipper_visibility_method
  @shipper_visibility_method
end

#weightFloat

The package weight, in weightUOM (Unit Of Measure). Items must weigh 70 pounds (1120 ounces) or less.

Returns:

  • (Float)


20
21
22
# File 'lib/usps_api/models/labels_package_description.rb', line 20

def weight
  @weight
end

#weight_uomWeightUom

Weight Unit of Measurement

* lb - Pounds

Returns:



15
16
17
# File 'lib/usps_api/models/labels_package_description.rb', line 15

def weight_uom
  @weight_uom
end

#widthFloat

The width of the container, in dimensionsUOM. If partial dimensions are provided, an error response will return. Length, Width, and Height are required for accurate pricing of a rectangular package when any dimension of the item exceeds 12 inches. Girth is required only for a non-rectangular package in addition to Length, Width, and Height when any dimension of the package exceeds 12 inches. For rectangular packages, the Girth dimension must be left blank as this dimension is to only be used for non- rectangular packages.

Returns:

  • (Float)


58
59
60
# File 'lib/usps_api/models/labels_package_description.rb', line 58

def width
  @width
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
# File 'lib/usps_api/models/labels_package_description.rb', line 421

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  weight = hash.key?('weight') ? hash['weight'] : nil
  length = hash.key?('length') ? hash['length'] : nil
  height = hash.key?('height') ? hash['height'] : nil
  width = hash.key?('width') ? hash['width'] : nil
  mail_class = hash.key?('mailClass') ? hash['mailClass'] : nil
  processing_category =
    hash.key?('processingCategory') ? hash['processingCategory'] : nil
  destination_entry_facility_type =
    hash.key?('destinationEntryFacilityType') ? hash['destinationEntryFacilityType'] : nil
  mailing_date = hash.key?('mailingDate') ? APIHelper.deserialize_union_type(
    UnionTypeLookUp.get(:LabelsPackageDescriptionMailingDate), hash['mailingDate']
  ) : nil
  weight_uom = hash['weightUOM'] ||= WeightUom::LB
  dimensions_uom = hash['dimensionsUOM'] ||= DimensionsUom::ENUM_IN
  girth = hash.key?('girth') ? hash['girth'] : SKIP
  has_nonstandard_characteristics =
    hash['hasNonstandardCharacteristics'] ||= false
  if hash['destinationEntryFacilityAddress']
    destination_entry_facility_address = InternationalLabelsDomesticAddress.from_hash(hash['destinationEntryFacilityAddress'])
  end
  package_options = PackageOptions.from_hash(hash['packageOptions']) if hash['packageOptions']
  # Parameter is an array, so we need to iterate through it
  customer_reference = nil
  unless hash['customerReference'].nil?
    customer_reference = []
    hash['customerReference'].each do |structure|
      customer_reference << (LabelsCustomerReference.from_hash(structure) if structure)
    end
  end

  customer_reference = SKIP unless hash.key?('customerReference')
  extra_services = hash.key?('extraServices') ? hash['extraServices'] : SKIP
  carrier_release =
    hash.key?('carrierRelease') ? hash['carrierRelease'] : SKIP
  physical_signature_required =
    hash.key?('physicalSignatureRequired') ? hash['physicalSignatureRequired'] : SKIP
  induction_zip_code =
    hash.key?('inductionZIPCode') ? hash['inductionZIPCode'] : SKIP
  shipper_visibility_method =
    hash.key?('shipperVisibilityMethod') ? hash['shipperVisibilityMethod'] : SKIP
  mail_owner_mid = hash.key?('mailOwnerMID') ? hash['mailOwnerMID'] : SKIP
  logistics_manager_mid =
    hash.key?('logisticsManagerMID') ? hash['logisticsManagerMID'] : 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.
  LabelsPackageDescription.new(weight: weight,
                               length: length,
                               height: height,
                               width: width,
                               mail_class: mail_class,
                               processing_category: processing_category,
                               destination_entry_facility_type: destination_entry_facility_type,
                               mailing_date: mailing_date,
                               weight_uom: weight_uom,
                               dimensions_uom: dimensions_uom,
                               girth: girth,
                               has_nonstandard_characteristics: has_nonstandard_characteristics,
                               destination_entry_facility_address: destination_entry_facility_address,
                               package_options: package_options,
                               customer_reference: customer_reference,
                               extra_services: extra_services,
                               carrier_release: carrier_release,
                               physical_signature_required: physical_signature_required,
                               induction_zip_code: induction_zip_code,
                               shipper_visibility_method: shipper_visibility_method,
                               mail_owner_mid: mail_owner_mid,
                               logistics_manager_mid: logistics_manager_mid,
                               additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
# File 'lib/usps_api/models/labels_package_description.rb', line 314

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['weight_uom'] = 'weightUOM'
  @_hash['weight'] = 'weight'
  @_hash['dimensions_uom'] = 'dimensionsUOM'
  @_hash['length'] = 'length'
  @_hash['height'] = 'height'
  @_hash['width'] = 'width'
  @_hash['girth'] = 'girth'
  @_hash['has_nonstandard_characteristics'] =
    'hasNonstandardCharacteristics'
  @_hash['mail_class'] = 'mailClass'
  @_hash['processing_category'] = 'processingCategory'
  @_hash['destination_entry_facility_type'] =
    'destinationEntryFacilityType'
  @_hash['destination_entry_facility_address'] =
    'destinationEntryFacilityAddress'
  @_hash['package_options'] = 'packageOptions'
  @_hash['customer_reference'] = 'customerReference'
  @_hash['extra_services'] = 'extraServices'
  @_hash['mailing_date'] = 'mailingDate'
  @_hash['carrier_release'] = 'carrierRelease'
  @_hash['physical_signature_required'] = 'physicalSignatureRequired'
  @_hash['induction_zip_code'] = 'inductionZIPCode'
  @_hash['shipper_visibility_method'] = 'shipperVisibilityMethod'
  @_hash['mail_owner_mid'] = 'mailOwnerMID'
  @_hash['logistics_manager_mid'] = 'logisticsManagerMID'
  @_hash
end

.nullablesObject

An array for nullable fields



365
366
367
# File 'lib/usps_api/models/labels_package_description.rb', line 365

def self.nullables
  []
end

.optionalsObject

An array for optional fields



345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
# File 'lib/usps_api/models/labels_package_description.rb', line 345

def self.optionals
  %w[
    weight_uom
    dimensions_uom
    girth
    has_nonstandard_characteristics
    destination_entry_facility_address
    package_options
    customer_reference
    extra_services
    carrier_release
    physical_signature_required
    induction_zip_code
    shipper_visibility_method
    mail_owner_mid
    logistics_manager_mid
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
# File 'lib/usps_api/models/labels_package_description.rb', line 510

def self.validate(value)
  if value.instance_of? self
    return (
      APIHelper.valid_type?(value.weight,
                            ->(val) { val.instance_of? Float }) and
        APIHelper.valid_type?(value.length,
                              ->(val) { val.instance_of? Float }) and
        APIHelper.valid_type?(value.height,
                              ->(val) { val.instance_of? Float }) and
        APIHelper.valid_type?(value.width,
                              ->(val) { val.instance_of? Float }) and
        APIHelper.valid_type?(value.mail_class,
                              ->(val) { MailClass5.validate(val) }) and
        APIHelper.valid_type?(value.processing_category,
                              ->(val) { ProcessingCategory3.validate(val) }) and
        APIHelper.valid_type?(value.destination_entry_facility_type,
                              ->(val) { DestinationEntryFacilityType1.validate(val) }) and
        UnionTypeLookUp.get(:LabelsPackageDescriptionMailingDate)
                       .validate(value.mailing_date)
    )
  end

  return false unless value.instance_of? Hash

  (
    APIHelper.valid_type?(value['weight'],
                          ->(val) { val.instance_of? Float }) and
      APIHelper.valid_type?(value['length'],
                            ->(val) { val.instance_of? Float }) and
      APIHelper.valid_type?(value['height'],
                            ->(val) { val.instance_of? Float }) and
      APIHelper.valid_type?(value['width'],
                            ->(val) { val.instance_of? Float }) and
      APIHelper.valid_type?(value['mailClass'],
                            ->(val) { MailClass5.validate(val) }) and
      APIHelper.valid_type?(value['processingCategory'],
                            ->(val) { ProcessingCategory3.validate(val) }) and
      APIHelper.valid_type?(value['destinationEntryFacilityType'],
                            ->(val) { DestinationEntryFacilityType1.validate(val) }) and
      UnionTypeLookUp.get(:LabelsPackageDescriptionMailingDate)
                     .validate(value['mailingDate'])
  )
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
# File 'lib/usps_api/models/labels_package_description.rb', line 572

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} weight_uom: #{@weight_uom.inspect}, weight: #{@weight.inspect},"\
  " dimensions_uom: #{@dimensions_uom.inspect}, length: #{@length.inspect}, height:"\
  " #{@height.inspect}, width: #{@width.inspect}, girth: #{@girth.inspect},"\
  " has_nonstandard_characteristics: #{@has_nonstandard_characteristics.inspect}, mail_class:"\
  " #{@mail_class.inspect}, processing_category: #{@processing_category.inspect},"\
  " destination_entry_facility_type: #{@destination_entry_facility_type.inspect},"\
  " destination_entry_facility_address: #{@destination_entry_facility_address.inspect},"\
  " package_options: #{@package_options.inspect}, customer_reference:"\
  " #{@customer_reference.inspect}, extra_services: #{@extra_services.inspect}, mailing_date:"\
  " #{@mailing_date.inspect}, carrier_release: #{@carrier_release.inspect},"\
  " physical_signature_required: #{@physical_signature_required.inspect}, induction_zip_code:"\
  " #{@induction_zip_code.inspect}, shipper_visibility_method:"\
  " #{@shipper_visibility_method.inspect}, mail_owner_mid: #{@mail_owner_mid.inspect},"\
  " logistics_manager_mid: #{@logistics_manager_mid.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
# File 'lib/usps_api/models/labels_package_description.rb', line 555

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} weight_uom: #{@weight_uom}, weight: #{@weight}, dimensions_uom:"\
  " #{@dimensions_uom}, length: #{@length}, height: #{@height}, width: #{@width}, girth:"\
  " #{@girth}, has_nonstandard_characteristics: #{@has_nonstandard_characteristics},"\
  " mail_class: #{@mail_class}, processing_category: #{@processing_category},"\
  " destination_entry_facility_type: #{@destination_entry_facility_type},"\
  " destination_entry_facility_address: #{@destination_entry_facility_address},"\
  " package_options: #{@package_options}, customer_reference: #{@customer_reference},"\
  " extra_services: #{@extra_services}, mailing_date: #{@mailing_date}, carrier_release:"\
  " #{@carrier_release}, physical_signature_required: #{@physical_signature_required},"\
  " induction_zip_code: #{@induction_zip_code}, shipper_visibility_method:"\
  " #{@shipper_visibility_method}, mail_owner_mid: #{@mail_owner_mid}, logistics_manager_mid:"\
  " #{@logistics_manager_mid}, additional_properties: #{@additional_properties}>"
end

#to_union_type_mailing_dateObject



502
503
504
505
506
# File 'lib/usps_api/models/labels_package_description.rb', line 502

def to_union_type_mailing_date
  UnionTypeLookUp.get(:LabelsPackageDescriptionMailingDate)
                 .validate(mailing_date)
                 .serialize(mailing_date)
end