Module: Zanshin::SDK::OrganizationMembers

Included in:
Client
Defined in:
lib/zanshin/organization_members.rb

Overview

Zanshin SDK Organization Members

Instance Method Summary collapse

Instance Method Details

#create_organization_members_invite(organization_id, email, roles = nil) ⇒ Object

Create organization member invite [#reference](api.zanshin.tenchisecurity.com/#operation/createOrgamizationInvite)

Parameters:

  • organization_id (UUID)

    of the organization

  • email (String)

    of the new member

  • roles ('ADMIN') (defaults to: nil)

    of the new member

Returns:

  • a Object representing the organization member invite



120
121
122
123
124
125
126
127
128
# File 'lib/zanshin/organization_members.rb', line 120

def create_organization_members_invite(organization_id, email, roles = nil)
  body = {
    'email' => email,
    'roles' => [roles].compact
  }
  @http.request('POST',
                "/organizations/#{validate_uuid(organization_id)}/invites",
                body)
end

#delete_organization_member(organization_id, member_id) ⇒ Object

Parameters:

  • organization_id (UUID)

    of the organization

  • member_id (UUID)

    of the member

Returns:

  • a Boolean with result



61
62
63
64
# File 'lib/zanshin/organization_members.rb', line 61

def delete_organization_member(organization_id, member_id)
  @http.request('DELETE',
                "/organizations/#{validate_uuid(organization_id)}/members/#{validate_uuid(member_id)}")
end

#delete_organization_member_invite(organization_id, email) ⇒ Object

Delete organization member invite [#reference](api.zanshin.tenchisecurity.com/#operation/deleteOrganizationInviteByEmail)

Parameters:

  • organization_id (UUID)

    of the organization

  • email (String)

    of the invited member

Returns:

  • a Boolean with result



149
150
151
152
# File 'lib/zanshin/organization_members.rb', line 149

def delete_organization_member_invite(organization_id, email)
  @http.request('DELETE',
                "/organizations/#{validate_uuid(organization_id)}/invites/#{email}")
end

#get_organization_member(organization_id, member_id) ⇒ Object

Get details on a user’s organization membership [#reference](api.zanshin.tenchisecurity.com/#operation/getOrganizationMemberById)

Parameters:

  • organization_id (UUID)

    of the organization

  • member_id (UUID)

    of the member

Returns:

  • a Object representing the organization member



32
33
34
35
# File 'lib/zanshin/organization_members.rb', line 32

def get_organization_member(organization_id, member_id)
  @http.request('GET',
                "/organizations/#{validate_uuid(organization_id)}/members/#{validate_uuid(member_id)}")
end

#get_organization_member_invite(organization_id, email) ⇒ Object

Get organization member invite [#reference](api.zanshin.tenchisecurity.com/#operation/getOrganizationInviteByEmail)

Parameters:

  • organization_id (UUID)

    of the organization

  • email (String)

    of the invited member

Returns:

  • a Object representing the organization member invite



137
138
139
140
# File 'lib/zanshin/organization_members.rb', line 137

def get_organization_member_invite(organization_id, email)
  @http.request('GET',
                "/organizations/#{validate_uuid(organization_id)}/invites/#{email}")
end

#iter_organization_members(organization_id) ⇒ Object

Organization Members Enumerator of the users which are members of an organization [#reference](api.zanshin.tenchisecurity.com/#operation/getOrganizationMembers)

Parameters:

  • organization_id (UUID)

    of the organization

Returns:

  • an Organization Members Enumerator object



17
18
19
20
21
22
23
# File 'lib/zanshin/organization_members.rb', line 17

def iter_organization_members(organization_id)
  Enumerator.new do |yielder|
    @http.request('GET', "/organizations/#{validate_uuid(organization_id)}/members").each do |e|
      yielder.yield e
    end
  end
end

#iter_organization_members_invites(organization_id) ⇒ Object

Organization Members Invites Enumerator of an organization [#reference](api.zanshin.tenchisecurity.com/#operation/getOrgamizationInvites)

Parameters:

  • organization_id (UUID)

    of the organization

Returns:

  • an Organization Members Invites Enumerator object



104
105
106
107
108
109
110
# File 'lib/zanshin/organization_members.rb', line 104

def iter_organization_members_invites(organization_id)
  Enumerator.new do |yielder|
    @http.request('GET', "/organizations/#{validate_uuid(organization_id)}/invites").each do |e|
      yielder.yield e
    end
  end
end

#resend_organization_member_invite(organization_id, email) ⇒ Object

Resend organization member invitation [#reference](api.zanshin.tenchisecurity.com/#operation/resendOrganizationInviteByEmail)

Parameters:

  • organization_id (UUID)

    of the organization

  • email (String)

    of the invited member

Returns:

  • a Boolean with result



161
162
163
164
# File 'lib/zanshin/organization_members.rb', line 161

def resend_organization_member_invite(organization_id, email)
  @http.request('POST',
                "/organizations/#{validate_uuid(organization_id)}/invites/#{email}/resend")
end

#reset_organization_member_mfa(organization_id, member_id) ⇒ Object

Parameters:

  • organization_id (UUID)

    of the organization

  • member_id (UUID)

    of the member

Returns:

  • a Boolean with result



73
74
75
76
77
78
# File 'lib/zanshin/organization_members.rb', line 73

def reset_organization_member_mfa(organization_id, member_id)
  @http.request(
    'POST',
    "/organizations/#{validate_uuid(organization_id)}/members/#{validate_uuid(member_id)}/mfa/reset"
  )
end

#reset_organization_member_password(organization_id, member_id) ⇒ Object

Parameters:

  • organization_id (UUID)

    of the organization

  • member_id (UUID)

    of the member

Returns:

  • a Boolean with result



87
88
89
90
91
92
# File 'lib/zanshin/organization_members.rb', line 87

def reset_organization_member_password(organization_id, member_id)
  @http.request(
    'POST',
    "/organizations/#{validate_uuid(organization_id)}/members/#{validate_uuid(member_id)}/password/reset"
  )
end

#update_organization_member(organization_id, member_id, roles = nil) ⇒ Object

Parameters:

  • organization_id (UUID)

    of the organization

  • member_id (UUID)

    of the member

  • roles ('ADMIN') (defaults to: nil)

    of the member

Returns:

  • a Object representing the organization member



45
46
47
48
49
50
51
52
# File 'lib/zanshin/organization_members.rb', line 45

def update_organization_member(organization_id, member_id, roles = nil)
  body = {
    'roles' => [roles].compact
  }
  @http.request('PUT',
                "/organizations/#{validate_uuid(organization_id)}/members/#{validate_uuid(member_id)}",
                body)
end