Class: AmznSpApi::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

Raises:

  • (ArgumentError)


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
99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'lib/aplus_content_api_model/models/content_module.rb', line 68

def initialize(attributes = {})
  raise ArgumentError, 'The input argument (attributes) must be a hash in `AmznSpApi::AplusContentApiModel::ContentModule` initialize method' unless attributes.is_a?(Hash)

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

    h[k.to_sym] = v
  end

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  return unless attributes.key?(:standard_three_image_text)

  self.standard_three_image_text = attributes[:standard_three_image_text]
end

Instance Attribute Details

#content_module_typeObject

Returns the value of attribute content_module_type.



15
16
17
# File 'lib/aplus_content_api_model/models/content_module.rb', line 15

def content_module_type
  @content_module_type
end

#standard_company_logoObject

Returns the value of attribute standard_company_logo.



15
16
17
# File 'lib/aplus_content_api_model/models/content_module.rb', line 15

def 
  @standard_company_logo
end

#standard_comparison_tableObject

Returns the value of attribute standard_comparison_table.



15
16
17
# File 'lib/aplus_content_api_model/models/content_module.rb', line 15

def standard_comparison_table
  @standard_comparison_table
end

#standard_four_image_textObject

Returns the value of attribute standard_four_image_text.



15
16
17
# File 'lib/aplus_content_api_model/models/content_module.rb', line 15

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.



15
16
17
# File 'lib/aplus_content_api_model/models/content_module.rb', line 15

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.



15
16
17
# File 'lib/aplus_content_api_model/models/content_module.rb', line 15

def standard_header_image_text
  @standard_header_image_text
end

#standard_image_sidebarObject

Returns the value of attribute standard_image_sidebar.



15
16
17
# File 'lib/aplus_content_api_model/models/content_module.rb', line 15

def standard_image_sidebar
  @standard_image_sidebar
end

#standard_image_text_overlayObject

Returns the value of attribute standard_image_text_overlay.



15
16
17
# File 'lib/aplus_content_api_model/models/content_module.rb', line 15

def standard_image_text_overlay
  @standard_image_text_overlay
end

#standard_multiple_image_textObject

Returns the value of attribute standard_multiple_image_text.



15
16
17
# File 'lib/aplus_content_api_model/models/content_module.rb', line 15

def standard_multiple_image_text
  @standard_multiple_image_text
end

#standard_product_descriptionObject

Returns the value of attribute standard_product_description.



15
16
17
# File 'lib/aplus_content_api_model/models/content_module.rb', line 15

def standard_product_description
  @standard_product_description
end

#standard_single_image_highlightsObject

Returns the value of attribute standard_single_image_highlights.



15
16
17
# File 'lib/aplus_content_api_model/models/content_module.rb', line 15

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.



15
16
17
# File 'lib/aplus_content_api_model/models/content_module.rb', line 15

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.



15
16
17
# File 'lib/aplus_content_api_model/models/content_module.rb', line 15

def standard_single_side_image
  @standard_single_side_image
end

#standard_tech_specsObject

Returns the value of attribute standard_tech_specs.



15
16
17
# File 'lib/aplus_content_api_model/models/content_module.rb', line 15

def standard_tech_specs
  @standard_tech_specs
end

#standard_textObject

Returns the value of attribute standard_text.



15
16
17
# File 'lib/aplus_content_api_model/models/content_module.rb', line 15

def standard_text
  @standard_text
end

#standard_three_image_textObject

Returns the value of attribute standard_three_image_text.



15
16
17
# File 'lib/aplus_content_api_model/models/content_module.rb', line 15

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.



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/aplus_content_api_model/models/content_module.rb', line 18

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



169
170
171
# File 'lib/aplus_content_api_model/models/content_module.rb', line 169

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

.openapi_nullableObject

List of attributes with nullable: true



62
63
64
# File 'lib/aplus_content_api_model/models/content_module.rb', line 62

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

.openapi_typesObject

Attribute type mapping.



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/aplus_content_api_model/models/content_module.rb', line 40

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

#==(other) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
# File 'lib/aplus_content_api_model/models/content_module.rb', line 132

def ==(other)
  return true if equal?(other)

  self.class == other.class &&
    content_module_type == other.content_module_type &&
     == other. &&
    standard_comparison_table == other.standard_comparison_table &&
    standard_four_image_text == other.standard_four_image_text &&
    standard_four_image_text_quadrant == other.standard_four_image_text_quadrant &&
    standard_header_image_text == other.standard_header_image_text &&
    standard_image_sidebar == other.standard_image_sidebar &&
    standard_image_text_overlay == other.standard_image_text_overlay &&
    standard_multiple_image_text == other.standard_multiple_image_text &&
    standard_product_description == other.standard_product_description &&
    standard_single_image_highlights == other.standard_single_image_highlights &&
    standard_single_image_specs_detail == other.standard_single_image_specs_detail &&
    standard_single_side_image == other.standard_single_side_image &&
    standard_tech_specs == other.standard_tech_specs &&
    standard_text == other.standard_text &&
    standard_three_image_text == other.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



198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
# File 'lib/aplus_content_api_model/models/content_module.rb', line 198

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
    AmznSpApi::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



267
268
269
270
271
272
273
274
275
276
277
278
279
# File 'lib/aplus_content_api_model/models/content_module.rb', line 267

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



176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
# File 'lib/aplus_content_api_model/models/content_module.rb', line 176

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
      send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize(::Regexp.last_match(1), v) }) if attributes[self.class.attribute_map[key]].is_a?(Array)
    elsif !attributes[self.class.attribute_map[key]].nil?
      send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
    elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
      send("#{key}=", nil)
    end
  end

  self
end

#eql?(other) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


156
157
158
# File 'lib/aplus_content_api_model/models/content_module.rb', line 156

def eql?(other)
  self == other
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



162
163
164
# File 'lib/aplus_content_api_model/models/content_module.rb', line 162

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



115
116
117
118
119
120
# File 'lib/aplus_content_api_model/models/content_module.rb', line 115

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

  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



243
244
245
# File 'lib/aplus_content_api_model/models/content_module.rb', line 243

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



249
250
251
252
253
254
255
256
257
258
259
260
261
# File 'lib/aplus_content_api_model/models/content_module.rb', line 249

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = 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



237
238
239
# File 'lib/aplus_content_api_model/models/content_module.rb', line 237

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



124
125
126
127
128
# File 'lib/aplus_content_api_model/models/content_module.rb', line 124

def valid?
  return false if @content_module_type.nil?

  true
end