Class: UspsApi::CreateOdContainerResponse

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

Overview

CreateOdContainerResponse Model.

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(pmod_container_metadata: SKIP, label_image: SKIP, imcb_image: SKIP, receipt_image: SKIP, warnings: SKIP) ⇒ CreateOdContainerResponse

Returns a new instance of CreateOdContainerResponse.



73
74
75
76
77
78
79
80
# File 'lib/usps_api/models/create_od_container_response.rb', line 73

def initialize(pmod_container_metadata: SKIP, label_image: SKIP,
               imcb_image: SKIP, receipt_image: SKIP, warnings: SKIP)
  @pmod_container_metadata =  unless  == SKIP
  @label_image = label_image unless label_image == SKIP
  @imcb_image = imcb_image unless imcb_image == SKIP
  @receipt_image = receipt_image unless receipt_image == SKIP
  @warnings = warnings unless warnings == SKIP
end

Instance Attribute Details

#imcb_imageString

Contains the Base64-encoded file contents of the 99M IMcb image. Provided only when ‘imageInfo.imageType` is not `NONE`.

Returns:

  • (String)


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

def imcb_image
  @imcb_image
end

#label_imageString

Contains the Base64-encoded file contents of the IMpb label image. Provided only when ‘imageInfo.imageType` is not `NONE`.

Returns:

  • (String)


19
20
21
# File 'lib/usps_api/models/create_od_container_response.rb', line 19

def label_image
  @label_image
end

#pmod_container_metadataCreateOpenAndDistributeContainerMetadata

Create OD Container Response



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

def 
  @pmod_container_metadata
end

#receipt_imageString

Contains the Base64-encoded file contents of the label receipt image. Provided only when ‘imageInfo.receiptOption` is `SEPARATE_PAGE`. Note:

  • When ‘imageInfo.imageType` is `ZPL203DPI` or `ZPL300DPI` and

‘imageInfo.receiptOption` is `SEPARATE_PAGE`, the receipt will be returned as an additional label segment within the single ZPL payload in `labelImage`. In this case, `receiptImage` will not be populated.

Returns:

  • (String)


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

def receipt_image
  @receipt_image
end

#warningsArray[ContainersContainerWarnings]

Contains the Base64-encoded file contents of the label receipt image. Provided only when ‘imageInfo.receiptOption` is `SEPARATE_PAGE`. Note:

  • When ‘imageInfo.imageType` is `ZPL203DPI` or `ZPL300DPI` and

‘imageInfo.receiptOption` is `SEPARATE_PAGE`, the receipt will be returned as an additional label segment within the single ZPL payload in `labelImage`. In this case, `receiptImage` will not be populated.

Returns:



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

def warnings
  @warnings
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# File 'lib/usps_api/models/create_od_container_response.rb', line 83

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  if hash['pmodContainerMetadata']
     = CreateOpenAndDistributeContainerMetadata.from_hash(hash['pmodContainerMetadata'])
  end
  label_image = hash.key?('labelImage') ? hash['labelImage'] : SKIP
  imcb_image = hash.key?('imcbImage') ? hash['imcbImage'] : SKIP
  receipt_image = hash.key?('receiptImage') ? hash['receiptImage'] : SKIP
  # Parameter is an array, so we need to iterate through it
  warnings = nil
  unless hash['warnings'].nil?
    warnings = []
    hash['warnings'].each do |structure|
      warnings << (ContainersContainerWarnings.from_hash(structure) if structure)
    end
  end

  warnings = SKIP unless hash.key?('warnings')

  # Create object from extracted values.
  CreateOdContainerResponse.new(pmod_container_metadata: ,
                                label_image: label_image,
                                imcb_image: imcb_image,
                                receipt_image: receipt_image,
                                warnings: warnings)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['pmod_container_metadata'] = 'pmodContainerMetadata'
  @_hash['label_image'] = 'labelImage'
  @_hash['imcb_image'] = 'imcbImage'
  @_hash['receipt_image'] = 'receiptImage'
  @_hash['warnings'] = 'warnings'
  @_hash
end

.nullablesObject

An array for nullable fields



69
70
71
# File 'lib/usps_api/models/create_od_container_response.rb', line 69

def self.nullables
  []
end

.optionalsObject

An array for optional fields



58
59
60
61
62
63
64
65
66
# File 'lib/usps_api/models/create_od_container_response.rb', line 58

def self.optionals
  %w[
    pmod_container_metadata
    label_image
    imcb_image
    receipt_image
    warnings
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



121
122
123
124
125
126
# File 'lib/usps_api/models/create_od_container_response.rb', line 121

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} pmod_container_metadata: #{@pmod_container_metadata.inspect}, label_image:"\
  " #{@label_image.inspect}, imcb_image: #{@imcb_image.inspect}, receipt_image:"\
  " #{@receipt_image.inspect}, warnings: #{@warnings.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



113
114
115
116
117
118
# File 'lib/usps_api/models/create_od_container_response.rb', line 113

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} pmod_container_metadata: #{@pmod_container_metadata}, label_image:"\
  " #{@label_image}, imcb_image: #{@imcb_image}, receipt_image: #{@receipt_image}, warnings:"\
  " #{@warnings}>"
end