Class: UspsApi::PackageTypesAccepted
- Defined in:
- lib/usps_api/models/package_types_accepted.rb
Overview
Accepted Package Types at USPS® Destination Entry Drop Shipment Location.
Instance Attribute Summary collapse
-
#mail_class ⇒ MailClass6
The mail class accepted at the facility.
-
#palletized ⇒ Palletized
Designates whether the facility accepts palletized, non-palletized, or both.
-
#processing_category ⇒ ProcessingCategory6
Designates what shape the facility accepts for packages.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(mail_class: SKIP, processing_category: SKIP, palletized: SKIP) ⇒ PackageTypesAccepted
constructor
A new instance of PackageTypesAccepted.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(mail_class: SKIP, processing_category: SKIP, palletized: SKIP) ⇒ PackageTypesAccepted
Returns a new instance of PackageTypesAccepted.
55 56 57 58 59 60 |
# File 'lib/usps_api/models/package_types_accepted.rb', line 55 def initialize(mail_class: SKIP, processing_category: SKIP, palletized: SKIP) @mail_class = mail_class unless mail_class == SKIP @processing_category = processing_category unless processing_category == SKIP @palletized = palletized unless palletized == SKIP end |
Instance Attribute Details
#mail_class ⇒ MailClass6
The mail class accepted at the facility
15 16 17 |
# File 'lib/usps_api/models/package_types_accepted.rb', line 15 def mail_class @mail_class end |
#palletized ⇒ Palletized
Designates whether the facility accepts palletized, non-palletized, or both.
30 31 32 |
# File 'lib/usps_api/models/package_types_accepted.rb', line 30 def palletized @palletized end |
#processing_category ⇒ ProcessingCategory6
Designates what shape the facility accepts for packages. For more information on package shapes see the [Physical Standards for Parcels](pe.usps.com/text/dmm300/201.htm#ep1097220).
Note:
- `IRREGULAR` is unsupported as of 2/1/2025 and will no longer return.
- `NON_MACHINABLE` is unsupported as of 2/1/2025 and will no longer
return.
25 26 27 |
# File 'lib/usps_api/models/package_types_accepted.rb', line 25 def processing_category @processing_category end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/usps_api/models/package_types_accepted.rb', line 63 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. mail_class = hash.key?('mailClass') ? hash['mailClass'] : SKIP processing_category = hash.key?('processingCategory') ? hash['processingCategory'] : SKIP palletized = hash.key?('palletized') ? hash['palletized'] : SKIP # Create object from extracted values. PackageTypesAccepted.new(mail_class: mail_class, processing_category: processing_category, palletized: palletized) end |
.names ⇒ Object
A mapping from model property names to API property names.
33 34 35 36 37 38 39 |
# File 'lib/usps_api/models/package_types_accepted.rb', line 33 def self.names @_hash = {} if @_hash.nil? @_hash['mail_class'] = 'mailClass' @_hash['processing_category'] = 'processingCategory' @_hash['palletized'] = 'palletized' @_hash end |
.nullables ⇒ Object
An array for nullable fields
51 52 53 |
# File 'lib/usps_api/models/package_types_accepted.rb', line 51 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
42 43 44 45 46 47 48 |
# File 'lib/usps_api/models/package_types_accepted.rb', line 42 def self.optionals %w[ mail_class processing_category palletized ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
86 87 88 89 90 |
# File 'lib/usps_api/models/package_types_accepted.rb', line 86 def inspect class_name = self.class.name.split('::').last "<#{class_name} mail_class: #{@mail_class.inspect}, processing_category:"\ " #{@processing_category.inspect}, palletized: #{@palletized.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
79 80 81 82 83 |
# File 'lib/usps_api/models/package_types_accepted.rb', line 79 def to_s class_name = self.class.name.split('::').last "<#{class_name} mail_class: #{@mail_class}, processing_category: #{@processing_category},"\ " palletized: #{@palletized}>" end |