Class: UspsApi::InternationalLabelsIndiciaResponse

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

Overview

The IndiciaResponse object contains metadata for the generated First-Class Mail International indicia.

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(indicia_metadata: SKIP, indicia_image: SKIP, receipt_image: SKIP) ⇒ InternationalLabelsIndiciaResponse

Returns a new instance of InternationalLabelsIndiciaResponse.



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

def initialize(indicia_metadata: SKIP, indicia_image: SKIP,
               receipt_image: SKIP)
  @indicia_metadata =  unless  == SKIP
  @indicia_image = indicia_image unless indicia_image == SKIP
  @receipt_image = receipt_image unless receipt_image == SKIP
end

Instance Attribute Details

#indicia_imageString

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

Returns:

  • (String)


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

def indicia_image
  @indicia_image
end

#indicia_metadataIndiciaMetadata

Metadata for the generated indicia.

Returns:



15
16
17
# File 'lib/usps_api/models/international_labels_indicia_response.rb', line 15

def 
  @indicia_metadata
end

#receipt_imageString

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

Returns:

  • (String)


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

def receipt_image
  @receipt_image
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
# File 'lib/usps_api/models/international_labels_indicia_response.rb', line 57

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
   = IndiciaMetadata.from_hash(hash['indiciaMetadata']) if
    hash['indiciaMetadata']
  indicia_image = hash.key?('indiciaImage') ? hash['indiciaImage'] : SKIP
  receipt_image = hash.key?('receiptImage') ? hash['receiptImage'] : SKIP

  # Create object from extracted values.
  InternationalLabelsIndiciaResponse.new(indicia_metadata: ,
                                         indicia_image: indicia_image,
                                         receipt_image: receipt_image)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['indicia_metadata'] = 'indiciaMetadata'
  @_hash['indicia_image'] = 'indiciaImage'
  @_hash['receipt_image'] = 'receiptImage'
  @_hash
end

.nullablesObject

An array for nullable fields



45
46
47
# File 'lib/usps_api/models/international_labels_indicia_response.rb', line 45

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    indicia_metadata
    indicia_image
    receipt_image
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



80
81
82
83
84
# File 'lib/usps_api/models/international_labels_indicia_response.rb', line 80

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

#to_sObject

Provides a human-readable string representation of the object.



73
74
75
76
77
# File 'lib/usps_api/models/international_labels_indicia_response.rb', line 73

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