Class: AsposeSlidesCloud::ColorScheme

Inherits:
ResourceBase show all
Defined in:
lib/aspose_slides_cloud/models/color_scheme.rb

Overview

Slide’s color scheme DTO

Instance Attribute Summary collapse

Attributes inherited from ResourceBase

#alternate_links, #self_uri

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ ColorScheme

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
# File 'lib/aspose_slides_cloud/models/color_scheme.rb', line 102

def initialize(attributes = {})
  super

  if attributes.has_key?(:'Accent1')
    self.accent1 = attributes[:'Accent1']
  end

  if attributes.has_key?(:'Accent2')
    self.accent2 = attributes[:'Accent2']
  end

  if attributes.has_key?(:'Accent3')
    self.accent3 = attributes[:'Accent3']
  end

  if attributes.has_key?(:'Accent4')
    self.accent4 = attributes[:'Accent4']
  end

  if attributes.has_key?(:'Accent5')
    self.accent5 = attributes[:'Accent5']
  end

  if attributes.has_key?(:'Accent6')
    self.accent6 = attributes[:'Accent6']
  end

  if attributes.has_key?(:'Dark1')
    self.dark1 = attributes[:'Dark1']
  end

  if attributes.has_key?(:'Dark2')
    self.dark2 = attributes[:'Dark2']
  end

  if attributes.has_key?(:'FollowedHyperlink')
    self.followed_hyperlink = attributes[:'FollowedHyperlink']
  end

  if attributes.has_key?(:'Hyperlink')
    self.hyperlink = attributes[:'Hyperlink']
  end

  if attributes.has_key?(:'Light1')
    self.light1 = attributes[:'Light1']
  end

  if attributes.has_key?(:'Light2')
    self.light2 = attributes[:'Light2']
  end
end

Instance Attribute Details

#accent1Object

First accent color.



29
30
31
# File 'lib/aspose_slides_cloud/models/color_scheme.rb', line 29

def accent1
  @accent1
end

#accent2Object

Second accent color.



32
33
34
# File 'lib/aspose_slides_cloud/models/color_scheme.rb', line 32

def accent2
  @accent2
end

#accent3Object

Third accent color.



35
36
37
# File 'lib/aspose_slides_cloud/models/color_scheme.rb', line 35

def accent3
  @accent3
end

#accent4Object

Fourth accent color.



38
39
40
# File 'lib/aspose_slides_cloud/models/color_scheme.rb', line 38

def accent4
  @accent4
end

#accent5Object

Fifth accent color.



41
42
43
# File 'lib/aspose_slides_cloud/models/color_scheme.rb', line 41

def accent5
  @accent5
end

#accent6Object

Sixth accent color.



44
45
46
# File 'lib/aspose_slides_cloud/models/color_scheme.rb', line 44

def accent6
  @accent6
end

#dark1Object

First dark color.



47
48
49
# File 'lib/aspose_slides_cloud/models/color_scheme.rb', line 47

def dark1
  @dark1
end

#dark2Object

Second dark color.



50
51
52
# File 'lib/aspose_slides_cloud/models/color_scheme.rb', line 50

def dark2
  @dark2
end

Visited hyperlink color.



53
54
55
# File 'lib/aspose_slides_cloud/models/color_scheme.rb', line 53

def followed_hyperlink
  @followed_hyperlink
end

Hyperlink color/



56
57
58
# File 'lib/aspose_slides_cloud/models/color_scheme.rb', line 56

def hyperlink
  @hyperlink
end

#light1Object

First light color.



59
60
61
# File 'lib/aspose_slides_cloud/models/color_scheme.rb', line 59

def light1
  @light1
end

#light2Object

Second light color.



62
63
64
# File 'lib/aspose_slides_cloud/models/color_scheme.rb', line 62

def light2
  @light2
end

Class Method Details

.attribute_mapObject

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



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/aspose_slides_cloud/models/color_scheme.rb', line 65

def self.attribute_map
  super.merge({
    :'accent1' => :'Accent1',
    :'accent2' => :'Accent2',
    :'accent3' => :'Accent3',
    :'accent4' => :'Accent4',
    :'accent5' => :'Accent5',
    :'accent6' => :'Accent6',
    :'dark1' => :'Dark1',
    :'dark2' => :'Dark2',
    :'followed_hyperlink' => :'FollowedHyperlink',
    :'hyperlink' => :'Hyperlink',
    :'light1' => :'Light1',
    :'light2' => :'Light2',
  })
end

.swagger_typesObject

Attribute type mapping.



83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/aspose_slides_cloud/models/color_scheme.rb', line 83

def self.swagger_types
  super.merge({
    :'accent1' => :'String',
    :'accent2' => :'String',
    :'accent3' => :'String',
    :'accent4' => :'String',
    :'accent5' => :'String',
    :'accent6' => :'String',
    :'dark1' => :'String',
    :'dark2' => :'String',
    :'followed_hyperlink' => :'String',
    :'hyperlink' => :'String',
    :'light1' => :'String',
    :'light2' => :'String',
  })
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
# File 'lib/aspose_slides_cloud/models/color_scheme.rb', line 170

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      self_uri == o.self_uri &&
      alternate_links == o.alternate_links &&
      accent1 == o.accent1 &&
      accent2 == o.accent2 &&
      accent3 == o.accent3 &&
      accent4 == o.accent4 &&
      accent5 == o.accent5 &&
      accent6 == o.accent6 &&
      dark1 == o.dark1 &&
      dark2 == o.dark2 &&
      followed_hyperlink == o.followed_hyperlink &&
      hyperlink == o.hyperlink &&
      light1 == o.light1 &&
      light2 == o.light2
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



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
# File 'lib/aspose_slides_cloud/models/color_scheme.rb', line 237

def _deserialize(type, value)
  if value.nil?
    nil
  else
    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
      registry_type = AsposeSlidesCloud::TypeRegistry.get_type(type.to_s, value)
      if registry_type
        type = registry_type
      end
      temp_model = AsposeSlidesCloud.const_get(type).new
      temp_model.build_from_hash(value)
    end
  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



311
312
313
314
315
316
317
318
319
320
321
322
323
# File 'lib/aspose_slides_cloud/models/color_scheme.rb', line 311

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



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
# File 'lib/aspose_slides_cloud/models/color_scheme.rb', line 204

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

  self
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


191
192
193
# File 'lib/aspose_slides_cloud/models/color_scheme.rb', line 191

def eql?(o)
  self == o
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



197
198
199
# File 'lib/aspose_slides_cloud/models/color_scheme.rb', line 197

def hash
  [self_uri, alternate_links, accent1, accent2, accent3, accent4, accent5, accent6, dark1, dark2, followed_hyperlink, hyperlink, light1, light2].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



156
157
158
159
# File 'lib/aspose_slides_cloud/models/color_scheme.rb', line 156

def list_invalid_properties
  invalid_properties = super
  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



291
292
293
# File 'lib/aspose_slides_cloud/models/color_scheme.rb', line 291

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



297
298
299
300
301
302
303
304
305
# File 'lib/aspose_slides_cloud/models/color_scheme.rb', line 297

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    next if value.nil?
    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



285
286
287
# File 'lib/aspose_slides_cloud/models/color_scheme.rb', line 285

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



163
164
165
166
# File 'lib/aspose_slides_cloud/models/color_scheme.rb', line 163

def valid?
  return false if !super
  true
end