Class: UspsApi::InternationalImageInfo
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- UspsApi::InternationalImageInfo
- Defined in:
- lib/usps_api/models/international_image_info.rb
Overview
The Image Object defines label characteristics
Instance Attribute Summary collapse
-
#add_zpl_comments ⇒ TrueClass | FalseClass
Applicable only when ‘imageType` is `ZPL203DPI` or `ZPL300DPI`.
-
#hold_for_manifest ⇒ TrueClass | FalseClass
This field is deprecated and will be removed in a future release.
-
#image_type ⇒ ImageType1
The type of label image requested.
-
#include_label_broker_pdf ⇒ TrueClass | FalseClass
Applicable only when ‘imageType` is `LABEL_BROKER`.
-
#label_type ⇒ LabelType1
The requested label image size to generate.
-
#suppress_postage ⇒ TrueClass | FalseClass
Indicates if Insured Fees and Postal Charges/Fees should be omitted from the label image.
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(image_type: ImageType1::PDF, label_type: LabelType1::ENUM_4X6LABEL, hold_for_manifest: false, suppress_postage: false, include_label_broker_pdf: false, add_zpl_comments: false) ⇒ InternationalImageInfo
constructor
A new instance of InternationalImageInfo.
-
#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: ImageType1::PDF, label_type: LabelType1::ENUM_4X6LABEL, hold_for_manifest: false, suppress_postage: false, include_label_broker_pdf: false, add_zpl_comments: false) ⇒ InternationalImageInfo
Returns a new instance of InternationalImageInfo.
97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/usps_api/models/international_image_info.rb', line 97 def initialize(image_type: ImageType1::PDF, label_type: LabelType1::ENUM_4X6LABEL, hold_for_manifest: false, suppress_postage: false, include_label_broker_pdf: false, add_zpl_comments: false) @image_type = image_type unless image_type == SKIP @label_type = label_type unless label_type == SKIP @hold_for_manifest = hold_for_manifest unless hold_for_manifest == SKIP @suppress_postage = suppress_postage unless suppress_postage == 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 end |
Instance Attribute Details
#add_zpl_comments ⇒ TrueClass | FalseClass
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`
66 67 68 |
# File 'lib/usps_api/models/international_image_info.rb', line 66 def add_zpl_comments @add_zpl_comments end |
#hold_for_manifest ⇒ TrueClass | FalseClass
This field is deprecated and will be removed in a future release. By default, all international packages are manifested at the end of the day. Use ‘packageDescription.packageOptions.immediateManifest` to trigger an immediate manifest.
39 40 41 |
# File 'lib/usps_api/models/international_image_info.rb', line 39 def hold_for_manifest @hold_for_manifest end |
#image_type ⇒ ImageType1
The type of label image requested.
* '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).
* 'PDF'
* 'TIFF'
* 'ZPL203DPI'
* 'ZPL300DPI'
* 'NONE'
27 28 29 |
# File 'lib/usps_api/models/international_image_info.rb', line 27 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.
56 57 58 |
# File 'lib/usps_api/models/international_image_info.rb', line 56 def include_label_broker_pdf @include_label_broker_pdf end |
#label_type ⇒ LabelType1
The requested label image size to generate.
31 32 33 |
# File 'lib/usps_api/models/international_image_info.rb', line 31 def label_type @label_type end |
#suppress_postage ⇒ TrueClass | FalseClass
Indicates if Insured Fees and Postal Charges/Fees should be omitted from the label image. If true, Insured Fees and Postal Charges/Fees values will be removed.
45 46 47 |
# File 'lib/usps_api/models/international_image_info.rb', line 45 def suppress_postage @suppress_postage end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
# File 'lib/usps_api/models/international_image_info.rb', line 110 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. image_type = hash['imageType'] ||= ImageType1::PDF label_type = hash['labelType'] ||= LabelType1::ENUM_4X6LABEL hold_for_manifest = hash['holdForManifest'] ||= false suppress_postage = hash['suppressPostage'] ||= false include_label_broker_pdf = hash['includeLabelBrokerPDF'] ||= false add_zpl_comments = hash['addZPLComments'] ||= false # Create object from extracted values. InternationalImageInfo.new(image_type: image_type, label_type: label_type, hold_for_manifest: hold_for_manifest, suppress_postage: suppress_postage, include_label_broker_pdf: include_label_broker_pdf, add_zpl_comments: add_zpl_comments) end |
.names ⇒ Object
A mapping from model property names to API property names.
69 70 71 72 73 74 75 76 77 78 |
# File 'lib/usps_api/models/international_image_info.rb', line 69 def self.names @_hash = {} if @_hash.nil? @_hash['image_type'] = 'imageType' @_hash['label_type'] = 'labelType' @_hash['hold_for_manifest'] = 'holdForManifest' @_hash['suppress_postage'] = 'suppressPostage' @_hash['include_label_broker_pdf'] = 'includeLabelBrokerPDF' @_hash['add_zpl_comments'] = 'addZPLComments' @_hash end |
.nullables ⇒ Object
An array for nullable fields
93 94 95 |
# File 'lib/usps_api/models/international_image_info.rb', line 93 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
81 82 83 84 85 86 87 88 89 90 |
# File 'lib/usps_api/models/international_image_info.rb', line 81 def self.optionals %w[ image_type label_type hold_for_manifest suppress_postage include_label_broker_pdf add_zpl_comments ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
139 140 141 142 143 144 145 |
# File 'lib/usps_api/models/international_image_info.rb', line 139 def inspect class_name = self.class.name.split('::').last "<#{class_name} image_type: #{@image_type.inspect}, label_type: #{@label_type.inspect},"\ " hold_for_manifest: #{@hold_for_manifest.inspect}, suppress_postage:"\ " #{@suppress_postage.inspect}, include_label_broker_pdf:"\ " #{@include_label_broker_pdf.inspect}, add_zpl_comments: #{@add_zpl_comments.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
131 132 133 134 135 136 |
# File 'lib/usps_api/models/international_image_info.rb', line 131 def to_s class_name = self.class.name.split('::').last "<#{class_name} image_type: #{@image_type}, label_type: #{@label_type}, hold_for_manifest:"\ " #{@hold_for_manifest}, suppress_postage: #{@suppress_postage}, include_label_broker_pdf:"\ " #{@include_label_broker_pdf}, add_zpl_comments: #{@add_zpl_comments}>" end |