Class: Attio::Resources::WorkspaceMembers Private

Inherits:
Base
  • Object
show all
Defined in:
lib/attio/resources/workspace_members.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Workspace Members resource for managing workspace member access

Examples:

List all workspace members

client.workspace_members.list

Get a specific member

client.workspace_members.get(member_id: "user_123")

Invite a new member

client.workspace_members.invite(
  email: "[email protected]",
  role: "member"
)

Since:

  • 1.0.0

Instance Method Summary collapse

Constructor Details

This class inherits a constructor from Attio::Resources::Base

Instance Method Details

#accept_invitation(invitation_token:) ⇒ Hash

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Accept a workspace invitation

Since:

  • 1.0.0



81
82
83
84
# File 'lib/attio/resources/workspace_members.rb', line 81

def accept_invitation(invitation_token:)
  validate_required_string!(invitation_token, "Invitation token")
  request(:post, "workspace_members/invitations/#{invitation_token}/accept")
end

#get(member_id:) ⇒ Hash

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Get a specific workspace member

Since:

  • 1.0.0



33
34
35
36
# File 'lib/attio/resources/workspace_members.rb', line 33

def get(member_id:)
  validate_id!(member_id, "Member")
  request(:get, "workspace_members/#{member_id}")
end

#invite(email:, role: "member", data: {}) ⇒ Hash

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Invite a new member to the workspace

Raises:

  • (ArgumentError)

Since:

  • 1.0.0



44
45
46
47
48
49
50
51
52
# File 'lib/attio/resources/workspace_members.rb', line 44

def invite(email:, role: "member", data: {})
  validate_required_string!(email, "Email")
  validate_required_string!(role, "Role")

  raise ArgumentError, "Role must be one of: admin, member, guest" unless %w[admin member guest].include?(role)

  body = data.merge(email: email, role: role)
  request(:post, "workspace_members/invitations", body)
end

#list(params = {}) ⇒ Hash

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

List all workspace members

Options Hash (params):

  • :limit (Integer)

    Maximum number of results

  • :offset (String)

    Pagination offset

Since:

  • 1.0.0



25
26
27
# File 'lib/attio/resources/workspace_members.rb', line 25

def list(params = {})
  request(:get, "workspace_members", params)
end

#meHash

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Get current member (self)

Since:

  • 1.0.0



98
99
100
# File 'lib/attio/resources/workspace_members.rb', line 98

def me
  request(:get, "workspace_members/me")
end

#remove(member_id:) ⇒ Hash

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Remove a member from the workspace

Since:

  • 1.0.0



72
73
74
75
# File 'lib/attio/resources/workspace_members.rb', line 72

def remove(member_id:)
  validate_id!(member_id, "Member")
  request(:delete, "workspace_members/#{member_id}")
end

#resend_invitation(member_id:) ⇒ Hash

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Resend an invitation

Since:

  • 1.0.0



90
91
92
93
# File 'lib/attio/resources/workspace_members.rb', line 90

def resend_invitation(member_id:)
  validate_id!(member_id, "Member")
  request(:post, "workspace_members/#{member_id}/resend_invitation")
end

#update(member_id:, data:) ⇒ Hash

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Update a workspace member's role or permissions

Options Hash (data:):

  • :role (String)

    The new role

  • :permissions (Hash)

    Custom permissions

Since:

  • 1.0.0



61
62
63
64
65
66
# File 'lib/attio/resources/workspace_members.rb', line 61

def update(member_id:, data:)
  validate_id!(member_id, "Member")
  validate_required_hash!(data, "Data")

  request(:patch, "workspace_members/#{member_id}", data)
end