Class: UspsApi::LabelBrandingImageUploadRequest

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

Overview

Label Branding Image Upload Request

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_data:, image_name: SKIP) ⇒ LabelBrandingImageUploadRequest

Returns a new instance of LabelBrandingImageUploadRequest.



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

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

Instance Attribute Details

#image_dataString

The plaintext contents of an .svg file base64 encoded. The image must be less than 10kb in size.

Returns:

  • (String)


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

def image_data
  @image_data
end

#image_nameString

An optional descriptor for the image. Additional requirements:

  • No special characters or spaces

  • No more than 50 characters in length

Returns:

  • (String)


17
18
19
# File 'lib/usps_api/models/label_branding_image_upload_request.rb', line 17

def image_name
  @image_name
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



50
51
52
53
54
55
56
57
58
59
60
# File 'lib/usps_api/models/label_branding_image_upload_request.rb', line 50

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  image_data = hash.key?('imageData') ? hash['imageData'] : nil
  image_name = hash.key?('imageName') ? hash['imageName'] : SKIP

  # Create object from extracted values.
  LabelBrandingImageUploadRequest.new(image_data: image_data,
                                      image_name: image_name)
end

.namesObject

A mapping from model property names to API property names.



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

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

.nullablesObject

An array for nullable fields



40
41
42
# File 'lib/usps_api/models/label_branding_image_upload_request.rb', line 40

def self.nullables
  []
end

.optionalsObject

An array for optional fields



33
34
35
36
37
# File 'lib/usps_api/models/label_branding_image_upload_request.rb', line 33

def self.optionals
  %w[
    image_name
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



69
70
71
72
# File 'lib/usps_api/models/label_branding_image_upload_request.rb', line 69

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

#to_sObject

Provides a human-readable string representation of the object.



63
64
65
66
# File 'lib/usps_api/models/label_branding_image_upload_request.rb', line 63

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