Class: UspsApi::CreateOdContainerRequest
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- UspsApi::CreateOdContainerRequest
- Defined in:
- lib/usps_api/models/create_od_container_request.rb
Overview
Create OD Container Request
Instance Attribute Summary collapse
-
#container_mail_class ⇒ ContainerMailClass
Mail class for the Open and Distribute container.
-
#destination_entry_facility_type ⇒ DestinationEntryFacilityType3
The facility type where the container will be sent to.
-
#destination_zip_code ⇒ String
A 5-digit ZIP Code serviced by the ‘destinationEntryFacilityType` the container is being sent to.
-
#enclosed_mail_class ⇒ EnclosedMailClass
The mail class of the items enclosed in the container.
-
#image_info ⇒ PmodImageInfo
Additional details used to determine how to generate the label image.
-
#imcb_container_type ⇒ ImcbContainerType
IMcb Container Type requested.
-
#impb_container_type ⇒ ImpbContainerType
IMpb Container Type requested.
-
#mailer_name ⇒ String
Name of the business who is shipping the container.
-
#mailing_date ⇒ Object
The mailing date for when the container will be shipped.
-
#origin_address ⇒ PmodDomesticAddress
The address of the Business Mail Entry Unit (BMEU) or authorized acceptance location facility where the Open and Distribute container is being entered.
-
#processing_category ⇒ ProcessingCategory7
The type of packages that will be nested to the container.
-
#return_address ⇒ PmodDomesticLabelAddress
Uses for: The address of the business where the Open and Distribute container should be returned to if it is deemed undeliverable or returned to sender.
-
#sender_address ⇒ PmodDomesticLabelAddress
Uses for: The address of the business entering the Open and Distribute container.
-
#tracking_numbers ⇒ Array[String]
The mailing date for when the container will be shipped.
-
#weight ⇒ Float
The package weight, in weightUOM (Unit Of Measure).
-
#weight_uom ⇒ WeightUom
Weight Unit of Measure * lb - Pounds.
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(origin_address:, destination_zip_code:, enclosed_mail_class:, mailer_name:, processing_category:, destination_entry_facility_type:, mailing_date:, weight:, impb_container_type:, image_info: SKIP, sender_address: SKIP, return_address: SKIP, container_mail_class: ContainerMailClass::PRIORITY_MAIL, tracking_numbers: SKIP, weight_uom: WeightUom::LB, imcb_container_type: SKIP) ⇒ CreateOdContainerRequest
constructor
A new instance of CreateOdContainerRequest.
-
#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(origin_address:, destination_zip_code:, enclosed_mail_class:, mailer_name:, processing_category:, destination_entry_facility_type:, mailing_date:, weight:, impb_container_type:, image_info: SKIP, sender_address: SKIP, return_address: SKIP, container_mail_class: ContainerMailClass::PRIORITY_MAIL, tracking_numbers: SKIP, weight_uom: WeightUom::LB, imcb_container_type: SKIP) ⇒ CreateOdContainerRequest
Returns a new instance of CreateOdContainerRequest.
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 |
# File 'lib/usps_api/models/create_od_container_request.rb', line 142 def initialize(origin_address:, destination_zip_code:, enclosed_mail_class:, mailer_name:, processing_category:, destination_entry_facility_type:, mailing_date:, weight:, impb_container_type:, image_info: SKIP, sender_address: SKIP, return_address: SKIP, container_mail_class: ContainerMailClass::PRIORITY_MAIL, tracking_numbers: SKIP, weight_uom: WeightUom::LB, imcb_container_type: SKIP) @image_info = image_info unless image_info == SKIP @origin_address = origin_address @sender_address = sender_address unless sender_address == SKIP @return_address = return_address unless return_address == SKIP @destination_zip_code = destination_zip_code @container_mail_class = container_mail_class unless container_mail_class == SKIP @enclosed_mail_class = enclosed_mail_class @mailer_name = mailer_name @processing_category = processing_category @destination_entry_facility_type = destination_entry_facility_type @mailing_date = mailing_date @tracking_numbers = tracking_numbers unless tracking_numbers == SKIP @weight_uom = weight_uom unless weight_uom == SKIP @weight = weight @impb_container_type = impb_container_type @imcb_container_type = imcb_container_type unless imcb_container_type == SKIP end |
Instance Attribute Details
#container_mail_class ⇒ ContainerMailClass
Mail class for the Open and Distribute container
43 44 45 |
# File 'lib/usps_api/models/create_od_container_request.rb', line 43 def container_mail_class @container_mail_class end |
#destination_entry_facility_type ⇒ DestinationEntryFacilityType3
The facility type where the container will be sent to. Note:
-
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.
66 67 68 |
# File 'lib/usps_api/models/create_od_container_request.rb', line 66 def destination_entry_facility_type @destination_entry_facility_type end |
#destination_zip_code ⇒ String
A 5-digit ZIP Code serviced by the ‘destinationEntryFacilityType` the container is being sent to. The destination ZIP Code is used for calculating pricing and identifying the Destination Entry Facility.
39 40 41 |
# File 'lib/usps_api/models/create_od_container_request.rb', line 39 def destination_zip_code @destination_zip_code end |
#enclosed_mail_class ⇒ EnclosedMailClass
The mail class of the items enclosed in the container.
47 48 49 |
# File 'lib/usps_api/models/create_od_container_request.rb', line 47 def enclosed_mail_class @enclosed_mail_class end |
#image_info ⇒ PmodImageInfo
Additional details used to determine how to generate the label image.
14 15 16 |
# File 'lib/usps_api/models/create_od_container_request.rb', line 14 def image_info @image_info end |
#imcb_container_type ⇒ ImcbContainerType
IMcb Container Type requested. When not provided, this will take the value of impbContainerType by default. This field is not applicable when impbContainerType is ‘OPEN_DISTRIBUTE_PALLET’.
99 100 101 |
# File 'lib/usps_api/models/create_od_container_request.rb', line 99 def imcb_container_type @imcb_container_type end |
#impb_container_type ⇒ ImpbContainerType
IMpb Container Type requested.
91 92 93 |
# File 'lib/usps_api/models/create_od_container_request.rb', line 91 def impb_container_type @impb_container_type end |
#mailer_name ⇒ String
Name of the business who is shipping the container.
51 52 53 |
# File 'lib/usps_api/models/create_od_container_request.rb', line 51 def mailer_name @mailer_name end |
#mailing_date ⇒ Object
The mailing date for when the container will be shipped. The mailing date may be today plus 0 to 7 days in advance.
71 72 73 |
# File 'lib/usps_api/models/create_od_container_request.rb', line 71 def mailing_date @mailing_date end |
#origin_address ⇒ PmodDomesticAddress
The address of the Business Mail Entry Unit (BMEU) or authorized acceptance location facility where the Open and Distribute container is being entered. The origin ZIP Code is used for calculating pricing.
20 21 22 |
# File 'lib/usps_api/models/create_od_container_request.rb', line 20 def origin_address @origin_address end |
#processing_category ⇒ ProcessingCategory7
The type of packages that will be nested to the container. ‘MIXED` is only available for `DESTINATION_DELIVERY_UNIT` containers.
56 57 58 |
# File 'lib/usps_api/models/create_od_container_request.rb', line 56 def processing_category @processing_category end |
#return_address ⇒ PmodDomesticLabelAddress
Uses for: The address of the business where the Open and Distribute container should be returned to if it is deemed undeliverable or returned to sender. This address will be printed in the return address block of the label. The First and Last Name or Firm Name are always required.
33 34 35 |
# File 'lib/usps_api/models/create_od_container_request.rb', line 33 def return_address @return_address end |
#sender_address ⇒ PmodDomesticLabelAddress
Uses for: The address of the business entering the Open and Distribute container.
25 26 27 |
# File 'lib/usps_api/models/create_od_container_request.rb', line 25 def sender_address @sender_address end |
#tracking_numbers ⇒ Array[String]
The mailing date for when the container will be shipped. The mailing date may be today plus 0 to 7 days in advance.
76 77 78 |
# File 'lib/usps_api/models/create_od_container_request.rb', line 76 def tracking_numbers @tracking_numbers end |
#weight ⇒ Float
The package weight, in weightUOM (Unit Of Measure). Containers must weigh 70 pounds (1120 ounces) or less when impbContainerType is not ‘OPEN_DISTRIBUTE_PALLET.’
87 88 89 |
# File 'lib/usps_api/models/create_od_container_request.rb', line 87 def weight @weight end |
#weight_uom ⇒ WeightUom
Weight Unit of Measure
* lb - Pounds
81 82 83 |
# File 'lib/usps_api/models/create_od_container_request.rb', line 81 def weight_uom @weight_uom end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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 |
# File 'lib/usps_api/models/create_od_container_request.rb', line 169 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. origin_address = PmodDomesticAddress.from_hash(hash['originAddress']) if hash['originAddress'] destination_zip_code = hash.key?('destinationZIPCode') ? hash['destinationZIPCode'] : nil enclosed_mail_class = hash.key?('enclosedMailClass') ? hash['enclosedMailClass'] : nil mailer_name = hash.key?('mailerName') ? hash['mailerName'] : 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(:CreateOdContainerRequestMailingDate), hash['mailingDate'] ) : nil weight = hash.key?('weight') ? hash['weight'] : nil impb_container_type = hash.key?('impbContainerType') ? hash['impbContainerType'] : nil image_info = PmodImageInfo.from_hash(hash['imageInfo']) if hash['imageInfo'] sender_address = PmodDomesticLabelAddress.from_hash(hash['senderAddress']) if hash['senderAddress'] return_address = PmodDomesticLabelAddress.from_hash(hash['returnAddress']) if hash['returnAddress'] container_mail_class = hash['containerMailClass'] ||= ContainerMailClass::PRIORITY_MAIL tracking_numbers = hash.key?('trackingNumbers') ? hash['trackingNumbers'] : SKIP weight_uom = hash['weightUOM'] ||= WeightUom::LB imcb_container_type = hash.key?('imcbContainerType') ? hash['imcbContainerType'] : SKIP # Create object from extracted values. CreateOdContainerRequest.new(origin_address: origin_address, destination_zip_code: destination_zip_code, enclosed_mail_class: enclosed_mail_class, mailer_name: mailer_name, processing_category: processing_category, destination_entry_facility_type: destination_entry_facility_type, mailing_date: mailing_date, weight: weight, impb_container_type: impb_container_type, image_info: image_info, sender_address: sender_address, return_address: return_address, container_mail_class: container_mail_class, tracking_numbers: tracking_numbers, weight_uom: weight_uom, imcb_container_type: imcb_container_type) end |
.names ⇒ Object
A mapping from model property names to API property names.
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
# File 'lib/usps_api/models/create_od_container_request.rb', line 102 def self.names @_hash = {} if @_hash.nil? @_hash['image_info'] = 'imageInfo' @_hash['origin_address'] = 'originAddress' @_hash['sender_address'] = 'senderAddress' @_hash['return_address'] = 'returnAddress' @_hash['destination_zip_code'] = 'destinationZIPCode' @_hash['container_mail_class'] = 'containerMailClass' @_hash['enclosed_mail_class'] = 'enclosedMailClass' @_hash['mailer_name'] = 'mailerName' @_hash['processing_category'] = 'processingCategory' @_hash['destination_entry_facility_type'] = 'destinationEntryFacilityType' @_hash['mailing_date'] = 'mailingDate' @_hash['tracking_numbers'] = 'trackingNumbers' @_hash['weight_uom'] = 'weightUOM' @_hash['weight'] = 'weight' @_hash['impb_container_type'] = 'impbContainerType' @_hash['imcb_container_type'] = 'imcbContainerType' @_hash end |
.nullables ⇒ Object
An array for nullable fields
138 139 140 |
# File 'lib/usps_api/models/create_od_container_request.rb', line 138 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
125 126 127 128 129 130 131 132 133 134 135 |
# File 'lib/usps_api/models/create_od_container_request.rb', line 125 def self.optionals %w[ image_info sender_address return_address container_mail_class tracking_numbers weight_uom imcb_container_type ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 |
# File 'lib/usps_api/models/create_od_container_request.rb', line 230 def self.validate(value) if value.instance_of? self return ( APIHelper.valid_type?(value.origin_address, ->(val) { PmodDomesticAddress.validate(val) }, is_model_hash: true) and APIHelper.valid_type?(value.destination_zip_code, ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value.enclosed_mail_class, ->(val) { EnclosedMailClass.validate(val) }) and APIHelper.valid_type?(value.mailer_name, ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value.processing_category, ->(val) { ProcessingCategory7.validate(val) }) and APIHelper.valid_type?(value.destination_entry_facility_type, ->(val) { DestinationEntryFacilityType3.validate(val) }) and UnionTypeLookUp.get(:CreateOdContainerRequestMailingDate) .validate(value.mailing_date) and APIHelper.valid_type?(value.weight, ->(val) { val.instance_of? Float }) and APIHelper.valid_type?(value.impb_container_type, ->(val) { ImpbContainerType.validate(val) }) ) end return false unless value.instance_of? Hash ( APIHelper.valid_type?(value['originAddress'], ->(val) { PmodDomesticAddress.validate(val) }, is_model_hash: true) and APIHelper.valid_type?(value['destinationZIPCode'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['enclosedMailClass'], ->(val) { EnclosedMailClass.validate(val) }) and APIHelper.valid_type?(value['mailerName'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['processingCategory'], ->(val) { ProcessingCategory7.validate(val) }) and APIHelper.valid_type?(value['destinationEntryFacilityType'], ->(val) { DestinationEntryFacilityType3.validate(val) }) and UnionTypeLookUp.get(:CreateOdContainerRequestMailingDate) .validate(value['mailingDate']) and APIHelper.valid_type?(value['weight'], ->(val) { val.instance_of? Float }) and APIHelper.valid_type?(value['impbContainerType'], ->(val) { ImpbContainerType.validate(val) }) ) end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
295 296 297 298 299 300 301 302 303 304 305 306 307 |
# File 'lib/usps_api/models/create_od_container_request.rb', line 295 def inspect class_name = self.class.name.split('::').last "<#{class_name} image_info: #{@image_info.inspect}, origin_address:"\ " #{@origin_address.inspect}, sender_address: #{@sender_address.inspect}, return_address:"\ " #{@return_address.inspect}, destination_zip_code: #{@destination_zip_code.inspect},"\ " container_mail_class: #{@container_mail_class.inspect}, enclosed_mail_class:"\ " #{@enclosed_mail_class.inspect}, mailer_name: #{@mailer_name.inspect},"\ " processing_category: #{@processing_category.inspect}, destination_entry_facility_type:"\ " #{@destination_entry_facility_type.inspect}, mailing_date: #{@mailing_date.inspect},"\ " tracking_numbers: #{@tracking_numbers.inspect}, weight_uom: #{@weight_uom.inspect},"\ " weight: #{@weight.inspect}, impb_container_type: #{@impb_container_type.inspect},"\ " imcb_container_type: #{@imcb_container_type.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
281 282 283 284 285 286 287 288 289 290 291 292 |
# File 'lib/usps_api/models/create_od_container_request.rb', line 281 def to_s class_name = self.class.name.split('::').last "<#{class_name} image_info: #{@image_info}, origin_address: #{@origin_address},"\ " sender_address: #{@sender_address}, return_address: #{@return_address},"\ " destination_zip_code: #{@destination_zip_code}, container_mail_class:"\ " #{@container_mail_class}, enclosed_mail_class: #{@enclosed_mail_class}, mailer_name:"\ " #{@mailer_name}, processing_category: #{@processing_category},"\ " destination_entry_facility_type: #{@destination_entry_facility_type}, mailing_date:"\ " #{@mailing_date}, tracking_numbers: #{@tracking_numbers}, weight_uom: #{@weight_uom},"\ " weight: #{@weight}, impb_container_type: #{@impb_container_type}, imcb_container_type:"\ " #{@imcb_container_type}>" end |
#to_union_type_mailing_date ⇒ Object
222 223 224 225 226 |
# File 'lib/usps_api/models/create_od_container_request.rb', line 222 def to_union_type_mailing_date UnionTypeLookUp.get(:CreateOdContainerRequestMailingDate) .validate(mailing_date) .serialize(mailing_date) end |