Class: UspsApi::UspsContainerInfo1

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/usps_api/models/usps_container_info1.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, additional_properties: nil) ⇒ UspsContainerInfo1

Returns a new instance of UspsContainerInfo1.



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

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, 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
  @additional_properties = additional_properties
end

Instance Attribute Details

#actual_piece_countInteger

Total count

Returns:

  • (Integer)


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

def actual_piece_count
  @actual_piece_count
end

#container_weightString

Weight of the container

Returns:

  • (String)


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

def container_weight
  @container_weight
end

#imcbArray[String]

Array of Intelligent Mail Container Barcodes Required for Create actions.

Returns:

  • (Array[String])


34
35
36
# File 'lib/usps_api/models/usps_container_info1.rb', line 34

def imcb
  @imcb
end

#imcb_infoImcbInfo1

Is the IMCB linked or scanned

Returns:



38
39
40
# File 'lib/usps_api/models/usps_container_info1.rb', line 38

def imcb_info
  @imcb_info
end

#mail_owner_cridArray[String]

Array of CRIDs of the mail owner

Returns:

  • (Array[String])


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

def mail_owner_crid
  @mail_owner_crid
end

#mail_owner_idArray[String]

ID of the mail owner

Returns:

  • (Array[String])


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

def mail_owner_id
  @mail_owner_id
end

#sibling_barcodeArray[String]

Array of unique IMCB barcode associated to IMCB barcode

Returns:

  • (Array[String])


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

def sibling_barcode
  @sibling_barcode
end

#usps_publication_idArray[String]

The Publication ID

Returns:

  • (Array[String])


22
23
24
# File 'lib/usps_api/models/usps_container_info1.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.



96
97
98
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
128
129
130
131
# File 'lib/usps_api/models/usps_container_info1.rb', line 96

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

  # 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.
  UspsContainerInfo1.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,
                         additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/usps_api/models/usps_container_info1.rb', line 45

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
end

.nullablesObject

An array for nullable fields



73
74
75
# File 'lib/usps_api/models/usps_container_info1.rb', line 73

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

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

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



143
144
145
146
147
148
149
150
151
# File 'lib/usps_api/models/usps_container_info1.rb', line 143

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}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



134
135
136
137
138
139
140
# File 'lib/usps_api/models/usps_container_info1.rb', line 134

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}, additional_properties: #{@additional_properties}>"
end