Class: UspsApi::IndiciaImbRequest

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

Overview

Indicia IMB request for letters, flats, and cards First-Class mailings.

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(indicia_description:, to_address:, return_address:, image_info: SKIP) ⇒ IndiciaImbRequest

Returns a new instance of IndiciaImbRequest.



54
55
56
57
58
59
60
# File 'lib/usps_api/models/indicia_imb_request.rb', line 54

def initialize(indicia_description:, to_address:, return_address:,
               image_info: SKIP)
  @indicia_description = indicia_description
  @image_info = image_info unless image_info == SKIP
  @to_address = to_address
  @return_address = return_address
end

Instance Attribute Details

#image_infoIndiciaImbImageInfo

Additional details used to determine how to generate the indicia image.

Returns:



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

def image_info
  @image_info
end

#indicia_descriptionLabelsIndiciaRequestDescription1

Indicia intelligent mail barcode request description



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

def indicia_description
  @indicia_description
end

#return_addressIndiciaImbDomesticLabelAddress

The address where the letter, flat, or card is being mailed from. Address elements streetAddress, city, state, ZIPCode are required. First and Last Name or Firm are also required.



30
31
32
# File 'lib/usps_api/models/indicia_imb_request.rb', line 30

def return_address
  @return_address
end

#to_addressIndiciaImbDomesticLabelAddress

The address where the letter, flat, or card is being mailed to. Address elements streetAddress, city, state, ZIPCode are required. First and Last Name or Firm are also required.



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

def to_address
  @to_address
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/usps_api/models/indicia_imb_request.rb', line 63

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  if hash['indiciaDescription']
    indicia_description = LabelsIndiciaRequestDescription1.from_hash(hash['indiciaDescription'])
  end
  to_address = IndiciaImbDomesticLabelAddress.from_hash(hash['toAddress']) if
    hash['toAddress']
  return_address = IndiciaImbDomesticLabelAddress.from_hash(hash['returnAddress']) if
    hash['returnAddress']
  image_info = IndiciaImbImageInfo.from_hash(hash['imageInfo']) if hash['imageInfo']

  # Create object from extracted values.
  IndiciaImbRequest.new(indicia_description: indicia_description,
                        to_address: to_address,
                        return_address: return_address,
                        image_info: image_info)
end

.namesObject

A mapping from model property names to API property names.



33
34
35
36
37
38
39
40
# File 'lib/usps_api/models/indicia_imb_request.rb', line 33

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['indicia_description'] = 'indiciaDescription'
  @_hash['image_info'] = 'imageInfo'
  @_hash['to_address'] = 'toAddress'
  @_hash['return_address'] = 'returnAddress'
  @_hash
end

.nullablesObject

An array for nullable fields



50
51
52
# File 'lib/usps_api/models/indicia_imb_request.rb', line 50

def self.nullables
  []
end

.optionalsObject

An array for optional fields



43
44
45
46
47
# File 'lib/usps_api/models/indicia_imb_request.rb', line 43

def self.optionals
  %w[
    image_info
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



91
92
93
94
95
96
# File 'lib/usps_api/models/indicia_imb_request.rb', line 91

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} indicia_description: #{@indicia_description.inspect}, image_info:"\
  " #{@image_info.inspect}, to_address: #{@to_address.inspect}, return_address:"\
  " #{@return_address.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



84
85
86
87
88
# File 'lib/usps_api/models/indicia_imb_request.rb', line 84

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} indicia_description: #{@indicia_description}, image_info: #{@image_info},"\
  " to_address: #{@to_address}, return_address: #{@return_address}>"
end