Class: UspsApi::LabelBrandingGetListOfImagesResponseWithPagination

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

Overview

Paginated response schema for getting a list of label branding images.

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(images: SKIP, limit: SKIP, offset: SKIP, total_count: SKIP, additional_properties: nil) ⇒ LabelBrandingGetListOfImagesResponseWithPagination

Returns a new instance of LabelBrandingGetListOfImagesResponseWithPagination.



54
55
56
57
58
59
60
61
62
63
64
# File 'lib/usps_api/models/label_branding_get_list_of_images_response_with_pagination.rb', line 54

def initialize(images: SKIP, limit: SKIP, offset: SKIP, total_count: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @images = images unless images == SKIP
  @limit = limit unless limit == SKIP
  @offset = offset unless offset == SKIP
  @total_count = total_count unless total_count == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#imagesArray[Image]

List of all label branding image names associated with the USPS Customer Registration ID (CRID).

Returns:



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

def images
  @images
end

#limitInteger

Current limit on number of included results.

Returns:

  • (Integer)


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

def limit
  @limit
end

#offsetInteger

Number of items skipped.

Returns:

  • (Integer)


23
24
25
# File 'lib/usps_api/models/label_branding_get_list_of_images_response_with_pagination.rb', line 23

def offset
  @offset
end

#total_countInteger

Total number of items.

Returns:

  • (Integer)


27
28
29
# File 'lib/usps_api/models/label_branding_get_list_of_images_response_with_pagination.rb', line 27

def total_count
  @total_count
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/usps_api/models/label_branding_get_list_of_images_response_with_pagination.rb', line 67

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  # Parameter is an array, so we need to iterate through it
  images = nil
  unless hash['images'].nil?
    images = []
    hash['images'].each do |structure|
      images << (Image.from_hash(structure) if structure)
    end
  end

  images = SKIP unless hash.key?('images')
  limit = hash.key?('limit') ? hash['limit'] : SKIP
  offset = hash.key?('offset') ? hash['offset'] : SKIP
  total_count = hash.key?('totalCount') ? hash['totalCount'] : SKIP

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  LabelBrandingGetListOfImagesResponseWithPagination.new(images: images,
                                                         limit: limit,
                                                         offset: offset,
                                                         total_count: total_count,
                                                         additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



30
31
32
33
34
35
36
37
# File 'lib/usps_api/models/label_branding_get_list_of_images_response_with_pagination.rb', line 30

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['images'] = 'images'
  @_hash['limit'] = 'limit'
  @_hash['offset'] = 'offset'
  @_hash['total_count'] = 'totalCount'
  @_hash
end

.nullablesObject

An array for nullable fields



50
51
52
# File 'lib/usps_api/models/label_branding_get_list_of_images_response_with_pagination.rb', line 50

def self.nullables
  []
end

.optionalsObject

An array for optional fields



40
41
42
43
44
45
46
47
# File 'lib/usps_api/models/label_branding_get_list_of_images_response_with_pagination.rb', line 40

def self.optionals
  %w[
    images
    limit
    offset
    total_count
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



108
109
110
111
112
113
# File 'lib/usps_api/models/label_branding_get_list_of_images_response_with_pagination.rb', line 108

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} images: #{@images.inspect}, limit: #{@limit.inspect}, offset:"\
  " #{@offset.inspect}, total_count: #{@total_count.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



101
102
103
104
105
# File 'lib/usps_api/models/label_branding_get_list_of_images_response_with_pagination.rb', line 101

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} images: #{@images}, limit: #{@limit}, offset: #{@offset}, total_count:"\
  " #{@total_count}, additional_properties: #{@additional_properties}>"
end