Class: WorkOS::Role
Overview
The Role class provides a lightweight wrapper around a WorkOS Role resource. This class is not meant to be instantiated in user space, and is instantiated internally but exposed.
Instance Attribute Summary collapse
-
#created_at ⇒ Object
Returns the value of attribute created_at.
-
#description ⇒ Object
Returns the value of attribute description.
-
#id ⇒ Object
Returns the value of attribute id.
-
#name ⇒ Object
Returns the value of attribute name.
-
#slug ⇒ Object
Returns the value of attribute slug.
-
#type ⇒ Object
Returns the value of attribute type.
-
#updated_at ⇒ Object
Returns the value of attribute updated_at.
Instance Method Summary collapse
-
#initialize(json) ⇒ Role
constructor
A new instance of Role.
- #to_json ⇒ Object
Methods included from HashProvider
Constructor Details
#initialize(json) ⇒ Role
Returns a new instance of Role.
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/workos/role.rb', line 12 def initialize(json) hash = JSON.parse(json, symbolize_names: true) @id = hash[:id] @name = hash[:name] @slug = hash[:slug] @description = hash[:description] @type = hash[:type] @created_at = hash[:created_at] @updated_at = hash[:updated_at] end |
Instance Attribute Details
#created_at ⇒ Object
Returns the value of attribute created_at.
10 11 12 |
# File 'lib/workos/role.rb', line 10 def created_at @created_at end |
#description ⇒ Object
Returns the value of attribute description.
10 11 12 |
# File 'lib/workos/role.rb', line 10 def description @description end |
#id ⇒ Object
Returns the value of attribute id.
10 11 12 |
# File 'lib/workos/role.rb', line 10 def id @id end |
#name ⇒ Object
Returns the value of attribute name.
10 11 12 |
# File 'lib/workos/role.rb', line 10 def name @name end |
#slug ⇒ Object
Returns the value of attribute slug.
10 11 12 |
# File 'lib/workos/role.rb', line 10 def slug @slug end |
#type ⇒ Object
Returns the value of attribute type.
10 11 12 |
# File 'lib/workos/role.rb', line 10 def type @type end |
#updated_at ⇒ Object
Returns the value of attribute updated_at.
10 11 12 |
# File 'lib/workos/role.rb', line 10 def updated_at @updated_at end |
Instance Method Details
#to_json ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/workos/role.rb', line 24 def to_json(*) { id: id, name: name, slug: slug, description: description, type: type, created_at: created_at, updated_at: updated_at, } end |