Class: UspsApi::LabelsIndiciaRequestDescription1
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- UspsApi::LabelsIndiciaRequestDescription1
- Defined in:
- lib/usps_api/models/labels_indicia_request_description1.rb
Overview
Indicia intelligent mail barcode request description
Instance Attribute Summary collapse
-
#extra_services ⇒ Array[IndiciaExtraServiceCodes]
Extra Service Code requested for IMB letters, flats, and cards.
-
#height ⇒ Float
The letter/flat/card height in inches.
-
#imi_type ⇒ ImiType
The type of Intelligent Mail Indicia (IMI) to be generated.
-
#item_value ⇒ Float
Value of the letter, flat, or card in USD.
-
#length ⇒ Float
The letter/flat/card length in inches.
-
#mailing_date ⇒ Object
Mailing Date Indicia Options.
-
#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:, item_value: SKIP, extra_services: SKIP, non_machinable_indicators: SKIP, imi_type: ImiType::IMI_STD) ⇒ LabelsIndiciaRequestDescription1
constructor
A new instance of LabelsIndiciaRequestDescription1.
-
#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:, item_value: SKIP, extra_services: SKIP, non_machinable_indicators: SKIP, imi_type: ImiType::IMI_STD) ⇒ LabelsIndiciaRequestDescription1
Returns a new instance of LabelsIndiciaRequestDescription1.
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 |
# File 'lib/usps_api/models/labels_indicia_request_description1.rb', line 134 def initialize(processing_category:, weight:, mailing_date:, length:, height:, thickness:, item_value: SKIP, extra_services: SKIP, non_machinable_indicators: SKIP, imi_type: ImiType::IMI_STD) @processing_category = processing_category @weight = weight @mailing_date = mailing_date @length = length @height = height @thickness = thickness @item_value = item_value unless item_value == SKIP @extra_services = extra_services unless extra_services == SKIP unless non_machinable_indicators == SKIP @non_machinable_indicators = non_machinable_indicators end @imi_type = imi_type unless imi_type == SKIP end |
Instance Attribute Details
#extra_services ⇒ Array[IndiciaExtraServiceCodes]
Extra Service Code requested for IMB letters, flats, and cards.
* 910 - Certified Mail
* 911 - Certified Mail Restricted Delivery
* 930 - Insurance
* 934 - Insurance Restricted Delivery
* 940 - Registered Mail
* 941 - Registered Mail Restricted Delivery
* 955 - Return Receipt
* 957 - Return Receipt Electronic
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).
* 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).
90 91 92 |
# File 'lib/usps_api/models/labels_indicia_request_description1.rb', line 90 def extra_services @extra_services end |
#height ⇒ Float
The letter/flat/card height in inches. The height is the dimension perpendicular to the length.
58 59 60 |
# File 'lib/usps_api/models/labels_indicia_request_description1.rb', line 58 def height @height end |
#imi_type ⇒ ImiType
The type of Intelligent Mail Indicia (IMI) to be generated. The default option is ‘IMI_STD`. The `imiType` can be changed only when `imageInfo.labelType` is set to `IMI_DATA_ONLY`.
101 102 103 |
# File 'lib/usps_api/models/labels_indicia_request_description1.rb', line 101 def imi_type @imi_type end |
#item_value ⇒ Float
Value of the letter, flat, or card in USD. Note:
* This value must be set if extra service codes 930 (Insurance) or 934
(Insurance (Restricted Delivery)) are in the extraServices field.
70 71 72 |
# File 'lib/usps_api/models/labels_indicia_request_description1.rb', line 70 def item_value @item_value 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.
53 54 55 |
# File 'lib/usps_api/models/labels_indicia_request_description1.rb', line 53 def length @length end |
#mailing_date ⇒ Object
Mailing Date Indicia Options
47 48 49 |
# File 'lib/usps_api/models/labels_indicia_request_description1.rb', line 47 def mailing_date @mailing_date end |
#non_machinable_indicators ⇒ NonMachinableIndicators
Set of boolean indicators used to determine whether a letter qualifies as nonmachinable.
95 96 97 |
# File 'lib/usps_api/models/labels_indicia_request_description1.rb', line 95 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).
-
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).
-
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).
38 39 40 |
# File 'lib/usps_api/models/labels_indicia_request_description1.rb', line 38 def processing_category @processing_category end |
#thickness ⇒ Float
The letter/flat/card thickness in inches. The minimum dimension is always the thickness.
63 64 65 |
# File 'lib/usps_api/models/labels_indicia_request_description1.rb', line 63 def thickness @thickness end |
#weight ⇒ Float
The letter/flat/card weight, in ounces. The maximum weight of a letter and cards is 3.5 oz and the maximum weight of a flat is 13 oz.
43 44 45 |
# File 'lib/usps_api/models/labels_indicia_request_description1.rb', line 43 def weight @weight end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 |
# File 'lib/usps_api/models/labels_indicia_request_description1.rb', line 153 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(:LabelsIndiciaRequestDescription1MailingDate), hash['mailingDate'] ) : nil length = hash.key?('length') ? hash['length'] : nil height = hash.key?('height') ? hash['height'] : nil thickness = hash.key?('thickness') ? hash['thickness'] : nil item_value = hash.key?('itemValue') ? hash['itemValue'] : SKIP extra_services = hash.key?('extraServices') ? hash['extraServices'] : SKIP if hash['nonMachinableIndicators'] non_machinable_indicators = NonMachinableIndicators.from_hash(hash['nonMachinableIndicators']) end imi_type = hash['imiType'] ||= ImiType::IMI_STD # Create object from extracted values. LabelsIndiciaRequestDescription1.new(processing_category: processing_category, weight: weight, mailing_date: mailing_date, length: length, height: height, thickness: thickness, item_value: item_value, extra_services: extra_services, non_machinable_indicators: non_machinable_indicators, imi_type: imi_type) end |
.names ⇒ Object
A mapping from model property names to API property names.
104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
# File 'lib/usps_api/models/labels_indicia_request_description1.rb', line 104 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['item_value'] = 'itemValue' @_hash['extra_services'] = 'extraServices' @_hash['non_machinable_indicators'] = 'nonMachinableIndicators' @_hash['imi_type'] = 'imiType' @_hash end |
.nullables ⇒ Object
An array for nullable fields
130 131 132 |
# File 'lib/usps_api/models/labels_indicia_request_description1.rb', line 130 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
120 121 122 123 124 125 126 127 |
# File 'lib/usps_api/models/labels_indicia_request_description1.rb', line 120 def self.optionals %w[ item_value extra_services non_machinable_indicators imi_type ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
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 221 222 223 224 225 226 227 228 |
# File 'lib/usps_api/models/labels_indicia_request_description1.rb', line 194 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(:LabelsIndiciaRequestDescription1MailingDate) .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 }) ) 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(:LabelsIndiciaRequestDescription1MailingDate) .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 }) ) end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
240 241 242 243 244 245 246 247 248 |
# File 'lib/usps_api/models/labels_indicia_request_description1.rb', line 240 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}, item_value:"\ " #{@item_value.inspect}, extra_services: #{@extra_services.inspect},"\ " non_machinable_indicators: #{@non_machinable_indicators.inspect}, imi_type:"\ " #{@imi_type.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
231 232 233 234 235 236 237 |
# File 'lib/usps_api/models/labels_indicia_request_description1.rb', line 231 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}, item_value: #{@item_value}, extra_services: #{@extra_services},"\ " non_machinable_indicators: #{@non_machinable_indicators}, imi_type: #{@imi_type}>" end |
#to_union_type_mailing_date ⇒ Object
186 187 188 189 190 |
# File 'lib/usps_api/models/labels_indicia_request_description1.rb', line 186 def to_union_type_mailing_date UnionTypeLookUp.get(:LabelsIndiciaRequestDescription1MailingDate) .validate(mailing_date) .serialize(mailing_date) end |