Class: UspsApi::IndiciaMetadata11
- Defined in:
- lib/usps_api/models/indicia_metadata11.rb
Overview
Metadata for indicia
Instance Attribute Summary collapse
-
#banner_text ⇒ String
Banner text printed on the label.
-
#construct_code ⇒ String
The barcode construct code associated with the tracking number.
-
#extra_services ⇒ Array[LabelsExtraServiceResponse]
Extra services requested on the mailpiece.
-
#fees ⇒ Array[Fee2]
Fees associated to the mailpiece.
-
#imb ⇒ String
Human-readable form of the intelligent mail barcode (IMB) value.
-
#indicia_imi ⇒ String
Base64 encoded string of the binary data used to create the Intelligent Mail Indicia (IMI) Data Matrix.
-
#mail_class ⇒ MailClass22
The mail class of the indicia.
-
#postage ⇒ Float
Amount of postage required, does not include insurance or other extra service fees.
-
#return_address ⇒ IndiciaImbDomesticLabelAddress
The ‘returnAddress` from the request that will be printed on the letter, flat, or card.
-
#service_type_code ⇒ String
The Service Type Code associated with the mailpiece.
-
#sku ⇒ String
Pricing SKU.
-
#to_address ⇒ IndiciaImbDomesticLabelAddress
The ‘toAddress` from the request that will be printed on the letter, flat, or card.
-
#total_price ⇒ Float
Total price of the indicia, including postage and any fees.
-
#tracking_number ⇒ String
Human-readable form of the intelligent mail package barcode (IMPB) value.
-
#weight ⇒ Float
The mailpiece 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.
Instance Method Summary collapse
-
#initialize(imb: SKIP, construct_code: SKIP, tracking_number: SKIP, sku: SKIP, total_price: SKIP, postage: SKIP, fees: SKIP, weight: SKIP, extra_services: SKIP, service_type_code: SKIP, banner_text: SKIP, mail_class: SKIP, to_address: SKIP, return_address: SKIP, indicia_imi: SKIP, additional_properties: nil) ⇒ IndiciaMetadata11
constructor
A new instance of IndiciaMetadata11.
-
#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(imb: SKIP, construct_code: SKIP, tracking_number: SKIP, sku: SKIP, total_price: SKIP, postage: SKIP, fees: SKIP, weight: SKIP, extra_services: SKIP, service_type_code: SKIP, banner_text: SKIP, mail_class: SKIP, to_address: SKIP, return_address: SKIP, indicia_imi: SKIP, additional_properties: nil) ⇒ IndiciaMetadata11
Returns a new instance of IndiciaMetadata11.
132 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 |
# File 'lib/usps_api/models/indicia_metadata11.rb', line 132 def initialize(imb: SKIP, construct_code: SKIP, tracking_number: SKIP, sku: SKIP, total_price: SKIP, postage: SKIP, fees: SKIP, weight: SKIP, extra_services: SKIP, service_type_code: SKIP, banner_text: SKIP, mail_class: SKIP, to_address: SKIP, return_address: SKIP, indicia_imi: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @imb = imb unless imb == SKIP @construct_code = construct_code unless construct_code == SKIP @tracking_number = tracking_number unless tracking_number == SKIP @sku = sku unless sku == SKIP @total_price = total_price unless total_price == SKIP @postage = postage unless postage == SKIP @fees = fees unless fees == SKIP @weight = weight unless weight == SKIP @extra_services = extra_services unless extra_services == SKIP @service_type_code = service_type_code unless service_type_code == SKIP @banner_text = unless == SKIP @mail_class = mail_class unless mail_class == SKIP @to_address = to_address unless to_address == SKIP @return_address = return_address unless return_address == SKIP @indicia_imi = indicia_imi unless indicia_imi == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#banner_text ⇒ String
Banner text printed on the label.
64 65 66 |
# File 'lib/usps_api/models/indicia_metadata11.rb', line 64 def @banner_text end |
#construct_code ⇒ String
The barcode construct code associated with the tracking number. Notes:
- This field will be absent from the response if the request does not
include extra services.
21 22 23 |
# File 'lib/usps_api/models/indicia_metadata11.rb', line 21 def construct_code @construct_code end |
#extra_services ⇒ Array[LabelsExtraServiceResponse]
Extra services requested on the mailpiece.
53 54 55 |
# File 'lib/usps_api/models/indicia_metadata11.rb', line 53 def extra_services @extra_services end |
#fees ⇒ Array[Fee2]
Fees associated to the mailpiece.
45 46 47 |
# File 'lib/usps_api/models/indicia_metadata11.rb', line 45 def fees @fees end |
#imb ⇒ String
Human-readable form of the intelligent mail barcode (IMB) value.
14 15 16 |
# File 'lib/usps_api/models/indicia_metadata11.rb', line 14 def imb @imb end |
#indicia_imi ⇒ String
Base64 encoded string of the binary data used to create the Intelligent Mail Indicia (IMI) Data Matrix.
83 84 85 |
# File 'lib/usps_api/models/indicia_metadata11.rb', line 83 def indicia_imi @indicia_imi end |
#mail_class ⇒ MailClass22
The mail class of the indicia.
68 69 70 |
# File 'lib/usps_api/models/indicia_metadata11.rb', line 68 def mail_class @mail_class end |
#postage ⇒ Float
Amount of postage required, does not include insurance or other extra service fees.
41 42 43 |
# File 'lib/usps_api/models/indicia_metadata11.rb', line 41 def postage @postage end |
#return_address ⇒ IndiciaImbDomesticLabelAddress
The ‘returnAddress` from the request that will be printed on the letter, flat, or card.
78 79 80 |
# File 'lib/usps_api/models/indicia_metadata11.rb', line 78 def return_address @return_address end |
#service_type_code ⇒ String
The Service Type Code associated with the mailpiece. A list of Service Type Codes can be found at: [postalpro.usps.com/IMPB_Service_Type_Codes](https://postalpro.usp s.com/IMPB_Service_Type_Codes)
60 61 62 |
# File 'lib/usps_api/models/indicia_metadata11.rb', line 60 def service_type_code @service_type_code end |
#sku ⇒ String
Pricing SKU
32 33 34 |
# File 'lib/usps_api/models/indicia_metadata11.rb', line 32 def sku @sku end |
#to_address ⇒ IndiciaImbDomesticLabelAddress
The ‘toAddress` from the request that will be printed on the letter, flat, or card.
73 74 75 |
# File 'lib/usps_api/models/indicia_metadata11.rb', line 73 def to_address @to_address end |
#total_price ⇒ Float
Total price of the indicia, including postage and any fees.
36 37 38 |
# File 'lib/usps_api/models/indicia_metadata11.rb', line 36 def total_price @total_price end |
#tracking_number ⇒ String
Human-readable form of the intelligent mail package barcode (IMPB) value. Notes:
- This field will be absent from the response if the request does not
include extra services.
28 29 30 |
# File 'lib/usps_api/models/indicia_metadata11.rb', line 28 def tracking_number @tracking_number end |
#weight ⇒ Float
The mailpiece weight, in ounces.
49 50 51 |
# File 'lib/usps_api/models/indicia_metadata11.rb', line 49 def weight @weight end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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 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 221 222 223 224 225 226 |
# File 'lib/usps_api/models/indicia_metadata11.rb', line 160 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. imb = hash.key?('imb') ? hash['imb'] : SKIP construct_code = hash.key?('constructCode') ? hash['constructCode'] : SKIP tracking_number = hash.key?('trackingNumber') ? hash['trackingNumber'] : SKIP sku = hash.key?('SKU') ? hash['SKU'] : SKIP total_price = hash.key?('totalPrice') ? hash['totalPrice'] : SKIP postage = hash.key?('postage') ? hash['postage'] : SKIP # Parameter is an array, so we need to iterate through it fees = nil unless hash['fees'].nil? fees = [] hash['fees'].each do |structure| fees << (Fee2.from_hash(structure) if structure) end end fees = SKIP unless hash.key?('fees') weight = hash.key?('weight') ? hash['weight'] : SKIP # Parameter is an array, so we need to iterate through it extra_services = nil unless hash['extraServices'].nil? extra_services = [] hash['extraServices'].each do |structure| extra_services << (LabelsExtraServiceResponse.from_hash(structure) if structure) end end extra_services = SKIP unless hash.key?('extraServices') service_type_code = hash.key?('serviceTypeCode') ? hash['serviceTypeCode'] : SKIP = hash.key?('bannerText') ? hash['bannerText'] : SKIP mail_class = hash.key?('mailClass') ? hash['mailClass'] : SKIP to_address = IndiciaImbDomesticLabelAddress.from_hash(hash['toAddress']) if hash['toAddress'] return_address = IndiciaImbDomesticLabelAddress.from_hash(hash['returnAddress']) if hash['returnAddress'] indicia_imi = hash.key?('indiciaIMI') ? hash['indiciaIMI'] : 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. IndiciaMetadata11.new(imb: imb, construct_code: construct_code, tracking_number: tracking_number, sku: sku, total_price: total_price, postage: postage, fees: fees, weight: weight, extra_services: extra_services, service_type_code: service_type_code, banner_text: , mail_class: mail_class, to_address: to_address, return_address: return_address, indicia_imi: indicia_imi, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/usps_api/models/indicia_metadata11.rb', line 86 def self.names @_hash = {} if @_hash.nil? @_hash['imb'] = 'imb' @_hash['construct_code'] = 'constructCode' @_hash['tracking_number'] = 'trackingNumber' @_hash['sku'] = 'SKU' @_hash['total_price'] = 'totalPrice' @_hash['postage'] = 'postage' @_hash['fees'] = 'fees' @_hash['weight'] = 'weight' @_hash['extra_services'] = 'extraServices' @_hash['service_type_code'] = 'serviceTypeCode' @_hash['banner_text'] = 'bannerText' @_hash['mail_class'] = 'mailClass' @_hash['to_address'] = 'toAddress' @_hash['return_address'] = 'returnAddress' @_hash['indicia_imi'] = 'indiciaIMI' @_hash end |
.nullables ⇒ Object
An array for nullable fields
128 129 130 |
# File 'lib/usps_api/models/indicia_metadata11.rb', line 128 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
# File 'lib/usps_api/models/indicia_metadata11.rb', line 107 def self.optionals %w[ imb construct_code tracking_number sku total_price postage fees weight extra_services service_type_code banner_text mail_class to_address return_address indicia_imi ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
240 241 242 243 244 245 246 247 248 249 250 |
# File 'lib/usps_api/models/indicia_metadata11.rb', line 240 def inspect class_name = self.class.name.split('::').last "<#{class_name} imb: #{@imb.inspect}, construct_code: #{@construct_code.inspect},"\ " tracking_number: #{@tracking_number.inspect}, sku: #{@sku.inspect}, total_price:"\ " #{@total_price.inspect}, postage: #{@postage.inspect}, fees: #{@fees.inspect}, weight:"\ " #{@weight.inspect}, extra_services: #{@extra_services.inspect}, service_type_code:"\ " #{@service_type_code.inspect}, banner_text: #{@banner_text.inspect}, mail_class:"\ " #{@mail_class.inspect}, to_address: #{@to_address.inspect}, return_address:"\ " #{@return_address.inspect}, indicia_imi: #{@indicia_imi.inspect}, additional_properties:"\ " #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
229 230 231 232 233 234 235 236 237 |
# File 'lib/usps_api/models/indicia_metadata11.rb', line 229 def to_s class_name = self.class.name.split('::').last "<#{class_name} imb: #{@imb}, construct_code: #{@construct_code}, tracking_number:"\ " #{@tracking_number}, sku: #{@sku}, total_price: #{@total_price}, postage: #{@postage},"\ " fees: #{@fees}, weight: #{@weight}, extra_services: #{@extra_services}, service_type_code:"\ " #{@service_type_code}, banner_text: #{@banner_text}, mail_class: #{@mail_class},"\ " to_address: #{@to_address}, return_address: #{@return_address}, indicia_imi:"\ " #{@indicia_imi}, additional_properties: #{@additional_properties}>" end |