Class: WorkOS::UserOrganizationMembership

Inherits:
Types::BaseModel
  • Object
show all
Defined in:
lib/workos/organization_membership/user_organization_membership.rb

Constant Summary collapse

HASH_ATTRS =
{
  object: :object,
  id: :id,
  user_id: :user_id,
  organization_id: :organization_id,
  status: :status,
  directory_managed: :directory_managed,
  organization_name: :organization_name,
  custom_attributes: :custom_attributes,
  created_at: :created_at,
  updated_at: :updated_at,
  role: :role,
  roles: :roles,
  user: :user
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(json) ⇒ UserOrganizationMembership

Returns a new instance of UserOrganizationMembership.



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/workos/organization_membership/user_organization_membership.rb', line 38

def initialize(json)
  hash = self.class.normalize(json)
  @object = hash[:object]
  @id = hash[:id]
  @user_id = hash[:user_id]
  @organization_id = hash[:organization_id]
  @status = hash[:status]
  @directory_managed = hash[:directory_managed]
  @organization_name = hash[:organization_name]
  @custom_attributes = hash[:custom_attributes] || {}
  @created_at = hash[:created_at]
  @updated_at = hash[:updated_at]
  @role = hash[:role] ? WorkOS::SlimRole.new(hash[:role]) : nil
  @roles = (hash[:roles] || []).map { |item| item ? WorkOS::SlimRole.new(item) : nil }
  @user = hash[:user] ? WorkOS::User.new(hash[:user]) : nil
end

Instance Attribute Details

#created_atObject

Returns the value of attribute created_at.



23
24
25
# File 'lib/workos/organization_membership/user_organization_membership.rb', line 23

def created_at
  @created_at
end

#custom_attributesObject

Returns the value of attribute custom_attributes.



23
24
25
# File 'lib/workos/organization_membership/user_organization_membership.rb', line 23

def custom_attributes
  @custom_attributes
end

#directory_managedObject

Returns the value of attribute directory_managed.



23
24
25
# File 'lib/workos/organization_membership/user_organization_membership.rb', line 23

def directory_managed
  @directory_managed
end

#idObject

Returns the value of attribute id.



23
24
25
# File 'lib/workos/organization_membership/user_organization_membership.rb', line 23

def id
  @id
end

#objectObject

Returns the value of attribute object.



23
24
25
# File 'lib/workos/organization_membership/user_organization_membership.rb', line 23

def object
  @object
end

#organization_idObject

Returns the value of attribute organization_id.



23
24
25
# File 'lib/workos/organization_membership/user_organization_membership.rb', line 23

def organization_id
  @organization_id
end

#organization_nameObject

Returns the value of attribute organization_name.



23
24
25
# File 'lib/workos/organization_membership/user_organization_membership.rb', line 23

def organization_name
  @organization_name
end

#roleObject

Returns the value of attribute role.



23
24
25
# File 'lib/workos/organization_membership/user_organization_membership.rb', line 23

def role
  @role
end

#rolesObject

Returns the value of attribute roles.



23
24
25
# File 'lib/workos/organization_membership/user_organization_membership.rb', line 23

def roles
  @roles
end

#statusObject

Returns the value of attribute status.



23
24
25
# File 'lib/workos/organization_membership/user_organization_membership.rb', line 23

def status
  @status
end

#updated_atObject

Returns the value of attribute updated_at.



23
24
25
# File 'lib/workos/organization_membership/user_organization_membership.rb', line 23

def updated_at
  @updated_at
end

#userObject

Returns the value of attribute user.



23
24
25
# File 'lib/workos/organization_membership/user_organization_membership.rb', line 23

def user
  @user
end

#user_idObject

Returns the value of attribute user_id.



23
24
25
# File 'lib/workos/organization_membership/user_organization_membership.rb', line 23

def user_id
  @user_id
end