Class: WalmartApIs::CreateMarketplaceItemLabelsRequest

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/walmart_ap_is/models/create_marketplace_item_labels_request.rb

Overview

The createMarketplaceItemLabels 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(label_type:, marketplace_id:, msku_quantities:, height: SKIP, locale_code: 'en_US', page_type: SKIP, width: SKIP, additional_properties: nil) ⇒ CreateMarketplaceItemLabelsRequest

Returns a new instance of CreateMarketplaceItemLabelsRequest.



71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/walmart_ap_is/models/create_marketplace_item_labels_request.rb', line 71

def initialize(label_type:, marketplace_id:, msku_quantities:, height: SKIP,
               locale_code: 'en_US', page_type: SKIP, width: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @height = height unless height == SKIP
  @label_type = label_type
  @locale_code = locale_code unless locale_code == SKIP
  @marketplace_id = marketplace_id
  @msku_quantities = msku_quantities
  @page_type = page_type unless page_type == SKIP
  @width = width unless width == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#heightFloat

The height of the item label.

Returns:

  • (Float)


14
15
16
# File 'lib/walmart_ap_is/models/create_marketplace_item_labels_request.rb', line 14

def height
  @height
end

#label_typeLabelPrintType

Indicates the type of print type for a given label.

Returns:



18
19
20
# File 'lib/walmart_ap_is/models/create_marketplace_item_labels_request.rb', line 18

def label_type
  @label_type
end

#locale_codeString

The locale code constructed from ISO 639 language code and ISO 3166-1 alpha-2 country codes separated by an underscore character.

Returns:

  • (String)


23
24
25
# File 'lib/walmart_ap_is/models/create_marketplace_item_labels_request.rb', line 23

def locale_code
  @locale_code
end

#marketplace_idString

The Walmart Marketplace ID. For a list of possible values, refer to Marketplace IDs.

Returns:

  • (String)


29
30
31
# File 'lib/walmart_ap_is/models/create_marketplace_item_labels_request.rb', line 29

def marketplace_id
  @marketplace_id
end

#msku_quantitiesArray[MskuQuantity]

Represents the quantity of an MSKU to print item labels for.

Returns:



33
34
35
# File 'lib/walmart_ap_is/models/create_marketplace_item_labels_request.rb', line 33

def msku_quantities
  @msku_quantities
end

#page_typeItemLabelPageType

The page type to use to print the labels.

Returns:



37
38
39
# File 'lib/walmart_ap_is/models/create_marketplace_item_labels_request.rb', line 37

def page_type
  @page_type
end

#widthFloat

The width of the item label.

Returns:

  • (Float)


41
42
43
# File 'lib/walmart_ap_is/models/create_marketplace_item_labels_request.rb', line 41

def width
  @width
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# File 'lib/walmart_ap_is/models/create_marketplace_item_labels_request.rb', line 88

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  label_type = hash.key?('labelType') ? hash['labelType'] : nil
  marketplace_id = hash.key?('marketplaceId') ? hash['marketplaceId'] : nil
  # Parameter is an array, so we need to iterate through it
  msku_quantities = nil
  unless hash['mskuQuantities'].nil?
    msku_quantities = []
    hash['mskuQuantities'].each do |structure|
      msku_quantities << (MskuQuantity.from_hash(structure) if structure)
    end
  end

  msku_quantities = nil unless hash.key?('mskuQuantities')
  height = hash.key?('height') ? hash['height'] : SKIP
  locale_code = hash['localeCode'] ||= 'en_US'
  page_type = hash.key?('pageType') ? hash['pageType'] : SKIP
  width = hash.key?('width') ? hash['width'] : 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.
  CreateMarketplaceItemLabelsRequest.new(label_type: label_type,
                                         marketplace_id: marketplace_id,
                                         msku_quantities: msku_quantities,
                                         height: height,
                                         locale_code: locale_code,
                                         page_type: page_type,
                                         width: width,
                                         additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



44
45
46
47
48
49
50
51
52
53
54
# File 'lib/walmart_ap_is/models/create_marketplace_item_labels_request.rb', line 44

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['height'] = 'height'
  @_hash['label_type'] = 'labelType'
  @_hash['locale_code'] = 'localeCode'
  @_hash['marketplace_id'] = 'marketplaceId'
  @_hash['msku_quantities'] = 'mskuQuantities'
  @_hash['page_type'] = 'pageType'
  @_hash['width'] = 'width'
  @_hash
end

.nullablesObject

An array for nullable fields



67
68
69
# File 'lib/walmart_ap_is/models/create_marketplace_item_labels_request.rb', line 67

def self.nullables
  []
end

.optionalsObject

An array for optional fields



57
58
59
60
61
62
63
64
# File 'lib/walmart_ap_is/models/create_marketplace_item_labels_request.rb', line 57

def self.optionals
  %w[
    height
    locale_code
    page_type
    width
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



137
138
139
140
141
142
143
# File 'lib/walmart_ap_is/models/create_marketplace_item_labels_request.rb', line 137

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} height: #{@height.inspect}, label_type: #{@label_type.inspect},"\
  " locale_code: #{@locale_code.inspect}, marketplace_id: #{@marketplace_id.inspect},"\
  " msku_quantities: #{@msku_quantities.inspect}, page_type: #{@page_type.inspect}, width:"\
  " #{@width.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



128
129
130
131
132
133
134
# File 'lib/walmart_ap_is/models/create_marketplace_item_labels_request.rb', line 128

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} height: #{@height}, label_type: #{@label_type}, locale_code:"\
  " #{@locale_code}, marketplace_id: #{@marketplace_id}, msku_quantities: #{@msku_quantities},"\
  " page_type: #{@page_type}, width: #{@width}, additional_properties:"\
  " #{@additional_properties}>"
end