Class: Respoke::Role

Inherits:
Object
  • Object
show all
Defined in:
lib/respoke/role.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client, id:, name:, **rules) ⇒ Role

Returns a new instance of Role.


5
6
7
8
9
10
# File 'lib/respoke/role.rb', line 5

def initialize(client, id:, name:, **rules)
  @client = client
  @id = id
  @name = name
  @rules = rules
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id


3
4
5
# File 'lib/respoke/role.rb', line 3

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name


3
4
5
# File 'lib/respoke/role.rb', line 3

def name
  @name
end

#rulesObject

Returns the value of attribute rules


4
5
6
# File 'lib/respoke/role.rb', line 4

def rules
  @rules
end

Instance Method Details

#deleteObject


16
17
18
# File 'lib/respoke/role.rb', line 16

def delete
  response = @client.delete_role(id: @id)
end

#saveObject


12
13
14
# File 'lib/respoke/role.rb', line 12

def save
  response = @client.update_role(id: @id, rules: @rules)
end