Class: RolesManagementAPI::RoleAssignment

Inherits:
Object
  • Object
show all
Defined in:
lib/roles-management-api/role_assignment.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(json) ⇒ RoleAssignment

Creates a new Person object from a JSON object



6
7
8
9
10
11
# File 'lib/roles-management-api/role_assignment.rb', line 6

def initialize(json)
  @id = json[:id]
  @entity_id = json[:entity_id]
  @role_id = json[:role_id]
  @destroy = false
end

Instance Attribute Details

#destroyObject

Returns the value of attribute destroy.



3
4
5
# File 'lib/roles-management-api/role_assignment.rb', line 3

def destroy
  @destroy
end

#entity_idObject

Returns the value of attribute entity_id.



3
4
5
# File 'lib/roles-management-api/role_assignment.rb', line 3

def entity_id
  @entity_id
end

#idObject

Returns the value of attribute id.



3
4
5
# File 'lib/roles-management-api/role_assignment.rb', line 3

def id
  @id
end

#role_idObject

Returns the value of attribute role_id.



3
4
5
# File 'lib/roles-management-api/role_assignment.rb', line 3

def role_id
  @role_id
end

Instance Method Details

#as_jsonObject



13
14
15
16
17
18
19
20
21
22
# File 'lib/roles-management-api/role_assignment.rb', line 13

def as_json
  json = {}
  json['_destroy'] = true if @destroy

  json.merge({
    id: @id,
    entity_id: @entity_id,
    role_id: @role_id
  })
end