Class: UspsApi::InternationalLabelsIndiciaRequestDescription
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- UspsApi::InternationalLabelsIndiciaRequestDescription
- Defined in:
- lib/usps_api/models/international_labels_indicia_request_description.rb
Overview
The ‘IndiciaRequestDescription` object defines the physical dimensions, mailing date, processing category, and weight required for processing a First-Class Mail International letter, flat, or card.
Instance Attribute Summary collapse
-
#destination_country_code ⇒ String
The 2-digit country code of the destination.
-
#height ⇒ Float
The letter/flat/card height in inches.
-
#length ⇒ Float
The letter/flat/card length in inches.
-
#mailing_date ⇒ Object
The date or date and time the letter, flat, or card will be mailed.
-
#non_machinable_indicators ⇒ NonMachinableIndicators
Set of boolean indicators used to determine whether a letter qualifies as nonmachinable.
-
#processing_category ⇒ ProcessingCategory21
-
LETTERS To be eligible for mailing at the price for letters, a piece must be: * Rectangular * At least 3-1/2 inches high x 5 inches long x 0.007 inch thick.
-
-
#thickness ⇒ Float
The letter/flat/card thickness in inches.
-
#weight ⇒ Float
The letter/flat/card weight, in ounces.
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(processing_category:, weight:, mailing_date:, length:, height:, thickness:, destination_country_code:, non_machinable_indicators: SKIP, additional_properties: nil) ⇒ InternationalLabelsIndiciaRequestDescription
constructor
A new instance of InternationalLabelsIndiciaRequestDescription.
-
#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(processing_category:, weight:, mailing_date:, length:, height:, thickness:, destination_country_code:, non_machinable_indicators: SKIP, additional_properties: nil) ⇒ InternationalLabelsIndiciaRequestDescription
Returns a new instance of InternationalLabelsIndiciaRequestDescription.
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 |
# File 'lib/usps_api/models/international_labels_indicia_request_description.rb', line 112 def initialize(processing_category:, weight:, mailing_date:, length:, height:, thickness:, destination_country_code:, non_machinable_indicators: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @processing_category = processing_category @weight = weight @mailing_date = mailing_date @length = length @height = height @thickness = thickness @destination_country_code = destination_country_code unless non_machinable_indicators == SKIP @non_machinable_indicators = non_machinable_indicators end @additional_properties = additional_properties end |
Instance Attribute Details
#destination_country_code ⇒ String
The 2-digit country code of the destination.
79 80 81 |
# File 'lib/usps_api/models/international_labels_indicia_request_description.rb', line 79 def destination_country_code @destination_country_code end |
#height ⇒ Float
The letter/flat/card height in inches. The height is the dimension perpendicular to the length.
70 71 72 |
# File 'lib/usps_api/models/international_labels_indicia_request_description.rb', line 70 def height @height end |
#length ⇒ Float
The letter/flat/card length in inches. For ‘LETTERS` and `CARDS` the length is the dimension parallel to the delivery address as read. For `FLATS` the length is the longest dimension.
65 66 67 |
# File 'lib/usps_api/models/international_labels_indicia_request_description.rb', line 65 def length @length end |
#mailing_date ⇒ Object
The date or date and time the letter, flat, or card will be mailed. Accepts either a date-only format or a date-time format. The mailing date may be today plus 0 to 7 days in advance.
59 60 61 |
# File 'lib/usps_api/models/international_labels_indicia_request_description.rb', line 59 def mailing_date @mailing_date end |
#non_machinable_indicators ⇒ NonMachinableIndicators
Set of boolean indicators used to determine whether a letter qualifies as nonmachinable.
84 85 86 |
# File 'lib/usps_api/models/international_labels_indicia_request_description.rb', line 84 def non_machinable_indicators @non_machinable_indicators end |
#processing_category ⇒ ProcessingCategory21
-
LETTERS
To be eligible for mailing at the price for letters, a piece must be:
* Rectangular * At least 3-1/2 inches high x 5 inches long x 0.007 inch thick. * No more than 6-1/8 inches high x 11-1/2 inches long x 1/4 inch
thick.
For additional information on letters, please refer to the [Postal
Explorer](pe.usps.com/businessmail101?ViewName=Letters) and [International Mail Manual](pe.usps.com/text/imm/immc2_017.htm#:~:text=241.21%20Physic al%20Standards%20%E2%80%94%20Letters).
-
FLATS The Postal Service uses the word “flats” to refer to large envelopes,
newsletters, and magazines. The words large envelopes and flats are used interchangeably. Whatever you call them, flats must:
* Have one dimension that is greater than 6-1/8 inches high OR 11-½
inches long OR ¼ inch thick.
* Be no more than 12 inches high x 15 inches long x ¾ inch thick.
For additional information on flats, please refer to the [Postal
Explorer](pe.usps.com/businessmail101?ViewName=Flats) and the [International Mail Manual](pe.usps.com/text/imm/immc2_017.htm#:~:text=241.23%20Physic al%20Standards%20%E2%80%94%20Large%20Envelopes%20(Flats)).
-
CARDS To be eligible for mailing at the price for postcards, a piece must be:
* Rectangular * At least 3-1/2 inches high x 5 inches long x 0.007 inch thick. * No more than 4-1/4 inches high x 6 inches long x 0.016 inch thick.For additional information on postcards, please refer to the [Postal
Explorer](pe.usps.com/businessmail101?ViewName=Cards) and the [International Mail Manual](pe.usps.com/text/imm/immc2_017.htm#:~:text=241.22%20Physic al%20Standards%20%E2%80%94%20Cards).
48 49 50 |
# File 'lib/usps_api/models/international_labels_indicia_request_description.rb', line 48 def processing_category @processing_category end |
#thickness ⇒ Float
The letter/flat/card thickness in inches. The minimum dimension is always the thickness.
75 76 77 |
# File 'lib/usps_api/models/international_labels_indicia_request_description.rb', line 75 def thickness @thickness end |
#weight ⇒ Float
The letter/flat/card weight, in ounces. The maximum weight of a letter or card is 3.5 oz and the maximum weight of a flat is 13 oz.
53 54 55 |
# File 'lib/usps_api/models/international_labels_indicia_request_description.rb', line 53 def weight @weight end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 |
# File 'lib/usps_api/models/international_labels_indicia_request_description.rb', line 133 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. processing_category = hash.key?('processingCategory') ? hash['processingCategory'] : nil weight = hash.key?('weight') ? hash['weight'] : nil mailing_date = hash.key?('mailingDate') ? APIHelper.deserialize_union_type( UnionTypeLookUp.get(:InternationalLabelsIndiciaRequestDescriptionMailingDate), hash['mailingDate'] ) : nil length = hash.key?('length') ? hash['length'] : nil height = hash.key?('height') ? hash['height'] : nil thickness = hash.key?('thickness') ? hash['thickness'] : nil destination_country_code = hash.key?('destinationCountryCode') ? hash['destinationCountryCode'] : nil if hash['nonMachinableIndicators'] non_machinable_indicators = NonMachinableIndicators.from_hash(hash['nonMachinableIndicators']) end # 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. InternationalLabelsIndiciaRequestDescription.new(processing_category: processing_category, weight: weight, mailing_date: mailing_date, length: length, height: height, thickness: thickness, destination_country_code: destination_country_code, non_machinable_indicators: non_machinable_indicators, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/usps_api/models/international_labels_indicia_request_description.rb', line 87 def self.names @_hash = {} if @_hash.nil? @_hash['processing_category'] = 'processingCategory' @_hash['weight'] = 'weight' @_hash['mailing_date'] = 'mailingDate' @_hash['length'] = 'length' @_hash['height'] = 'height' @_hash['thickness'] = 'thickness' @_hash['destination_country_code'] = 'destinationCountryCode' @_hash['non_machinable_indicators'] = 'nonMachinableIndicators' @_hash end |
.nullables ⇒ Object
An array for nullable fields
108 109 110 |
# File 'lib/usps_api/models/international_labels_indicia_request_description.rb', line 108 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
101 102 103 104 105 |
# File 'lib/usps_api/models/international_labels_indicia_request_description.rb', line 101 def self.optionals %w[ non_machinable_indicators ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
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 |
# File 'lib/usps_api/models/international_labels_indicia_request_description.rb', line 179 def self.validate(value) if value.instance_of? self return ( APIHelper.valid_type?(value.processing_category, ->(val) { ProcessingCategory21.validate(val) }) and APIHelper.valid_type?(value.weight, ->(val) { val.instance_of? Float }) and UnionTypeLookUp.get(:InternationalLabelsIndiciaRequestDescriptionMailingDate) .validate(value.mailing_date) 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.thickness, ->(val) { val.instance_of? Float }) and APIHelper.valid_type?(value.destination_country_code, ->(val) { val.instance_of? String }) ) end return false unless value.instance_of? Hash ( APIHelper.valid_type?(value['processingCategory'], ->(val) { ProcessingCategory21.validate(val) }) and APIHelper.valid_type?(value['weight'], ->(val) { val.instance_of? Float }) and UnionTypeLookUp.get(:InternationalLabelsIndiciaRequestDescriptionMailingDate) .validate(value['mailingDate']) 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['thickness'], ->(val) { val.instance_of? Float }) and APIHelper.valid_type?(value['destinationCountryCode'], ->(val) { val.instance_of? String }) ) end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
230 231 232 233 234 235 236 237 |
# File 'lib/usps_api/models/international_labels_indicia_request_description.rb', line 230 def inspect class_name = self.class.name.split('::').last "<#{class_name} processing_category: #{@processing_category.inspect}, weight:"\ " #{@weight.inspect}, mailing_date: #{@mailing_date.inspect}, length: #{@length.inspect},"\ " height: #{@height.inspect}, thickness: #{@thickness.inspect}, destination_country_code:"\ " #{@destination_country_code.inspect}, non_machinable_indicators:"\ " #{@non_machinable_indicators.inspect}, additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
220 221 222 223 224 225 226 227 |
# File 'lib/usps_api/models/international_labels_indicia_request_description.rb', line 220 def to_s class_name = self.class.name.split('::').last "<#{class_name} processing_category: #{@processing_category}, weight: #{@weight},"\ " mailing_date: #{@mailing_date}, length: #{@length}, height: #{@height}, thickness:"\ " #{@thickness}, destination_country_code: #{@destination_country_code},"\ " non_machinable_indicators: #{@non_machinable_indicators}, additional_properties:"\ " #{@additional_properties}>" end |
#to_union_type_mailing_date ⇒ Object
171 172 173 174 175 |
# File 'lib/usps_api/models/international_labels_indicia_request_description.rb', line 171 def to_union_type_mailing_date UnionTypeLookUp.get(:InternationalLabelsIndiciaRequestDescriptionMailingDate) .validate(mailing_date) .serialize(mailing_date) end |