Class: UspsApi::UspsContainerInfo

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

Overview

Details of the container and its contents.

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(mail_owner_crid: SKIP, mail_owner_id: SKIP, usps_publication_id: SKIP, actual_piece_count: SKIP, container_weight: SKIP, imcb: SKIP, imcb_info: SKIP, sibling_barcode: SKIP, post_induction_status: SKIP, container_destination3digit_zip: SKIP, container_destination5digit_zip: SKIP, additional_properties: nil) ⇒ UspsContainerInfo

Returns a new instance of UspsContainerInfo.



99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/usps_api/models/usps_container_info.rb', line 99

def initialize(mail_owner_crid: SKIP, mail_owner_id: SKIP,
               usps_publication_id: SKIP, actual_piece_count: SKIP,
               container_weight: SKIP, imcb: SKIP, imcb_info: SKIP,
               sibling_barcode: SKIP, post_induction_status: SKIP,
               container_destination3digit_zip: SKIP,
               container_destination5digit_zip: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @mail_owner_crid = mail_owner_crid unless mail_owner_crid == SKIP
  @mail_owner_id = mail_owner_id unless mail_owner_id == SKIP
  @usps_publication_id = usps_publication_id unless usps_publication_id == SKIP
  @actual_piece_count = actual_piece_count unless actual_piece_count == SKIP
  @container_weight = container_weight unless container_weight == SKIP
  @imcb = imcb unless imcb == SKIP
  @imcb_info = imcb_info unless imcb_info == SKIP
  @sibling_barcode = sibling_barcode unless sibling_barcode == SKIP
  @post_induction_status = post_induction_status unless post_induction_status == SKIP
  unless container_destination3digit_zip == SKIP
    @container_destination3digit_zip =
      container_destination3digit_zip
  end
  unless container_destination5digit_zip == SKIP
    @container_destination5digit_zip =
      container_destination5digit_zip
  end
  @additional_properties = additional_properties
end

Instance Attribute Details

#actual_piece_countInteger

Total count of the mail pieces

Returns:

  • (Integer)


26
27
28
# File 'lib/usps_api/models/usps_container_info.rb', line 26

def actual_piece_count
  @actual_piece_count
end

#container_destination3digit_zipString

3 digit zipcode of the destination

Returns:

  • (String)


52
53
54
# File 'lib/usps_api/models/usps_container_info.rb', line 52

def container_destination3digit_zip
  @container_destination3digit_zip
end

#container_destination5digit_zipString

5 digit zipcode of the destination

Returns:

  • (String)


56
57
58
# File 'lib/usps_api/models/usps_container_info.rb', line 56

def container_destination5digit_zip
  @container_destination5digit_zip
end

#container_weightString

Weight of the container

Returns:

  • (String)


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

def container_weight
  @container_weight
end

#imcbArray[String]

Array of Intelligent Mail Container Barcode. Unlimited values allowed. Required for Create actions.

Returns:

  • (Array[String])


35
36
37
# File 'lib/usps_api/models/usps_container_info.rb', line 35

def imcb
  @imcb
end

#imcb_infoImcbInfo

Is the IMCB Linked or Scanned

Returns:



39
40
41
# File 'lib/usps_api/models/usps_container_info.rb', line 39

def imcb_info
  @imcb_info
end

#mail_owner_cridArray[String]

Array of CRIDs of the mail owner. Maximum of 5 values in the array.

Returns:

  • (Array[String])


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

def mail_owner_crid
  @mail_owner_crid
end

#mail_owner_idArray[String]

Array of IDs of the mail owner. Maximum of 5 values in the array.

Returns:

  • (Array[String])


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

def mail_owner_id
  @mail_owner_id
end

#post_induction_statusPostInductionStatus

Status as of induction of FAST appointment

Returns:



48
49
50
# File 'lib/usps_api/models/usps_container_info.rb', line 48

def post_induction_status
  @post_induction_status
end

#sibling_barcodeArray[String]

Array of unique IMCB barcode associated to IMCB barcode. Unlimited values allowed.

Returns:

  • (Array[String])


44
45
46
# File 'lib/usps_api/models/usps_container_info.rb', line 44

def sibling_barcode
  @sibling_barcode
end

#usps_publication_idArray[String]

ID of publication (Periodicals) associated with appointment content

Returns:

  • (Array[String])


22
23
24
# File 'lib/usps_api/models/usps_container_info.rb', line 22

def usps_publication_id
  @usps_publication_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
# File 'lib/usps_api/models/usps_container_info.rb', line 130

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  mail_owner_crid =
    hash.key?('mailOwnerCRID') ? hash['mailOwnerCRID'] : SKIP
  mail_owner_id = hash.key?('mailOwnerID') ? hash['mailOwnerID'] : SKIP
  usps_publication_id =
    hash.key?('uspsPublicationID') ? hash['uspsPublicationID'] : SKIP
  actual_piece_count =
    hash.key?('actualPieceCount') ? hash['actualPieceCount'] : SKIP
  container_weight =
    hash.key?('containerWeight') ? hash['containerWeight'] : SKIP
  imcb = hash.key?('IMCB') ? hash['IMCB'] : SKIP
  imcb_info = hash.key?('IMCBInfo') ? hash['IMCBInfo'] : SKIP
  sibling_barcode =
    hash.key?('siblingBarcode') ? hash['siblingBarcode'] : SKIP
  post_induction_status =
    hash.key?('postInductionStatus') ? hash['postInductionStatus'] : SKIP
  container_destination3digit_zip =
    hash.key?('containerDestination3digitZIP') ? hash['containerDestination3digitZIP'] : SKIP
  container_destination5digit_zip =
    hash.key?('containerDestination5digitZIP') ? hash['containerDestination5digitZIP'] : 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.
  UspsContainerInfo.new(mail_owner_crid: mail_owner_crid,
                        mail_owner_id: mail_owner_id,
                        usps_publication_id: usps_publication_id,
                        actual_piece_count: actual_piece_count,
                        container_weight: container_weight,
                        imcb: imcb,
                        imcb_info: imcb_info,
                        sibling_barcode: sibling_barcode,
                        post_induction_status: post_induction_status,
                        container_destination3digit_zip: container_destination3digit_zip,
                        container_destination5digit_zip: container_destination5digit_zip,
                        additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/usps_api/models/usps_container_info.rb', line 59

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['mail_owner_crid'] = 'mailOwnerCRID'
  @_hash['mail_owner_id'] = 'mailOwnerID'
  @_hash['usps_publication_id'] = 'uspsPublicationID'
  @_hash['actual_piece_count'] = 'actualPieceCount'
  @_hash['container_weight'] = 'containerWeight'
  @_hash['imcb'] = 'IMCB'
  @_hash['imcb_info'] = 'IMCBInfo'
  @_hash['sibling_barcode'] = 'siblingBarcode'
  @_hash['post_induction_status'] = 'postInductionStatus'
  @_hash['container_destination3digit_zip'] =
    'containerDestination3digitZIP'
  @_hash['container_destination5digit_zip'] =
    'containerDestination5digitZIP'
  @_hash
end

.nullablesObject

An array for nullable fields



95
96
97
# File 'lib/usps_api/models/usps_container_info.rb', line 95

def self.nullables
  []
end

.optionalsObject

An array for optional fields



78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/usps_api/models/usps_container_info.rb', line 78

def self.optionals
  %w[
    mail_owner_crid
    mail_owner_id
    usps_publication_id
    actual_piece_count
    container_weight
    imcb
    imcb_info
    sibling_barcode
    post_induction_status
    container_destination3digit_zip
    container_destination5digit_zip
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



189
190
191
192
193
194
195
196
197
198
199
200
# File 'lib/usps_api/models/usps_container_info.rb', line 189

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} mail_owner_crid: #{@mail_owner_crid.inspect}, mail_owner_id:"\
  " #{@mail_owner_id.inspect}, usps_publication_id: #{@usps_publication_id.inspect},"\
  " actual_piece_count: #{@actual_piece_count.inspect}, container_weight:"\
  " #{@container_weight.inspect}, imcb: #{@imcb.inspect}, imcb_info: #{@imcb_info.inspect},"\
  " sibling_barcode: #{@sibling_barcode.inspect}, post_induction_status:"\
  " #{@post_induction_status.inspect}, container_destination3digit_zip:"\
  " #{@container_destination3digit_zip.inspect}, container_destination5digit_zip:"\
  " #{@container_destination5digit_zip.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



177
178
179
180
181
182
183
184
185
186
# File 'lib/usps_api/models/usps_container_info.rb', line 177

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} mail_owner_crid: #{@mail_owner_crid}, mail_owner_id: #{@mail_owner_id},"\
  " usps_publication_id: #{@usps_publication_id}, actual_piece_count: #{@actual_piece_count},"\
  " container_weight: #{@container_weight}, imcb: #{@imcb}, imcb_info: #{@imcb_info},"\
  " sibling_barcode: #{@sibling_barcode}, post_induction_status: #{@post_induction_status},"\
  " container_destination3digit_zip: #{@container_destination3digit_zip},"\
  " container_destination5digit_zip: #{@container_destination5digit_zip},"\
  " additional_properties: #{@additional_properties}>"
end