Class: UspsApi::ImageInfo1
- Defined in:
- lib/usps_api/models/image_info1.rb
Overview
Image Information
Instance Attribute Summary collapse
-
#add_image_comments ⇒ TrueClass | FalseClass
Applicable only when ‘imageType` is `ZPL203DPI` or `ZPL300DPI`.
-
#add_zpl_comments ⇒ TrueClass | FalseClass
Note: This field has been deprecated in favor of ‘addImageComments`.
-
#branding_image_format ⇒ BrandingImageFormat
The format of label branding images to be shown on the generated label image.
-
#branding_image_uui_ds ⇒ Array[String]
The UUIDs associated with custom images uploaded in the Logo Branding endpoint: /branding Note: * These UUIDs must have been created with the same Payment Authorization Label Owner CRID in use when creating the label * When using ‘ONE_SQUARE` or `RECTANGLE` the brandingImageUUIDs list should include only one imageUUID string.
-
#image_type ⇒ ImageType3
The type of label image requested.
-
#include_label_broker_pdf ⇒ TrueClass | FalseClass
Applicable only when ‘imageType` is `LABEL_BROKER`.
-
#label_type ⇒ LabelType3
Ability to select the label image size.
-
#package_number ⇒ Integer
The package number in a series such as 1 of 3, 2 of 3, etc.
-
#receipt_option ⇒ ReceiptOption1
Label & Receipt print out options: Enter ‘SAME_PAGE` to print the Label and the Receipt on a single page.
-
#return_label ⇒ TrueClass | FalseClass
Indicates if a pay on use returns label is requested along with the outbound label.
-
#ship_info ⇒ TrueClass | FalseClass
indicates if revenue protection information is printed on the label.
-
#suppress_mail_date ⇒ TrueClass | FalseClass
Indicates if the ‘mailingDate` is printed on the label.
-
#suppress_postage ⇒ TrueClass | FalseClass
Indicates if postage is printed on the label.
-
#total_packages ⇒ Integer
The total number of packages in a series such as 999.
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(image_type: ImageType3::PDF, label_type: LabelType3::ENUM_4X6LABEL, ship_info: SKIP, receipt_option: ReceiptOption1::SAME_PAGE, branding_image_format: BrandingImageFormat::NONE, branding_image_uui_ds:, include_label_broker_pdf: false, add_zpl_comments: false, add_image_comments: false, suppress_postage: true, suppress_mail_date: true, return_label: false, package_number: SKIP, total_packages: SKIP, additional_properties: nil) ⇒ ImageInfo1
constructor
A new instance of ImageInfo1.
-
#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(image_type: ImageType3::PDF, label_type: LabelType3::ENUM_4X6LABEL, ship_info: SKIP, receipt_option: ReceiptOption1::SAME_PAGE, branding_image_format: BrandingImageFormat::NONE, branding_image_uui_ds:, include_label_broker_pdf: false, add_zpl_comments: false, add_image_comments: false, suppress_postage: true, suppress_mail_date: true, return_label: false, package_number: SKIP, total_packages: SKIP, additional_properties: nil) ⇒ ImageInfo1
Returns a new instance of ImageInfo1.
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 |
# File 'lib/usps_api/models/image_info1.rb', line 245 def initialize(image_type: ImageType3::PDF, label_type: LabelType3::ENUM_4X6LABEL, ship_info: SKIP, receipt_option: ReceiptOption1::SAME_PAGE, branding_image_format: BrandingImageFormat::NONE, branding_image_uui_ds:, include_label_broker_pdf: false, add_zpl_comments: false, add_image_comments: false, suppress_postage: true, suppress_mail_date: true, return_label: false, package_number: SKIP, total_packages: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @image_type = image_type unless image_type == SKIP @label_type = label_type unless label_type == SKIP @ship_info = ship_info unless ship_info == SKIP @receipt_option = receipt_option unless receipt_option == SKIP @branding_image_format = branding_image_format unless branding_image_format == SKIP @branding_image_uui_ds = branding_image_uui_ds unless branding_image_uui_ds == SKIP @include_label_broker_pdf = include_label_broker_pdf unless include_label_broker_pdf == SKIP @add_zpl_comments = add_zpl_comments unless add_zpl_comments == SKIP @add_image_comments = add_image_comments unless add_image_comments == SKIP @suppress_postage = suppress_postage unless suppress_postage == SKIP @suppress_mail_date = suppress_mail_date unless suppress_mail_date == SKIP @return_label = return_label unless return_label == SKIP @package_number = package_number unless package_number == SKIP @total_packages = total_packages unless total_packages == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#add_image_comments ⇒ TrueClass | FalseClass
Applicable only when ‘imageType` is `ZPL203DPI` or `ZPL300DPI`. When `addImageComments` is `true`, comments will be visible within the ZPL text response to the user to denote different sections of their label. When `addImageComments` is `false`, no comments will be included in the ZPL text response. This will be ignored for any other `imageType`. Example of a ZPL comment: `^FX Start of label. 123e4567-e89b-12d3-a456-426614174000 ^FS`
145 146 147 |
# File 'lib/usps_api/models/image_info1.rb', line 145 def add_image_comments @add_image_comments end |
#add_zpl_comments ⇒ TrueClass | FalseClass
Note: This field has been deprecated in favor of ‘addImageComments`. Applicable only when `imageType` is `ZPL203DPI` or `ZPL300DPI`. When `addZPLComments` is `true`, comments will be visible within the ZPL text response to the user to denote different sections of their label. When `addZPLComments` is `false`, no comments will be included in the ZPL text response. This will be ignored for any other `imageType`. Example of a ZPL comment: `^FX Start of label. 123e4567-e89b-12d3-a456-426614174000 ^FS`
135 136 137 |
# File 'lib/usps_api/models/image_info1.rb', line 135 def add_zpl_comments @add_zpl_comments end |
#branding_image_format ⇒ BrandingImageFormat
The format of label branding images to be shown on the generated label image. Note:
-
Label branding images will not be shown on labels with customs forms.
-
Label branding images are not currently supported with an ‘imageType` of
‘ZPL203DPI` or `ZPL300DPI`.
-
Label branding images are not currently supported with a ‘labelType` of
‘4X4LABEL`.
-
When a ‘brandingImageFormat` is provided with a Destination Entry
Facility, the Drop-Off Location will not be displayed on the label.
-
When a ‘brandingImageFormat` of `RECTANGLE` is provided, Customer
Reference #3-#4 cannot be provided since they will not be shown.
-
When a ‘brandingImageFormat` of `ONE_SQUARE` or `TWO_SQUARES` is
provided, Customer Reference numbers will be shifted to the right to accommodate the image.
-
When a ‘brandingImageFormat` of `RECTANGLE` is provided, Customer
Reference numbers, package number, and total packages will not be displayed on the label.
-
A ‘brandingImageFormat` of `ONE_SQUARE` is currently only supported with
‘labelType` of `4X6LABEL`, `4X5LABEL`, `6X4LABEL`, and `2X7LABEL` for both outbound and return labels.
-
A ‘brandingImageFormat` of `TWO_SQUARES` is currently only supported
with ‘labelType` of `4X6LABEL`, `4X5LABEL`, and `6X4LABEL` for both outbound and return labels.
-
A ‘brandingImageFormat` of `RECTANGLE` is currently only supported with
‘labelType` of `4X6LABEL`, `4X5LABEL`, and `6X4LABEL` for outbound labels and `4X5LABEL` and `6X4LABEL` for return labels.
101 102 103 |
# File 'lib/usps_api/models/image_info1.rb', line 101 def branding_image_format @branding_image_format end |
#branding_image_uui_ds ⇒ Array[String]
The UUIDs associated with custom images uploaded in the Logo Branding endpoint: /branding Note:
-
These UUIDs must have been created with the same Payment Authorization
Label Owner CRID in use when creating the label
-
When using ‘ONE_SQUARE` or `RECTANGLE` the brandingImageUUIDs list
should include only one imageUUID string.
-
When using ‘TWO_SQUARES` the brandingImageUUIDs list should include only
two imageUUID strings.
113 114 115 |
# File 'lib/usps_api/models/image_info1.rb', line 113 def branding_image_uui_ds @branding_image_uui_ds end |
#image_type ⇒ ImageType3
The type of label image requested. If omitted then the default image type is PDF.
-
‘PDF’
-
‘TIFF’
-
‘JPG’
-
‘PNG’
-
‘GIF’
-
‘SVG’
-
‘ZPL203DPI’
-
‘ZPL300DPI’
-
‘LABEL_BROKER’ - Request a USPS QR code to allow your customers with no
access to a printer to print at participating Post Office Locations. All USPS API users and third-party integrators utilizing QR codes are subject to the [Label Broker terms and conditions](www.usps.com/terms-conditions/label-broker.htm). For more information please see the Label Broker guide available on [GitHub](github.com/USPS/api-examples/blob/main/USPS%20APIs%20Dome stic%20Labels%20API%20Documentation_2023_0901%20Published.pdf) (Note: Only supports labelType of ‘4X6LABEL’ or ‘6X4LABEL’ and receiptOption of ‘NONE’). A USPS Label Broker QR code image will be returned in the API response instead of a label image.
-
‘NONE’
Note:
-
Labels with customs forms only support formats of ‘PDF`, `TIFF`,
‘ZPL203DPI`, `ZPL300DPI`, `LABEL_BROKER`, and `NONE`.
-
Including Extra Service Code ‘415 - USPS Label Delivery` returns no
images and is equivalent to requesting ‘NONE`.
40 41 42 |
# File 'lib/usps_api/models/image_info1.rb', line 40 def image_type @image_type end |
#include_label_broker_pdf ⇒ TrueClass | FalseClass
Applicable only when ‘imageType` is `LABEL_BROKER`. When `includeLabelBrokerPDF` is `true`, two label images will be returned in the multi-part and vendor response as `labelBrokerQR` and `labelImage`. `labelBrokerQR` will contain the base64 PNG of the Label Broker QR Code and `labelImage` will contain the base64 PDF of the Label stored in Label Broker. When `includeLabelBrokerPDF` is `false`, one image will be returned in the multi-part and vendor response as `labelImage` as the base64 PNG of the Label Broker QR Code.
124 125 126 |
# File 'lib/usps_api/models/image_info1.rb', line 124 def include_label_broker_pdf @include_label_broker_pdf end |
#label_type ⇒ LabelType3
Ability to select the label image size. If omitted then the default label size is ‘4X6LABEL`. Note:
* Currently, customs forms only support `4X6LABEL`.
* The `labelType` of `2X7LABEL` is not supported with the `imageType` of
‘ZPL203DPI` or `ZPL300DPI`.
49 50 51 |
# File 'lib/usps_api/models/image_info1.rb', line 49 def label_type @label_type end |
#package_number ⇒ Integer
The package number in a series such as 1 of 3, 2 of 3, etc. If ‘totalPackages` is populated then `packageNumber` is required. `packageNumber` must be less than or equal to `totalPackages`. This feature is not supported on the 2x7 or 4x4 label format. Note:
-
When ‘packageNumber` is provided with a Destination Entry Facility, the
Drop-Off Location will not be displayed on the label.
191 192 193 |
# File 'lib/usps_api/models/image_info1.rb', line 191 def package_number @package_number end |
#receipt_option ⇒ ReceiptOption1
Label & Receipt print out options: Enter ‘SAME_PAGE` to print the Label and the Receipt on a single page. Enter `SEPARATE_PAGE` to print the Label and the Receipt on separate pages. Enter `NONE` to print the Label only and no Receipt. Note:
* The `labelType` of `4X4LABEL` or `6X4LABEL` with the image `imageType`
of ‘ZPL203DPI` or `ZPL300DPI` does not support a `receiptOption` of `SEPARATE_PAGE`.
* When `imageType` is `ZPL203DPI` or `ZPL300DPI`, a `receiptOption` of
‘SAME_PAGE` is not supported.
* When `imageType` is `ZPL203DPI` or `ZPL300DPI` and `receiptOption` is
‘SEPARATE_PAGE`, the receipt will be returned as an additional label segment within the single ZPL payload in `labelImage`. In this case, `receiptImage` will not be populated.
71 72 73 |
# File 'lib/usps_api/models/image_info1.rb', line 71 def receipt_option @receipt_option end |
#return_label ⇒ TrueClass | FalseClass
Indicates if a pay on use returns label is requested along with the outbound label. If omitted then the request will be defaulted to false. The mail class of the generated return label will be based off of the mail class provided in ‘packageDescription.mailClass`.
-
Priority Mail Express Return Service label will be generated with
‘packageDescription.mailClass` of `PRIORITY_MAIL_EXPRESS`.
-
Priority Mail Return Service label will be generated with
‘packageDescription.mailClass` of `PRIORITY_MAIL`.
-
USPS Ground Advantage Return Service label will be generated with all
other ‘packageDescription.mailClass` enumerations. Note:
* An `imageType` value of `LABEL_BROKER` is currently not supported when
‘returnLabel` is set to true.
* A `packageDescription.mailClass` value of `USPS_CONNECT_MAIL` is
currently not supported when ‘returnLabel` is set to true.
* `returnLabel` cannot be set to `true` when generating customs forms.
* `returnLabel` is not available when Extra Service Code `415 - USPS
Label Delivery` is used.
181 182 183 |
# File 'lib/usps_api/models/image_info1.rb', line 181 def return_label @return_label end |
#ship_info ⇒ TrueClass | FalseClass
indicates if revenue protection information is printed on the label. (true or false)
54 55 56 |
# File 'lib/usps_api/models/image_info1.rb', line 54 def ship_info @ship_info end |
#suppress_mail_date ⇒ TrueClass | FalseClass
Indicates if the ‘mailingDate` is printed on the label. If omitted then the value will default to true. Note:
* Mail Date cannot be suppressed on Domestic Customs Forms. The customs
form will always display the Date of Mailing.
* The date the label was created cannot be suppressed and will always
print on the label.
160 161 162 |
# File 'lib/usps_api/models/image_info1.rb', line 160 def suppress_mail_date @suppress_mail_date end |
#suppress_postage ⇒ TrueClass | FalseClass
Indicates if postage is printed on the label. If omitted then the request will be defaulted to true.
150 151 152 |
# File 'lib/usps_api/models/image_info1.rb', line 150 def suppress_postage @suppress_postage end |
#total_packages ⇒ Integer
The total number of packages in a series such as 999. If packageNumber is populated then totalPackages is required. totalPackages must be greater than or equal to packageNumber. This feature is not supported by the 2x7 or 4x4 label format.
198 199 200 |
# File 'lib/usps_api/models/image_info1.rb', line 198 def total_packages @total_packages end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 |
# File 'lib/usps_api/models/image_info1.rb', line 275 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. image_type = hash['imageType'] ||= ImageType3::PDF label_type = hash['labelType'] ||= LabelType3::ENUM_4X6LABEL ship_info = hash.key?('shipInfo') ? hash['shipInfo'] : SKIP receipt_option = hash['receiptOption'] ||= ReceiptOption1::SAME_PAGE branding_image_format = hash['brandingImageFormat'] ||= BrandingImageFormat::NONE branding_image_uui_ds = hash['brandingImageUUIDs'] ||= include_label_broker_pdf = hash['includeLabelBrokerPDF'] ||= false add_zpl_comments = hash['addZPLComments'] ||= false add_image_comments = hash['addImageComments'] ||= false suppress_postage = hash['suppressPostage'] ||= true suppress_mail_date = hash['suppressMailDate'] ||= true return_label = hash['returnLabel'] ||= false package_number = hash.key?('packageNumber') ? hash['packageNumber'] : SKIP total_packages = hash.key?('totalPackages') ? hash['totalPackages'] : 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. ImageInfo1.new(image_type: image_type, label_type: label_type, ship_info: ship_info, receipt_option: receipt_option, branding_image_format: branding_image_format, branding_image_uui_ds: branding_image_uui_ds, include_label_broker_pdf: include_label_broker_pdf, add_zpl_comments: add_zpl_comments, add_image_comments: add_image_comments, suppress_postage: suppress_postage, suppress_mail_date: suppress_mail_date, return_label: return_label, package_number: package_number, total_packages: total_packages, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 |
# File 'lib/usps_api/models/image_info1.rb', line 201 def self.names @_hash = {} if @_hash.nil? @_hash['image_type'] = 'imageType' @_hash['label_type'] = 'labelType' @_hash['ship_info'] = 'shipInfo' @_hash['receipt_option'] = 'receiptOption' @_hash['branding_image_format'] = 'brandingImageFormat' @_hash['branding_image_uui_ds'] = 'brandingImageUUIDs' @_hash['include_label_broker_pdf'] = 'includeLabelBrokerPDF' @_hash['add_zpl_comments'] = 'addZPLComments' @_hash['add_image_comments'] = 'addImageComments' @_hash['suppress_postage'] = 'suppressPostage' @_hash['suppress_mail_date'] = 'suppressMailDate' @_hash['return_label'] = 'returnLabel' @_hash['package_number'] = 'packageNumber' @_hash['total_packages'] = 'totalPackages' @_hash end |
.nullables ⇒ Object
An array for nullable fields
241 242 243 |
# File 'lib/usps_api/models/image_info1.rb', line 241 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 |
# File 'lib/usps_api/models/image_info1.rb', line 221 def self.optionals %w[ image_type label_type ship_info receipt_option branding_image_format branding_image_uui_ds include_label_broker_pdf add_zpl_comments add_image_comments suppress_postage suppress_mail_date return_label package_number total_packages ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
322 323 324 325 326 327 328 |
# File 'lib/usps_api/models/image_info1.rb', line 322 def self.validate(value) return true if value.instance_of? self return false unless value.instance_of? Hash true end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
344 345 346 347 348 349 350 351 352 353 354 355 356 |
# File 'lib/usps_api/models/image_info1.rb', line 344 def inspect class_name = self.class.name.split('::').last "<#{class_name} image_type: #{@image_type.inspect}, label_type: #{@label_type.inspect},"\ " ship_info: #{@ship_info.inspect}, receipt_option: #{@receipt_option.inspect},"\ " branding_image_format: #{@branding_image_format.inspect}, branding_image_uui_ds:"\ " #{@branding_image_uui_ds.inspect}, include_label_broker_pdf:"\ " #{@include_label_broker_pdf.inspect}, add_zpl_comments: #{@add_zpl_comments.inspect},"\ " add_image_comments: #{@add_image_comments.inspect}, suppress_postage:"\ " #{@suppress_postage.inspect}, suppress_mail_date: #{@suppress_mail_date.inspect},"\ " return_label: #{@return_label.inspect}, package_number: #{@package_number.inspect},"\ " total_packages: #{@total_packages.inspect}, additional_properties:"\ " #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
331 332 333 334 335 336 337 338 339 340 341 |
# File 'lib/usps_api/models/image_info1.rb', line 331 def to_s class_name = self.class.name.split('::').last "<#{class_name} image_type: #{@image_type}, label_type: #{@label_type}, ship_info:"\ " #{@ship_info}, receipt_option: #{@receipt_option}, branding_image_format:"\ " #{@branding_image_format}, branding_image_uui_ds: #{@branding_image_uui_ds},"\ " include_label_broker_pdf: #{@include_label_broker_pdf}, add_zpl_comments:"\ " #{@add_zpl_comments}, add_image_comments: #{@add_image_comments}, suppress_postage:"\ " #{@suppress_postage}, suppress_mail_date: #{@suppress_mail_date}, return_label:"\ " #{@return_label}, package_number: #{@package_number}, total_packages: #{@total_packages},"\ " additional_properties: #{@additional_properties}>" end |