Class: UspsApi::ReturnLabelReprintResponse

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

Overview

Response schema for return label reprint requests.

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

Returns a new instance of ReturnLabelReprintResponse.



47
48
49
50
51
52
# File 'lib/usps_api/models/return_label_reprint_response.rb', line 47

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

Instance Attribute Details

#reprint_infoInternationalLabelsReprintInfo

Schema containing reprint information for a label.



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

def reprint_info
  @reprint_info
end

#return_label_imageString

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

Returns:

  • (String)


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

def return_label_image
  @return_label_image
end

#return_label_metadataReturnLabelMetadata

Return Label Metadata

Returns:



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

def 
  @return_label_metadata
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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

def self.from_hash(hash)
  return nil unless hash

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

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

.namesObject

A mapping from model property names to API property names.



25
26
27
28
29
30
31
# File 'lib/usps_api/models/return_label_reprint_response.rb', line 25

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

.nullablesObject

An array for nullable fields



43
44
45
# File 'lib/usps_api/models/return_label_reprint_response.rb', line 43

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

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

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



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

def self.validate(value)
  return true if value.instance_of? self

  return false unless value.instance_of? Hash

  true
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



90
91
92
93
94
95
# File 'lib/usps_api/models/return_label_reprint_response.rb', line 90

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} return_label_metadata: #{@return_label_metadata.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.



83
84
85
86
87
# File 'lib/usps_api/models/return_label_reprint_response.rb', line 83

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