Class: Stele::Resource

Inherits:
Object
  • Object
show all
Defined in:
lib/stele/resource.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes:, operations:) ⇒ Resource

Returns a new instance of Resource.



15
16
17
18
# File 'lib/stele/resource.rb', line 15

def initialize(attributes:, operations:)
  @attributes_definition = attributes
  @operations = operations
end

Instance Attribute Details

#attributes_definitionObject (readonly)

Returns the value of attribute attributes_definition.



13
14
15
# File 'lib/stele/resource.rb', line 13

def attributes_definition
  @attributes_definition
end

#operationsObject (readonly)

Returns the value of attribute operations.



13
14
15
# File 'lib/stele/resource.rb', line 13

def operations
  @operations
end

Class Method Details

.build(**args) ⇒ Object



4
5
6
7
8
9
10
11
# File 'lib/stele/resource.rb', line 4

def self.build(**args)
  i = new(**args)

  {
    'attributes' => i.attributes,
    'operations' => i.operations
  }
end

Instance Method Details

#attributesObject



20
21
22
# File 'lib/stele/resource.rb', line 20

def attributes
  @attributes_definition.keys
end