Class: UspsApi::LabelReprintMultipartResponse

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

Overview

Label Reprint Multipart response

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(label_metadata: SKIP, return_label_metadata: SKIP, label_image: SKIP, return_label_image: SKIP, reprint_info: SKIP) ⇒ LabelReprintMultipartResponse

Returns a new instance of LabelReprintMultipartResponse.



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

def initialize(label_metadata: SKIP, return_label_metadata: SKIP,
               label_image: SKIP, return_label_image: SKIP,
               reprint_info: SKIP)
  @label_metadata =  unless  == SKIP
  @return_label_metadata =  unless  == SKIP
  @label_image = label_image unless label_image == SKIP
  @return_label_image = return_label_image unless return_label_image == SKIP
  @reprint_info = reprint_info unless reprint_info == SKIP
end

Instance Attribute Details

#label_imageString

Contains the Base64-encoded file contents of the label image.

Returns:

  • (String)


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

def label_image
  @label_image
end

#label_metadataLabelMetadata

Label Metadata returned from label creation and label edit.

Returns:



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

def 
  @label_metadata
end

#reprint_infoInternationalLabelsReprintInfo

Schema containing reprint information for a label.



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

def reprint_info
  @reprint_info
end

#return_label_imageString

Contains the Base64-encoded file contents of the return label image.

Returns:

  • (String)


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

def return_label_image
  @return_label_image
end

#return_label_metadataReturnLabelMetadata

Return Label Metadata

Returns:



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

def 
  @return_label_metadata
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/usps_api/models/label_reprint_multipart_response.rb', line 70

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
   = LabelMetadata.from_hash(hash['labelMetadata']) if hash['labelMetadata']
   = ReturnLabelMetadata.from_hash(hash['returnLabelMetadata']) if
    hash['returnLabelMetadata']
  label_image = hash.key?('labelImage') ? hash['labelImage'] : SKIP
  return_label_image =
    hash.key?('returnLabelImage') ? hash['returnLabelImage'] : SKIP
  reprint_info = InternationalLabelsReprintInfo.from_hash(hash['reprintInfo']) if
    hash['reprintInfo']

  # Create object from extracted values.
  LabelReprintMultipartResponse.new(label_metadata: ,
                                    return_label_metadata: ,
                                    label_image: label_image,
                                    return_label_image: return_label_image,
                                    reprint_info: reprint_info)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['label_metadata'] = 'labelMetadata'
  @_hash['return_label_metadata'] = 'returnLabelMetadata'
  @_hash['label_image'] = 'labelImage'
  @_hash['return_label_image'] = 'returnLabelImage'
  @_hash['reprint_info'] = 'reprintInfo'
  @_hash
end

.nullablesObject

An array for nullable fields



55
56
57
# File 'lib/usps_api/models/label_reprint_multipart_response.rb', line 55

def self.nullables
  []
end

.optionalsObject

An array for optional fields



44
45
46
47
48
49
50
51
52
# File 'lib/usps_api/models/label_reprint_multipart_response.rb', line 44

def self.optionals
  %w[
    label_metadata
    return_label_metadata
    label_image
    return_label_image
    reprint_info
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



100
101
102
103
104
105
106
# File 'lib/usps_api/models/label_reprint_multipart_response.rb', line 100

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} label_metadata: #{@label_metadata.inspect}, return_label_metadata:"\
  " #{@return_label_metadata.inspect}, label_image: #{@label_image.inspect},"\
  " return_label_image: #{@return_label_image.inspect}, reprint_info:"\
  " #{@reprint_info.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



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

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} label_metadata: #{@label_metadata}, return_label_metadata:"\
  " #{@return_label_metadata}, label_image: #{@label_image}, return_label_image:"\
  " #{@return_label_image}, reprint_info: #{@reprint_info}>"
end