Class: AmzSpApi::AplusContentApiModel::ContentModule

Inherits:
Object
  • Object
show all
Defined in:
lib/aplus-content-api-model/models/content_module.rb

Overview

An A+ Content module. An A+ Content document is composed of content modules. The contentModuleType property selects which content module types to use.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ ContentModule

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
# File 'lib/aplus-content-api-model/models/content_module.rb', line 101

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `AmzSpApi::AplusContentApiModel::ContentModule` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!self.class.attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `AmzSpApi::AplusContentApiModel::ContentModule`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'content_module_type')
    self.content_module_type = attributes[:'content_module_type']
  end

  if attributes.key?(:'standard_company_logo')
    self. = attributes[:'standard_company_logo']
  end

  if attributes.key?(:'standard_comparison_table')
    self.standard_comparison_table = attributes[:'standard_comparison_table']
  end

  if attributes.key?(:'standard_four_image_text')
    self.standard_four_image_text = attributes[:'standard_four_image_text']
  end

  if attributes.key?(:'standard_four_image_text_quadrant')
    self.standard_four_image_text_quadrant = attributes[:'standard_four_image_text_quadrant']
  end

  if attributes.key?(:'standard_header_image_text')
    self.standard_header_image_text = attributes[:'standard_header_image_text']
  end

  if attributes.key?(:'standard_image_sidebar')
    self.standard_image_sidebar = attributes[:'standard_image_sidebar']
  end

  if attributes.key?(:'standard_image_text_overlay')
    self.standard_image_text_overlay = attributes[:'standard_image_text_overlay']
  end

  if attributes.key?(:'standard_multiple_image_text')
    self.standard_multiple_image_text = attributes[:'standard_multiple_image_text']
  end

  if attributes.key?(:'standard_product_description')
    self.standard_product_description = attributes[:'standard_product_description']
  end

  if attributes.key?(:'standard_single_image_highlights')
    self.standard_single_image_highlights = attributes[:'standard_single_image_highlights']
  end

  if attributes.key?(:'standard_single_image_specs_detail')
    self.standard_single_image_specs_detail = attributes[:'standard_single_image_specs_detail']
  end

  if attributes.key?(:'standard_single_side_image')
    self.standard_single_side_image = attributes[:'standard_single_side_image']
  end

  if attributes.key?(:'standard_tech_specs')
    self.standard_tech_specs = attributes[:'standard_tech_specs']
  end

  if attributes.key?(:'standard_text')
    self.standard_text = attributes[:'standard_text']
  end

  if attributes.key?(:'standard_three_image_text')
    self.standard_three_image_text = attributes[:'standard_three_image_text']
  end
end

Instance Attribute Details

#content_module_typeObject

Returns the value of attribute content_module_type.



17
18
19
# File 'lib/aplus-content-api-model/models/content_module.rb', line 17

def content_module_type
  @content_module_type
end

#standard_company_logoObject

Returns the value of attribute standard_company_logo.



19
20
21
# File 'lib/aplus-content-api-model/models/content_module.rb', line 19

def 
  @standard_company_logo
end

#standard_comparison_tableObject

Returns the value of attribute standard_comparison_table.



21
22
23
# File 'lib/aplus-content-api-model/models/content_module.rb', line 21

def standard_comparison_table
  @standard_comparison_table
end

#standard_four_image_textObject

Returns the value of attribute standard_four_image_text.



23
24
25
# File 'lib/aplus-content-api-model/models/content_module.rb', line 23

def standard_four_image_text
  @standard_four_image_text
end

#standard_four_image_text_quadrantObject

Returns the value of attribute standard_four_image_text_quadrant.



25
26
27
# File 'lib/aplus-content-api-model/models/content_module.rb', line 25

def standard_four_image_text_quadrant
  @standard_four_image_text_quadrant
end

#standard_header_image_textObject

Returns the value of attribute standard_header_image_text.



27
28
29
# File 'lib/aplus-content-api-model/models/content_module.rb', line 27

def standard_header_image_text
  @standard_header_image_text
end

#standard_image_sidebarObject

Returns the value of attribute standard_image_sidebar.



29
30
31
# File 'lib/aplus-content-api-model/models/content_module.rb', line 29

def standard_image_sidebar
  @standard_image_sidebar
end

#standard_image_text_overlayObject

Returns the value of attribute standard_image_text_overlay.



31
32
33
# File 'lib/aplus-content-api-model/models/content_module.rb', line 31

def standard_image_text_overlay
  @standard_image_text_overlay
end

#standard_multiple_image_textObject

Returns the value of attribute standard_multiple_image_text.



33
34
35
# File 'lib/aplus-content-api-model/models/content_module.rb', line 33

def standard_multiple_image_text
  @standard_multiple_image_text
end

#standard_product_descriptionObject

Returns the value of attribute standard_product_description.



35
36
37
# File 'lib/aplus-content-api-model/models/content_module.rb', line 35

def standard_product_description
  @standard_product_description
end

#standard_single_image_highlightsObject

Returns the value of attribute standard_single_image_highlights.



37
38
39
# File 'lib/aplus-content-api-model/models/content_module.rb', line 37

def standard_single_image_highlights
  @standard_single_image_highlights
end

#standard_single_image_specs_detailObject

Returns the value of attribute standard_single_image_specs_detail.



39
40
41
# File 'lib/aplus-content-api-model/models/content_module.rb', line 39

def standard_single_image_specs_detail
  @standard_single_image_specs_detail
end

#standard_single_side_imageObject

Returns the value of attribute standard_single_side_image.



41
42
43
# File 'lib/aplus-content-api-model/models/content_module.rb', line 41

def standard_single_side_image
  @standard_single_side_image
end

#standard_tech_specsObject

Returns the value of attribute standard_tech_specs.



43
44
45
# File 'lib/aplus-content-api-model/models/content_module.rb', line 43

def standard_tech_specs
  @standard_tech_specs
end

#standard_textObject

Returns the value of attribute standard_text.



45
46
47
# File 'lib/aplus-content-api-model/models/content_module.rb', line 45

def standard_text
  @standard_text
end

#standard_three_image_textObject

Returns the value of attribute standard_three_image_text.



47
48
49
# File 'lib/aplus-content-api-model/models/content_module.rb', line 47

def standard_three_image_text
  @standard_three_image_text
end

Class Method Details

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/aplus-content-api-model/models/content_module.rb', line 50

def self.attribute_map
  {
    :'content_module_type' => :'contentModuleType',
    :'standard_company_logo' => :'standardCompanyLogo',
    :'standard_comparison_table' => :'standardComparisonTable',
    :'standard_four_image_text' => :'standardFourImageText',
    :'standard_four_image_text_quadrant' => :'standardFourImageTextQuadrant',
    :'standard_header_image_text' => :'standardHeaderImageText',
    :'standard_image_sidebar' => :'standardImageSidebar',
    :'standard_image_text_overlay' => :'standardImageTextOverlay',
    :'standard_multiple_image_text' => :'standardMultipleImageText',
    :'standard_product_description' => :'standardProductDescription',
    :'standard_single_image_highlights' => :'standardSingleImageHighlights',
    :'standard_single_image_specs_detail' => :'standardSingleImageSpecsDetail',
    :'standard_single_side_image' => :'standardSingleSideImage',
    :'standard_tech_specs' => :'standardTechSpecs',
    :'standard_text' => :'standardText',
    :'standard_three_image_text' => :'standardThreeImageText'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



235
236
237
# File 'lib/aplus-content-api-model/models/content_module.rb', line 235

def self.build_from_hash(attributes)
  new.build_from_hash(attributes)
end

.openapi_nullableObject

List of attributes with nullable: true



94
95
96
97
# File 'lib/aplus-content-api-model/models/content_module.rb', line 94

def self.openapi_nullable
  Set.new([
  ])
end

.openapi_typesObject

Attribute type mapping.



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/aplus-content-api-model/models/content_module.rb', line 72

def self.openapi_types
  {
    :'content_module_type' => :'Object',
    :'standard_company_logo' => :'Object',
    :'standard_comparison_table' => :'Object',
    :'standard_four_image_text' => :'Object',
    :'standard_four_image_text_quadrant' => :'Object',
    :'standard_header_image_text' => :'Object',
    :'standard_image_sidebar' => :'Object',
    :'standard_image_text_overlay' => :'Object',
    :'standard_multiple_image_text' => :'Object',
    :'standard_product_description' => :'Object',
    :'standard_single_image_highlights' => :'Object',
    :'standard_single_image_specs_detail' => :'Object',
    :'standard_single_side_image' => :'Object',
    :'standard_tech_specs' => :'Object',
    :'standard_text' => :'Object',
    :'standard_three_image_text' => :'Object'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
# File 'lib/aplus-content-api-model/models/content_module.rb', line 199

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      content_module_type == o.content_module_type &&
       == o. &&
      standard_comparison_table == o.standard_comparison_table &&
      standard_four_image_text == o.standard_four_image_text &&
      standard_four_image_text_quadrant == o.standard_four_image_text_quadrant &&
      standard_header_image_text == o.standard_header_image_text &&
      standard_image_sidebar == o.standard_image_sidebar &&
      standard_image_text_overlay == o.standard_image_text_overlay &&
      standard_multiple_image_text == o.standard_multiple_image_text &&
      standard_product_description == o.standard_product_description &&
      standard_single_image_highlights == o.standard_single_image_highlights &&
      standard_single_image_specs_detail == o.standard_single_image_specs_detail &&
      standard_single_side_image == o.standard_single_side_image &&
      standard_tech_specs == o.standard_tech_specs &&
      standard_text == o.standard_text &&
      standard_three_image_text == o.standard_three_image_text
end

#_deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
# File 'lib/aplus-content-api-model/models/content_module.rb', line 265

def _deserialize(type, value)
  case type.to_sym
  when :DateTime
    DateTime.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :Boolean
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    AmzSpApi::AplusContentApiModel.const_get(type).build_from_hash(value)
  end
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



334
335
336
337
338
339
340
341
342
343
344
345
346
# File 'lib/aplus-content-api-model/models/content_module.rb', line 334

def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map { |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
# File 'lib/aplus-content-api-model/models/content_module.rb', line 242

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  self.class.openapi_types.each_pair do |key, type|
    if type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
    elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
      self.send("#{key}=", nil)
    end
  end

  self
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


222
223
224
# File 'lib/aplus-content-api-model/models/content_module.rb', line 222

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



228
229
230
# File 'lib/aplus-content-api-model/models/content_module.rb', line 228

def hash
  [content_module_type, , standard_comparison_table, standard_four_image_text, standard_four_image_text_quadrant, standard_header_image_text, standard_image_sidebar, standard_image_text_overlay, standard_multiple_image_text, standard_product_description, standard_single_image_highlights, standard_single_image_specs_detail, standard_single_side_image, standard_tech_specs, standard_text, standard_three_image_text].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



181
182
183
184
185
186
187
188
# File 'lib/aplus-content-api-model/models/content_module.rb', line 181

def list_invalid_properties
  invalid_properties = Array.new
  if @content_module_type.nil?
    invalid_properties.push('invalid value for "content_module_type", content_module_type cannot be nil.')
  end

  invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



310
311
312
# File 'lib/aplus-content-api-model/models/content_module.rb', line 310

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



316
317
318
319
320
321
322
323
324
325
326
327
328
# File 'lib/aplus-content-api-model/models/content_module.rb', line 316

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end

    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



304
305
306
# File 'lib/aplus-content-api-model/models/content_module.rb', line 304

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



192
193
194
195
# File 'lib/aplus-content-api-model/models/content_module.rb', line 192

def valid?
  return false if @content_module_type.nil?
  true
end