Class: UspsApi::LabelBrandingGetImageResponse

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

Overview

Response schema for getting a single label branding image.

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(image_uuid: SKIP, image_name: SKIP, image_data: SKIP, created_date_time: SKIP) ⇒ LabelBrandingGetImageResponse

Returns a new instance of LabelBrandingGetImageResponse.



56
57
58
59
60
61
62
# File 'lib/usps_api/models/label_branding_get_image_response.rb', line 56

def initialize(image_uuid: SKIP, image_name: SKIP, image_data: SKIP,
               created_date_time: SKIP)
  @image_uuid = image_uuid unless image_uuid == SKIP
  @image_name = image_name unless image_name == SKIP
  @image_data = image_data unless image_data == SKIP
  @created_date_time = created_date_time unless created_date_time == SKIP
end

Instance Attribute Details

#created_date_timeDateTime

The time that the image was created.

Returns:

  • (DateTime)


29
30
31
# File 'lib/usps_api/models/label_branding_get_image_response.rb', line 29

def created_date_time
  @created_date_time
end

#image_dataString

The base64 image data associated with your image.

Returns:

  • (String)


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

def image_data
  @image_data
end

#image_nameString

The descriptor text that was optionally associated with the image when the image was created.

Returns:

  • (String)


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

def image_name
  @image_name
end

#image_uuidString

UUID of the image. Used in Domestic Labels and Return Labels requests to apply an image to a label.

Returns:

  • (String)


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

def image_uuid
  @image_uuid
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/usps_api/models/label_branding_get_image_response.rb', line 65

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  image_uuid = hash.key?('imageUUID') ? hash['imageUUID'] : SKIP
  image_name = hash.key?('imageName') ? hash['imageName'] : SKIP
  image_data = hash.key?('imageData') ? hash['imageData'] : SKIP
  created_date_time = if hash.key?('createdDateTime')
                        (DateTimeHelper.from_rfc3339(hash['createdDateTime']) if hash['createdDateTime'])
                      else
                        SKIP
                      end

  # Create object from extracted values.
  LabelBrandingGetImageResponse.new(image_uuid: image_uuid,
                                    image_name: image_name,
                                    image_data: image_data,
                                    created_date_time: created_date_time)
end

.namesObject

A mapping from model property names to API property names.



32
33
34
35
36
37
38
39
# File 'lib/usps_api/models/label_branding_get_image_response.rb', line 32

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['image_uuid'] = 'imageUUID'
  @_hash['image_name'] = 'imageName'
  @_hash['image_data'] = 'imageData'
  @_hash['created_date_time'] = 'createdDateTime'
  @_hash
end

.nullablesObject

An array for nullable fields



52
53
54
# File 'lib/usps_api/models/label_branding_get_image_response.rb', line 52

def self.nullables
  []
end

.optionalsObject

An array for optional fields



42
43
44
45
46
47
48
49
# File 'lib/usps_api/models/label_branding_get_image_response.rb', line 42

def self.optionals
  %w[
    image_uuid
    image_name
    image_data
    created_date_time
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



97
98
99
100
101
# File 'lib/usps_api/models/label_branding_get_image_response.rb', line 97

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} image_uuid: #{@image_uuid.inspect}, image_name: #{@image_name.inspect},"\
  " image_data: #{@image_data.inspect}, created_date_time: #{@created_date_time.inspect}>"
end

#to_custom_created_date_timeObject



85
86
87
# File 'lib/usps_api/models/label_branding_get_image_response.rb', line 85

def to_custom_created_date_time
  DateTimeHelper.to_rfc3339(created_date_time)
end

#to_sObject

Provides a human-readable string representation of the object.



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

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} image_uuid: #{@image_uuid}, image_name: #{@image_name}, image_data:"\
  " #{@image_data}, created_date_time: #{@created_date_time}>"
end