Class: PlatformSdk::PencilSpaces::Models::UserWithRole
- Inherits:
-
Object
- Object
- PlatformSdk::PencilSpaces::Models::UserWithRole
- Defined in:
- lib/platform_sdk/pencil_spaces/models/user_with_role.rb
Constant Summary collapse
- VALID_ROLES =
%i[host participant].freeze
Instance Attribute Summary collapse
-
#role ⇒ Object
Returns the value of attribute role.
-
#user_id ⇒ Object
Returns the value of attribute user_id.
Instance Method Summary collapse
- #as_json ⇒ Object
-
#initialize(user_id, user_role_in_space = nil) ⇒ UserWithRole
constructor
A new instance of UserWithRole.
Constructor Details
#initialize(user_id, user_role_in_space = nil) ⇒ UserWithRole
Returns a new instance of UserWithRole.
11 12 13 14 15 16 17 |
# File 'lib/platform_sdk/pencil_spaces/models/user_with_role.rb', line 11 def initialize(user_id, user_role_in_space = nil) @user_id = user_id return unless user_role_in_space validate_role!(user_role_in_space) @role = user_role_in_space end |
Instance Attribute Details
#role ⇒ Object
Returns the value of attribute role.
7 8 9 |
# File 'lib/platform_sdk/pencil_spaces/models/user_with_role.rb', line 7 def role @role end |
#user_id ⇒ Object
Returns the value of attribute user_id.
7 8 9 |
# File 'lib/platform_sdk/pencil_spaces/models/user_with_role.rb', line 7 def user_id @user_id end |
Instance Method Details
#as_json ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/platform_sdk/pencil_spaces/models/user_with_role.rb', line 19 def as_json json = {} instance_variables.each do |var| key = var.to_s.delete("@") key = "userId" if key == "user_id" json[key] = instance_variable_get(var).to_s if instance_variable_get(var) end json end |