Class: UspsApi::InternationalLabelReprintMultipartResponse

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

Overview

Response for an international label reprint request containing label metadata, Base64-encoded label image, and reprint information.

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, label_image: SKIP, reprint_info: SKIP) ⇒ InternationalLabelReprintMultipartResponse

Returns a new instance of InternationalLabelReprintMultipartResponse.



50
51
52
53
54
# File 'lib/usps_api/models/international_label_reprint_multipart_response.rb', line 50

def initialize(label_metadata: SKIP, label_image: SKIP, reprint_info: SKIP)
  @label_metadata =  unless  == SKIP
  @label_image = label_image unless 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. Provided only when ‘imageInfo.imageType` is not `NONE`.

Returns:

  • (String)


21
22
23
# File 'lib/usps_api/models/international_label_reprint_multipart_response.rb', line 21

def label_image
  @label_image
end

#label_metadataInternationalLabelMetadataResponse

Metadata information for an international label including tracking number, pricing details, postage, and extra services.



16
17
18
# File 'lib/usps_api/models/international_label_reprint_multipart_response.rb', line 16

def 
  @label_metadata
end

#reprint_infoInternationalLabelsReprintInfo

Schema containing reprint information for a label.



25
26
27
# File 'lib/usps_api/models/international_label_reprint_multipart_response.rb', line 25

def reprint_info
  @reprint_info
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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

def self.from_hash(hash)
  return nil unless hash

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

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

.namesObject

A mapping from model property names to API property names.



28
29
30
31
32
33
34
# File 'lib/usps_api/models/international_label_reprint_multipart_response.rb', line 28

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

.nullablesObject

An array for nullable fields



46
47
48
# File 'lib/usps_api/models/international_label_reprint_multipart_response.rb', line 46

def self.nullables
  []
end

.optionalsObject

An array for optional fields



37
38
39
40
41
42
43
# File 'lib/usps_api/models/international_label_reprint_multipart_response.rb', line 37

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

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



81
82
83
84
85
# File 'lib/usps_api/models/international_label_reprint_multipart_response.rb', line 81

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

#to_sObject

Provides a human-readable string representation of the object.



74
75
76
77
78
# File 'lib/usps_api/models/international_label_reprint_multipart_response.rb', line 74

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