Class: OpenapiClient::ElementCustomization

Inherits:
Object
  • Object
show all
Defined in:
lib/openapi_client/models/element_customization.rb

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ ElementCustomization

Initializes the object

Parameters:

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

    Model attributes in the form of hash



163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
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
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
# File 'lib/openapi_client/models/element_customization.rb', line 163

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::ElementCustomization` 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 `OpenapiClient::ElementCustomization`. 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?(:'passage_container_background_color')
    self.passage_container_background_color = attributes[:'passage_container_background_color']
  end

  if attributes.key?(:'passage_container_max_width')
    self.passage_container_max_width = attributes[:'passage_container_max_width']
  else
    self.passage_container_max_width = 300
  end

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

  if attributes.key?(:'passage_input_box_border_radius')
    self.passage_input_box_border_radius = attributes[:'passage_input_box_border_radius']
  else
    self.passage_input_box_border_radius = 5
  end

  if attributes.key?(:'passage_header_font_family')
    self.passage_header_font_family = attributes[:'passage_header_font_family']
  else
    self.passage_header_font_family = 'Helvetica'
  end

  if attributes.key?(:'passage_body_font_family')
    self.passage_body_font_family = attributes[:'passage_body_font_family']
  else
    self.passage_body_font_family = 'Helvetica'
  end

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

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

  if attributes.key?(:'passage_primary_button_background_color')
    self.passage_primary_button_background_color = attributes[:'passage_primary_button_background_color']
  else
    self.passage_primary_button_background_color = '#121212'
  end

  if attributes.key?(:'passage_primary_button_text_color')
    self.passage_primary_button_text_color = attributes[:'passage_primary_button_text_color']
  else
    self.passage_primary_button_text_color = '#f3f3f3'
  end

  if attributes.key?(:'passage_primary_button_hover_color')
    self.passage_primary_button_hover_color = attributes[:'passage_primary_button_hover_color']
  else
    self.passage_primary_button_hover_color = '#4d4d4d'
  end

  if attributes.key?(:'passage_primary_button_border_radius')
    self.passage_primary_button_border_radius = attributes[:'passage_primary_button_border_radius']
  else
    self.passage_primary_button_border_radius = 5
  end

  if attributes.key?(:'passage_primary_button_border_color')
    self.passage_primary_button_border_color = attributes[:'passage_primary_button_border_color']
  else
    self.passage_primary_button_border_color = '#121212'
  end

  if attributes.key?(:'passage_primary_button_border_width')
    self.passage_primary_button_border_width = attributes[:'passage_primary_button_border_width']
  else
    self.passage_primary_button_border_width = 0
  end

  if attributes.key?(:'passage_secondary_button_background_color')
    self.passage_secondary_button_background_color = attributes[:'passage_secondary_button_background_color']
  else
    self.passage_secondary_button_background_color = '#ffffff'
  end

  if attributes.key?(:'passage_secondary_button_text_color')
    self.passage_secondary_button_text_color = attributes[:'passage_secondary_button_text_color']
  else
    self.passage_secondary_button_text_color = '#222222'
  end

  if attributes.key?(:'passage_secondary_button_hover_color')
    self.passage_secondary_button_hover_color = attributes[:'passage_secondary_button_hover_color']
  else
    self.passage_secondary_button_hover_color = '#d7d7d7'
  end

  if attributes.key?(:'passage_secondary_button_border_radius')
    self.passage_secondary_button_border_radius = attributes[:'passage_secondary_button_border_radius']
  else
    self.passage_secondary_button_border_radius = 5
  end

  if attributes.key?(:'passage_secondary_button_border_color')
    self.passage_secondary_button_border_color = attributes[:'passage_secondary_button_border_color']
  else
    self.passage_secondary_button_border_color = '#d7d7d7'
  end

  if attributes.key?(:'passage_secondary_button_border_width')
    self.passage_secondary_button_border_width = attributes[:'passage_secondary_button_border_width']
  else
    self.passage_secondary_button_border_width = 1
  end
end

Instance Attribute Details

#passage_body_font_familyObject

Returns the value of attribute passage_body_font_family.



32
33
34
# File 'lib/openapi_client/models/element_customization.rb', line 32

def passage_body_font_family
  @passage_body_font_family
end

#passage_body_text_colorObject

Body text color in hex. Default is ‘#222222` in light mode & `#f3f3f3` in dark mode.



38
39
40
# File 'lib/openapi_client/models/element_customization.rb', line 38

def passage_body_text_color
  @passage_body_text_color
end

#passage_container_background_colorObject

Container background color in hex. Default is ‘#ffffff` in light mode & `#383838` in dark mode.



19
20
21
# File 'lib/openapi_client/models/element_customization.rb', line 19

def passage_container_background_color
  @passage_container_background_color
end

#passage_container_max_widthObject

Maximum width of container (px)



22
23
24
# File 'lib/openapi_client/models/element_customization.rb', line 22

def passage_container_max_width
  @passage_container_max_width
end

#passage_header_font_familyObject

Returns the value of attribute passage_header_font_family.



30
31
32
# File 'lib/openapi_client/models/element_customization.rb', line 30

def passage_header_font_family
  @passage_header_font_family
end

#passage_header_text_colorObject

Header text color in hex. Default is ‘#222222` in light mode & `#f3f3f3` in dark mode.



35
36
37
# File 'lib/openapi_client/models/element_customization.rb', line 35

def passage_header_text_color
  @passage_header_text_color
end

#passage_input_box_background_colorObject

Input box background color in hex. Default is ‘#ffffff` in light mode & `#4b4b4b` in dark mode.



25
26
27
# File 'lib/openapi_client/models/element_customization.rb', line 25

def passage_input_box_background_color
  @passage_input_box_background_color
end

#passage_input_box_border_radiusObject

Input box border radius (px)



28
29
30
# File 'lib/openapi_client/models/element_customization.rb', line 28

def passage_input_box_border_radius
  @passage_input_box_border_radius
end

#passage_primary_button_background_colorObject

Primary button background colour (hex)



41
42
43
# File 'lib/openapi_client/models/element_customization.rb', line 41

def passage_primary_button_background_color
  @passage_primary_button_background_color
end

#passage_primary_button_border_colorObject

Primary button border color



53
54
55
# File 'lib/openapi_client/models/element_customization.rb', line 53

def passage_primary_button_border_color
  @passage_primary_button_border_color
end

#passage_primary_button_border_radiusObject

Primary button border radius (px)



50
51
52
# File 'lib/openapi_client/models/element_customization.rb', line 50

def passage_primary_button_border_radius
  @passage_primary_button_border_radius
end

#passage_primary_button_border_widthObject

Primary button border width (px)



56
57
58
# File 'lib/openapi_client/models/element_customization.rb', line 56

def passage_primary_button_border_width
  @passage_primary_button_border_width
end

#passage_primary_button_hover_colorObject

Primary button background on hover (hex)



47
48
49
# File 'lib/openapi_client/models/element_customization.rb', line 47

def passage_primary_button_hover_color
  @passage_primary_button_hover_color
end

#passage_primary_button_text_colorObject

Primary button font colour (hex)



44
45
46
# File 'lib/openapi_client/models/element_customization.rb', line 44

def passage_primary_button_text_color
  @passage_primary_button_text_color
end

#passage_secondary_button_background_colorObject

Secondary button background colour (hex)



59
60
61
# File 'lib/openapi_client/models/element_customization.rb', line 59

def passage_secondary_button_background_color
  @passage_secondary_button_background_color
end

#passage_secondary_button_border_colorObject

Secondary button border color



71
72
73
# File 'lib/openapi_client/models/element_customization.rb', line 71

def passage_secondary_button_border_color
  @passage_secondary_button_border_color
end

#passage_secondary_button_border_radiusObject

Secondary button border radius (px)



68
69
70
# File 'lib/openapi_client/models/element_customization.rb', line 68

def passage_secondary_button_border_radius
  @passage_secondary_button_border_radius
end

#passage_secondary_button_border_widthObject

Secondary button border width (px)



74
75
76
# File 'lib/openapi_client/models/element_customization.rb', line 74

def passage_secondary_button_border_width
  @passage_secondary_button_border_width
end

#passage_secondary_button_hover_colorObject

Secondary button background on hover (hex)



65
66
67
# File 'lib/openapi_client/models/element_customization.rb', line 65

def passage_secondary_button_hover_color
  @passage_secondary_button_hover_color
end

#passage_secondary_button_text_colorObject

Secondary button font colour (hex)



62
63
64
# File 'lib/openapi_client/models/element_customization.rb', line 62

def passage_secondary_button_text_color
  @passage_secondary_button_text_color
end

Class Method Details

._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



370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
# File 'lib/openapi_client/models/element_customization.rb', line 370

def self._deserialize(type, value)
  case type.to_sym
  when :Time
    Time.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
    # models (e.g. Pet) or oneOf
    klass = OpenapiClient.const_get(type)
    klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
  end
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



125
126
127
# File 'lib/openapi_client/models/element_customization.rb', line 125

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

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



99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# File 'lib/openapi_client/models/element_customization.rb', line 99

def self.attribute_map
  {
    :'passage_container_background_color' => :'passage_container_background_color',
    :'passage_container_max_width' => :'passage_container_max_width',
    :'passage_input_box_background_color' => :'passage_input_box_background_color',
    :'passage_input_box_border_radius' => :'passage_input_box_border_radius',
    :'passage_header_font_family' => :'passage_header_font_family',
    :'passage_body_font_family' => :'passage_body_font_family',
    :'passage_header_text_color' => :'passage_header_text_color',
    :'passage_body_text_color' => :'passage_body_text_color',
    :'passage_primary_button_background_color' => :'passage_primary_button_background_color',
    :'passage_primary_button_text_color' => :'passage_primary_button_text_color',
    :'passage_primary_button_hover_color' => :'passage_primary_button_hover_color',
    :'passage_primary_button_border_radius' => :'passage_primary_button_border_radius',
    :'passage_primary_button_border_color' => :'passage_primary_button_border_color',
    :'passage_primary_button_border_width' => :'passage_primary_button_border_width',
    :'passage_secondary_button_background_color' => :'passage_secondary_button_background_color',
    :'passage_secondary_button_text_color' => :'passage_secondary_button_text_color',
    :'passage_secondary_button_hover_color' => :'passage_secondary_button_hover_color',
    :'passage_secondary_button_border_radius' => :'passage_secondary_button_border_radius',
    :'passage_secondary_button_border_color' => :'passage_secondary_button_border_color',
    :'passage_secondary_button_border_width' => :'passage_secondary_button_border_width'
  }
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



346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
# File 'lib/openapi_client/models/element_customization.rb', line 346

def self.build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  transformed_hash = {}
  openapi_types.each_pair do |key, type|
    if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = nil
    elsif 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[attribute_map[key]].is_a?(Array)
        transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
      end
    elsif !attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
    end
  end
  new(transformed_hash)
end

.openapi_nullableObject

List of attributes with nullable: true



156
157
158
159
# File 'lib/openapi_client/models/element_customization.rb', line 156

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

.openapi_typesObject

Attribute type mapping.



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

def self.openapi_types
  {
    :'passage_container_background_color' => :'String',
    :'passage_container_max_width' => :'Integer',
    :'passage_input_box_background_color' => :'String',
    :'passage_input_box_border_radius' => :'Integer',
    :'passage_header_font_family' => :'FontFamily',
    :'passage_body_font_family' => :'FontFamily',
    :'passage_header_text_color' => :'String',
    :'passage_body_text_color' => :'String',
    :'passage_primary_button_background_color' => :'String',
    :'passage_primary_button_text_color' => :'String',
    :'passage_primary_button_hover_color' => :'String',
    :'passage_primary_button_border_radius' => :'Integer',
    :'passage_primary_button_border_color' => :'String',
    :'passage_primary_button_border_width' => :'Integer',
    :'passage_secondary_button_background_color' => :'String',
    :'passage_secondary_button_text_color' => :'String',
    :'passage_secondary_button_hover_color' => :'String',
    :'passage_secondary_button_border_radius' => :'Integer',
    :'passage_secondary_button_border_color' => :'String',
    :'passage_secondary_button_border_width' => :'Integer'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
# File 'lib/openapi_client/models/element_customization.rb', line 306

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      passage_container_background_color == o.passage_container_background_color &&
      passage_container_max_width == o.passage_container_max_width &&
      passage_input_box_background_color == o.passage_input_box_background_color &&
      passage_input_box_border_radius == o.passage_input_box_border_radius &&
      passage_header_font_family == o.passage_header_font_family &&
      passage_body_font_family == o.passage_body_font_family &&
      passage_header_text_color == o.passage_header_text_color &&
      passage_body_text_color == o.passage_body_text_color &&
      passage_primary_button_background_color == o.passage_primary_button_background_color &&
      passage_primary_button_text_color == o.passage_primary_button_text_color &&
      passage_primary_button_hover_color == o.passage_primary_button_hover_color &&
      passage_primary_button_border_radius == o.passage_primary_button_border_radius &&
      passage_primary_button_border_color == o.passage_primary_button_border_color &&
      passage_primary_button_border_width == o.passage_primary_button_border_width &&
      passage_secondary_button_background_color == o.passage_secondary_button_background_color &&
      passage_secondary_button_text_color == o.passage_secondary_button_text_color &&
      passage_secondary_button_hover_color == o.passage_secondary_button_hover_color &&
      passage_secondary_button_border_radius == o.passage_secondary_button_border_radius &&
      passage_secondary_button_border_color == o.passage_secondary_button_border_color &&
      passage_secondary_button_border_width == o.passage_secondary_button_border_width
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



441
442
443
444
445
446
447
448
449
450
451
452
453
# File 'lib/openapi_client/models/element_customization.rb', line 441

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

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


333
334
335
# File 'lib/openapi_client/models/element_customization.rb', line 333

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



339
340
341
# File 'lib/openapi_client/models/element_customization.rb', line 339

def hash
  [passage_container_background_color, passage_container_max_width, passage_input_box_background_color, passage_input_box_border_radius, passage_header_font_family, passage_body_font_family, passage_header_text_color, passage_body_text_color, passage_primary_button_background_color, passage_primary_button_text_color, passage_primary_button_hover_color, passage_primary_button_border_radius, passage_primary_button_border_color, passage_primary_button_border_width, passage_secondary_button_background_color, passage_secondary_button_text_color, passage_secondary_button_hover_color, passage_secondary_button_border_radius, passage_secondary_button_border_color, passage_secondary_button_border_width].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



291
292
293
294
295
# File 'lib/openapi_client/models/element_customization.rb', line 291

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  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



417
418
419
# File 'lib/openapi_client/models/element_customization.rb', line 417

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



423
424
425
426
427
428
429
430
431
432
433
434
435
# File 'lib/openapi_client/models/element_customization.rb', line 423

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



411
412
413
# File 'lib/openapi_client/models/element_customization.rb', line 411

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



299
300
301
302
# File 'lib/openapi_client/models/element_customization.rb', line 299

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  true
end