Class: UspsApi::PackageDescriptionWithoutRateIndicators
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- UspsApi::PackageDescriptionWithoutRateIndicators
- Defined in:
- lib/usps_api/models/package_description_without_rate_indicators.rb
Overview
PackageDescriptionWithoutRateIndicators Model.
Instance Attribute Summary collapse
-
#carrier_release ⇒ TrueClass | FalseClass
Indicates whether recipients authorize a carrier to leave a shipment if no one is available to receive it at the time of delivery.
-
#customer_reference ⇒ Array[LabelsCustomerReference]
Used for shippers to print a value on a label and included in the Shipping Services File (SSF).
-
#destination_entry_facility_address ⇒ InternationalLabelsDomesticAddress
Address fields for US locations.
-
#destination_entry_facility_type ⇒ DestinationEntryFacilityType1
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.
-
#dimensions_uom ⇒ DimensionsUom
Dimensions unit of measure * in - Inches.
-
#extra_services ⇒ Array[LabelsExtraServiceCodes]
Extra Service Code requested.
-
#girth ⇒ Float
The girth of the container, in dimensionsUOM.
-
#has_nonstandard_characteristics ⇒ TrueClass | FalseClass
Package is nonstandard.
-
#height ⇒ Float
The height of the container, in dimensionsUOM.
-
#induction_zip_code ⇒ String
The 5-Digit ZIP Code representing the location where the package is being inducted (i.e. dropped off) into the mailstream.
-
#length ⇒ Float
The length of the container, in dimensionsUOM.
-
#logistics_manager_mid ⇒ String
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.
-
#mail_class ⇒ MailClass5
The mail service requested.
-
#mail_owner_mid ⇒ String
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.
-
#mailing_date ⇒ Object
The local date on which the package will be mailed.
-
#package_options ⇒ PackageOptions
Address fields for US locations.
-
#packaging_type ⇒ PackagingType1
USPS packaging or container attributes that may affect postage.
-
#physical_signature_required ⇒ TrueClass | FalseClass
Indicates the method for the signature that will be used when signing for the package.
-
#processing_category ⇒ ProcessingCategory3
Value designates if shipment is ‘MACHINABLE`, `NONSTANDARD`, `LETTERS`, or `FLATS`.
-
#shape ⇒ Shape1
The shape of the package.
-
#shipper_visibility_method ⇒ ShipperVisibilityMethod
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.
-
#weight ⇒ Float
The package weight, in weightUOM (Unit Of Measure).
-
#weight_uom ⇒ WeightUom
Weight Unit of Measurement * lb - Pounds.
-
#width ⇒ Float
The width of the container, in dimensionsUOM.
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.
-
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
Instance Method Summary collapse
-
#initialize(weight:, length:, height:, width:, mail_class:, processing_category:, destination_entry_facility_type:, mailing_date:, shape:, packaging_type:, 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) ⇒ PackageDescriptionWithoutRateIndicators
constructor
A new instance of PackageDescriptionWithoutRateIndicators.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
- #to_union_type_mailing_date ⇒ 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(weight:, length:, height:, width:, mail_class:, processing_category:, destination_entry_facility_type:, mailing_date:, shape:, packaging_type:, 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) ⇒ PackageDescriptionWithoutRateIndicators
Returns a new instance of PackageDescriptionWithoutRateIndicators.
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 419 420 421 422 423 424 425 426 427 428 429 430 431 432 |
# File 'lib/usps_api/models/package_description_without_rate_indicators.rb', line 380 def initialize(weight:, length:, height:, width:, mail_class:, processing_category:, destination_entry_facility_type:, mailing_date:, shape:, packaging_type:, 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 = unless == 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 @shape = shape @packaging_type = packaging_type @additional_properties = additional_properties end |
Instance Attribute Details
#carrier_release ⇒ TrueClass | 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
251 252 253 |
# File 'lib/usps_api/models/package_description_without_rate_indicators.rb', line 251 def carrier_release @carrier_release end |
#customer_reference ⇒ Array[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.
158 159 160 |
# File 'lib/usps_api/models/package_description_without_rate_indicators.rb', line 158 def customer_reference @customer_reference end |
#destination_entry_facility_address ⇒ InternationalLabelsDomesticAddress
Address fields for US locations
140 141 142 |
# File 'lib/usps_api/models/package_description_without_rate_indicators.rb', line 140 def destination_entry_facility_address @destination_entry_facility_address end |
#destination_entry_facility_type ⇒ DestinationEntryFacilityType1
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/package_description_without_rate_indicators.rb', line 136 def destination_entry_facility_type @destination_entry_facility_type end |
#dimensions_uom ⇒ DimensionsUom
Dimensions unit of measure
-
in - Inches
25 26 27 |
# File 'lib/usps_api/models/package_description_without_rate_indicators.rb', line 25 def dimensions_uom @dimensions_uom end |
#extra_services ⇒ Array[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).
229 230 231 |
# File 'lib/usps_api/models/package_description_without_rate_indicators.rb', line 229 def extra_services @extra_services end |
#girth ⇒ Float
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.
69 70 71 |
# File 'lib/usps_api/models/package_description_without_rate_indicators.rb', line 69 def girth @girth end |
#has_nonstandard_characteristics ⇒ TrueClass | 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).
77 78 79 |
# File 'lib/usps_api/models/package_description_without_rate_indicators.rb', line 77 def has_nonstandard_characteristics @has_nonstandard_characteristics end |
#height ⇒ Float
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.
47 48 49 |
# File 'lib/usps_api/models/package_description_without_rate_indicators.rb', line 47 def height @height end |
#induction_zip_code ⇒ String
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`.
279 280 281 |
# File 'lib/usps_api/models/package_description_without_rate_indicators.rb', line 279 def induction_zip_code @induction_zip_code end |
#length ⇒ Float
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.
36 37 38 |
# File 'lib/usps_api/models/package_description_without_rate_indicators.rb', line 36 def length @length end |
#logistics_manager_mid ⇒ String
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.
311 312 313 |
# File 'lib/usps_api/models/package_description_without_rate_indicators.rb', line 311 def logistics_manager_mid @logistics_manager_mid end |
#mail_class ⇒ MailClass5
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).
93 94 95 |
# File 'lib/usps_api/models/package_description_without_rate_indicators.rb', line 93 def mail_class @mail_class end |
#mail_owner_mid ⇒ String
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.
305 306 307 |
# File 'lib/usps_api/models/package_description_without_rate_indicators.rb', line 305 def mail_owner_mid @mail_owner_mid end |
#mailing_date ⇒ Object
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.
237 238 239 |
# File 'lib/usps_api/models/package_description_without_rate_indicators.rb', line 237 def mailing_date @mailing_date end |
#package_options ⇒ PackageOptions
Address fields for US locations
144 145 146 |
# File 'lib/usps_api/models/package_description_without_rate_indicators.rb', line 144 def @package_options end |
#packaging_type ⇒ PackagingType1
USPS packaging or container attributes that may affect postage. If the packaging is customer provided, use ‘VARIABLE`.
320 321 322 |
# File 'lib/usps_api/models/package_description_without_rate_indicators.rb', line 320 def packaging_type @packaging_type end |
#physical_signature_required ⇒ TrueClass | 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.
273 274 275 |
# File 'lib/usps_api/models/package_description_without_rate_indicators.rb', line 273 def physical_signature_required @physical_signature_required end |
#processing_category ⇒ ProcessingCategory3
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.
109 110 111 |
# File 'lib/usps_api/models/package_description_without_rate_indicators.rb', line 109 def processing_category @processing_category end |
#shape ⇒ Shape1
The shape of the package
315 316 317 |
# File 'lib/usps_api/models/package_description_without_rate_indicators.rb', line 315 def shape @shape end |
#shipper_visibility_method ⇒ ShipperVisibilityMethod
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:
-
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’
-
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/package_description_without_rate_indicators.rb', line 299 def shipper_visibility_method @shipper_visibility_method end |
#weight ⇒ Float
The package weight, in weightUOM (Unit Of Measure). Items must weigh 70 pounds (1120 ounces) or less.
20 21 22 |
# File 'lib/usps_api/models/package_description_without_rate_indicators.rb', line 20 def weight @weight end |
#weight_uom ⇒ WeightUom
Weight Unit of Measurement
* lb - Pounds
15 16 17 |
# File 'lib/usps_api/models/package_description_without_rate_indicators.rb', line 15 def weight_uom @weight_uom end |
#width ⇒ Float
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.
58 59 60 |
# File 'lib/usps_api/models/package_description_without_rate_indicators.rb', line 58 def width @width end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 |
# File 'lib/usps_api/models/package_description_without_rate_indicators.rb', line 435 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(:PackageDescriptionWithoutRateIndicatorsMailingDate), hash['mailingDate'] ) : nil shape = hash.key?('shape') ? hash['shape'] : nil packaging_type = hash.key?('packagingType') ? hash['packagingType'] : 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 = 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. PackageDescriptionWithoutRateIndicators.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, shape: shape, packaging_type: packaging_type, 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: , 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 |
.names ⇒ Object
A mapping from model property names to API property names.
323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 |
# File 'lib/usps_api/models/package_description_without_rate_indicators.rb', line 323 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['shape'] = 'shape' @_hash['packaging_type'] = 'packagingType' @_hash end |
.nullables ⇒ Object
An array for nullable fields
376 377 378 |
# File 'lib/usps_api/models/package_description_without_rate_indicators.rb', line 376 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 |
# File 'lib/usps_api/models/package_description_without_rate_indicators.rb', line 356 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.
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 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 |
# File 'lib/usps_api/models/package_description_without_rate_indicators.rb', line 528 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(:PackageDescriptionWithoutRateIndicatorsMailingDate) .validate(value.mailing_date) and APIHelper.valid_type?(value.shape, ->(val) { Shape1.validate(val) }) and APIHelper.valid_type?(value.packaging_type, ->(val) { PackagingType1.validate(val) }) ) 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(:PackageDescriptionWithoutRateIndicatorsMailingDate) .validate(value['mailingDate']) and APIHelper.valid_type?(value['shape'], ->(val) { Shape1.validate(val) }) and APIHelper.valid_type?(value['packagingType'], ->(val) { PackagingType1.validate(val) }) ) end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 |
# File 'lib/usps_api/models/package_description_without_rate_indicators.rb', line 599 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}, shape: #{@shape.inspect},"\ " packaging_type: #{@packaging_type.inspect}, additional_properties:"\ " #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 |
# File 'lib/usps_api/models/package_description_without_rate_indicators.rb', line 581 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}, shape: #{@shape}, packaging_type: #{@packaging_type},"\ " additional_properties: #{@additional_properties}>" end |
#to_union_type_mailing_date ⇒ Object
520 521 522 523 524 |
# File 'lib/usps_api/models/package_description_without_rate_indicators.rb', line 520 def to_union_type_mailing_date UnionTypeLookUp.get(:PackageDescriptionWithoutRateIndicatorsMailingDate) .validate(mailing_date) .serialize(mailing_date) end |