Class: FigmaComponent

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key:, file_key:, node_id:, name:, description:, containing_frame:) ⇒ FigmaComponent

Returns a new instance of FigmaComponent.



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

def initialize(key:, file_key:, node_id:, name:, description:, containing_frame:)
  @key = key
  @file_key = file_key
  @node_id = node_id
  @name = name
  @description = description
  @containing_frame = containing_frame
end

Instance Attribute Details

#containing_frameObject

Returns the value of attribute containing_frame.



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

def containing_frame
  @containing_frame
end

#descriptionObject

Returns the value of attribute description.



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

def description
  @description
end

#file_keyObject

Returns the value of attribute file_key.



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

def file_key
  @file_key
end

#keyObject

Returns the value of attribute key.



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

def key
  @key
end

#nameObject

Returns the value of attribute name.



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

def name
  @name
end

#node_idObject

Returns the value of attribute node_id.



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

def node_id
  @node_id
end

Class Method Details

.from_hash(hash) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/admiral-tools-figma/helper/figma/figma_client/models/api/primitives/figma_component.rb', line 23

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

  key = hash['key']
  file_key = hash['file_key']
  node_id = hash['node_id']
  name = hash['name']
  description = hash['description']
  containing_frame_hash = hash['containing_frame']
  containing_frame = containing_frame_hash.nil? ? nil : FigmaFrameInfo.from_hash(containing_frame_hash)

  if !key.nil? && !file_key.nil? && !node_id.nil? && !name.nil?
    return FigmaComponent.new(
      key: key,
      file_key: file_key,
      node_id: node_id,
      name: name,
      description: description,
      containing_frame: containing_frame
    )
  end

  nil
end

Instance Method Details

#to_hashObject



48
49
50
51
52
53
54
55
56
57
# File 'lib/admiral-tools-figma/helper/figma/figma_client/models/api/primitives/figma_component.rb', line 48

def to_hash
  hash = {}
  hash['key'] = key
  hash['file_key'] = file_key
  hash['node_id'] = node_id
  hash['name'] = name
  hash['description'] = description
  hash['containing_frame'] = containing_frame.to
  hash
end