Class: RolesManagementAPI::Role
- Inherits:
-
Object
- Object
- RolesManagementAPI::Role
- Defined in:
- lib/roles-management-api/role.rb
Instance Attribute Summary collapse
-
#application_id ⇒ Object
Returns the value of attribute application_id.
-
#assignments ⇒ Object
Returns the value of attribute assignments.
-
#description ⇒ Object
Returns the value of attribute description.
-
#id ⇒ Object
Returns the value of attribute id.
-
#members ⇒ Object
Returns the value of attribute members.
-
#name ⇒ Object
Returns the value of attribute name.
-
#token ⇒ Object
Returns the value of attribute token.
Instance Method Summary collapse
- #as_json ⇒ Object
-
#initialize(role_id, json) ⇒ Role
constructor
Creates a new Role object from a NET/HTTP response (see client.rb).
Constructor Details
#initialize(role_id, json) ⇒ Role
Creates a new Role object from a NET/HTTP response (see client.rb)
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/roles-management-api/role.rb', line 6 def initialize(role_id, json) @id = role_id @application_id = json[:application_id] @description = json[:description] @name = json[:name] @token = json[:token] @assignments = RoleAssignmentArray.new(role_id) json[:role_assignments_attributes].each do |assignment_json| @assignments << RoleAssignment.new(assignment_json) end @members = [] json[:members].each do |member| @members << Person.new(member) end end |
Instance Attribute Details
#application_id ⇒ Object
Returns the value of attribute application_id.
3 4 5 |
# File 'lib/roles-management-api/role.rb', line 3 def application_id @application_id end |
#assignments ⇒ Object
Returns the value of attribute assignments.
3 4 5 |
# File 'lib/roles-management-api/role.rb', line 3 def assignments @assignments end |
#description ⇒ Object
Returns the value of attribute description.
3 4 5 |
# File 'lib/roles-management-api/role.rb', line 3 def description @description end |
#id ⇒ Object
Returns the value of attribute id.
3 4 5 |
# File 'lib/roles-management-api/role.rb', line 3 def id @id end |
#members ⇒ Object
Returns the value of attribute members.
3 4 5 |
# File 'lib/roles-management-api/role.rb', line 3 def members @members end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/roles-management-api/role.rb', line 3 def name @name end |
#token ⇒ Object
Returns the value of attribute token.
3 4 5 |
# File 'lib/roles-management-api/role.rb', line 3 def token @token end |
Instance Method Details
#as_json ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/roles-management-api/role.rb', line 24 def as_json { role: { role_assignments_attributes: @assignments.as_json } } end |