Class: FigmaStyle

Inherits:
Object
  • Object
show all
Defined in:
lib/admiral-tools-figma/helper/figma/figma_client/models/api/primitives/figma_style.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, node_id:, style_type:, description:) ⇒ FigmaStyle

Returns a new instance of FigmaStyle.



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/admiral-tools-figma/helper/figma/figma_client/models/api/primitives/figma_style.rb', line 13

def initialize(
  name:,
  node_id:,
  style_type:,
  description:
)
  @name = name
  @node_id = node_id
  @style_type = style_type
  @description = description
end

Instance Attribute Details

#descriptionObject

Returns the value of attribute description.



7
8
9
# File 'lib/admiral-tools-figma/helper/figma/figma_client/models/api/primitives/figma_style.rb', line 7

def description
  @description
end

#nameObject

Returns the value of attribute name.



7
8
9
# File 'lib/admiral-tools-figma/helper/figma/figma_client/models/api/primitives/figma_style.rb', line 7

def name
  @name
end

#node_idObject

Returns the value of attribute node_id.



7
8
9
# File 'lib/admiral-tools-figma/helper/figma/figma_client/models/api/primitives/figma_style.rb', line 7

def node_id
  @node_id
end

#style_typeObject

Returns the value of attribute style_type.



7
8
9
# File 'lib/admiral-tools-figma/helper/figma/figma_client/models/api/primitives/figma_style.rb', line 7

def style_type
  @style_type
end

Class Method Details

.from_hash(hash) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/admiral-tools-figma/helper/figma/figma_client/models/api/primitives/figma_style.rb', line 25

def self.from_hash(hash)
  return nil if hash.nil?

  name = hash['name']
  node_id = hash['node_id']
  style_type = hash['style_type']
  description = hash['description']

  if !name.nil? && !node_id.nil? && style_type
    return FigmaStyle.new(name: name, node_id: node_id, style_type: style_type, description: description)
  end

  nil
end

Instance Method Details

#to_hashObject



40
41
42
43
44
45
46
47
# File 'lib/admiral-tools-figma/helper/figma/figma_client/models/api/primitives/figma_style.rb', line 40

def to_hash
  hash = {}
  hash['name'] = name
  hash['node_id'] = node_id
  hash['style_type'] = style_type
  hash['description'] = description
  hash
end