Class: UspsApi::LabelReprintImageInfo

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/usps_api/models/label_reprint_image_info.rb

Overview

Label Reprint Image Info

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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: ImageType31::PDF, label_type: LabelType31::ENUM_4X6LABEL, suppress_postage: true, suppress_mail_date: true, branding_image_format: BrandingImageFormat::NONE, branding_image_uui_ds:, package_number: SKIP, total_packages: SKIP, additional_properties: nil) ⇒ LabelReprintImageInfo

Returns a new instance of LabelReprintImageInfo.



136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
# File 'lib/usps_api/models/label_reprint_image_info.rb', line 136

def initialize(image_type: ImageType31::PDF,
               label_type: LabelType31::ENUM_4X6LABEL,
               suppress_postage: true, suppress_mail_date: true,
               branding_image_format: BrandingImageFormat::NONE,
               branding_image_uui_ds:, 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
  @suppress_postage = suppress_postage unless suppress_postage == SKIP
  @suppress_mail_date = suppress_mail_date unless suppress_mail_date == 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
  @package_number = package_number unless package_number == SKIP
  @total_packages = total_packages unless total_packages == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#branding_image_formatBrandingImageFormat

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.

Returns:



72
73
74
# File 'lib/usps_api/models/label_reprint_image_info.rb', line 72

def branding_image_format
  @branding_image_format
end

#branding_image_uui_dsArray[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.

Returns:

  • (Array[String])


84
85
86
# File 'lib/usps_api/models/label_reprint_image_info.rb', line 84

def branding_image_uui_ds
  @branding_image_uui_ds
end

#image_typeImageType31

The type of label image requested. If omitted then the default image type is PDF. Note:

  • Labels with customs forms only support formats of ‘PDF`, `TIFF`,

‘ZPL203DPI`, and `ZPL300DPI`.

Returns:



18
19
20
# File 'lib/usps_api/models/label_reprint_image_info.rb', line 18

def image_type
  @image_type
end

#label_typeLabelType31

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`.

Returns:



27
28
29
# File 'lib/usps_api/models/label_reprint_image_info.rb', line 27

def label_type
  @label_type
end

#package_numberInteger

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.

Returns:

  • (Integer)


94
95
96
# File 'lib/usps_api/models/label_reprint_image_info.rb', line 94

def package_number
  @package_number
end

#suppress_mail_dateTrueClass | 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.

Returns:

  • (TrueClass | FalseClass)


42
43
44
# File 'lib/usps_api/models/label_reprint_image_info.rb', line 42

def suppress_mail_date
  @suppress_mail_date
end

#suppress_postageTrueClass | FalseClass

Indicates if postage is printed on the label. If omitted then the request will be defaulted to true.

Returns:

  • (TrueClass | FalseClass)


32
33
34
# File 'lib/usps_api/models/label_reprint_image_info.rb', line 32

def suppress_postage
  @suppress_postage
end

#total_packagesInteger

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.

Returns:

  • (Integer)


101
102
103
# File 'lib/usps_api/models/label_reprint_image_info.rb', line 101

def total_packages
  @total_packages
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
185
186
187
188
# File 'lib/usps_api/models/label_reprint_image_info.rb', line 157

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  image_type = hash['imageType'] ||= ImageType31::PDF
  label_type = hash['labelType'] ||= LabelType31::ENUM_4X6LABEL
  suppress_postage = hash['suppressPostage'] ||= true
  suppress_mail_date = hash['suppressMailDate'] ||= true
  branding_image_format =
    hash['brandingImageFormat'] ||= BrandingImageFormat::NONE
  branding_image_uui_ds = hash['brandingImageUUIDs'] ||= 
  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.
  LabelReprintImageInfo.new(image_type: image_type,
                            label_type: label_type,
                            suppress_postage: suppress_postage,
                            suppress_mail_date: suppress_mail_date,
                            branding_image_format: branding_image_format,
                            branding_image_uui_ds: branding_image_uui_ds,
                            package_number: package_number,
                            total_packages: total_packages,
                            additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



104
105
106
107
108
109
110
111
112
113
114
115
# File 'lib/usps_api/models/label_reprint_image_info.rb', line 104

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['image_type'] = 'imageType'
  @_hash['label_type'] = 'labelType'
  @_hash['suppress_postage'] = 'suppressPostage'
  @_hash['suppress_mail_date'] = 'suppressMailDate'
  @_hash['branding_image_format'] = 'brandingImageFormat'
  @_hash['branding_image_uui_ds'] = 'brandingImageUUIDs'
  @_hash['package_number'] = 'packageNumber'
  @_hash['total_packages'] = 'totalPackages'
  @_hash
end

.nullablesObject

An array for nullable fields



132
133
134
# File 'lib/usps_api/models/label_reprint_image_info.rb', line 132

def self.nullables
  []
end

.optionalsObject

An array for optional fields



118
119
120
121
122
123
124
125
126
127
128
129
# File 'lib/usps_api/models/label_reprint_image_info.rb', line 118

def self.optionals
  %w[
    image_type
    label_type
    suppress_postage
    suppress_mail_date
    branding_image_format
    branding_image_uui_ds
    package_number
    total_packages
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



201
202
203
204
205
206
207
208
209
# File 'lib/usps_api/models/label_reprint_image_info.rb', line 201

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} image_type: #{@image_type.inspect}, label_type: #{@label_type.inspect},"\
  " suppress_postage: #{@suppress_postage.inspect}, suppress_mail_date:"\
  " #{@suppress_mail_date.inspect}, branding_image_format: #{@branding_image_format.inspect},"\
  " branding_image_uui_ds: #{@branding_image_uui_ds.inspect}, package_number:"\
  " #{@package_number.inspect}, total_packages: #{@total_packages.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



191
192
193
194
195
196
197
198
# File 'lib/usps_api/models/label_reprint_image_info.rb', line 191

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} image_type: #{@image_type}, label_type: #{@label_type}, suppress_postage:"\
  " #{@suppress_postage}, suppress_mail_date: #{@suppress_mail_date}, branding_image_format:"\
  " #{@branding_image_format}, branding_image_uui_ds: #{@branding_image_uui_ds},"\
  " package_number: #{@package_number}, total_packages: #{@total_packages},"\
  " additional_properties: #{@additional_properties}>"
end