Class: UspsApi::LabelReprintInternationalImageInfo

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

Overview

The Reprint Image Info Object defines label characteristics

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: ImageType11::PDF, label_type: LabelType1::ENUM_4X6LABEL, suppress_postage: false) ⇒ LabelReprintInternationalImageInfo

Returns a new instance of LabelReprintInternationalImageInfo.



49
50
51
52
53
54
55
# File 'lib/usps_api/models/label_reprint_international_image_info.rb', line 49

def initialize(image_type: ImageType11::PDF,
               label_type: LabelType1::ENUM_4X6LABEL,
               suppress_postage: false)
  @image_type = image_type unless image_type == SKIP
  @label_type = label_type unless label_type == SKIP
  @suppress_postage = suppress_postage unless suppress_postage == SKIP
end

Instance Attribute Details

#image_typeImageType11

The type of label image requested.

Returns:



14
15
16
# File 'lib/usps_api/models/label_reprint_international_image_info.rb', line 14

def image_type
  @image_type
end

#label_typeLabelType1

The requested label image size to generate.

Returns:



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

def label_type
  @label_type
end

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

Returns:

  • (TrueClass | FalseClass)


24
25
26
# File 'lib/usps_api/models/label_reprint_international_image_info.rb', line 24

def suppress_postage
  @suppress_postage
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/usps_api/models/label_reprint_international_image_info.rb', line 58

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  image_type = hash['imageType'] ||= ImageType11::PDF
  label_type = hash['labelType'] ||= LabelType1::ENUM_4X6LABEL
  suppress_postage = hash['suppressPostage'] ||= false

  # Create object from extracted values.
  LabelReprintInternationalImageInfo.new(image_type: image_type,
                                         label_type: label_type,
                                         suppress_postage: suppress_postage)
end

.namesObject

A mapping from model property names to API property names.



27
28
29
30
31
32
33
# File 'lib/usps_api/models/label_reprint_international_image_info.rb', line 27

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['image_type'] = 'imageType'
  @_hash['label_type'] = 'labelType'
  @_hash['suppress_postage'] = 'suppressPostage'
  @_hash
end

.nullablesObject

An array for nullable fields



45
46
47
# File 'lib/usps_api/models/label_reprint_international_image_info.rb', line 45

def self.nullables
  []
end

.optionalsObject

An array for optional fields



36
37
38
39
40
41
42
# File 'lib/usps_api/models/label_reprint_international_image_info.rb', line 36

def self.optionals
  %w[
    image_type
    label_type
    suppress_postage
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



80
81
82
83
84
# File 'lib/usps_api/models/label_reprint_international_image_info.rb', line 80

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}>"
end

#to_sObject

Provides a human-readable string representation of the object.



73
74
75
76
77
# File 'lib/usps_api/models/label_reprint_international_image_info.rb', line 73

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