Module: Zanshin::SDK::Organizations

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

Overview

Zanshin SDK Organization

Instance Method Summary collapse

Instance Method Details

#get_organization(organization_id) ⇒ Object

Gets an organization given its ID [#reference](api.zanshin.tenchisecurity.com/#operation/getOrganizationById)

Parameters:

  • organization_id (UUID)

    of the organization

Returns:

  • an Object representing the organization


29
30
31
# File 'lib/zanshin/organizations.rb', line 29

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

#iter_organizationsObject

Organizations Enumerator of current logged user [#reference](api.zanshin.tenchisecurity.com/#operation/getOrganizations)

Returns:

  • an Organizations Enumerator object


15
16
17
18
19
20
21
# File 'lib/zanshin/organizations.rb', line 15

def iter_organizations
  Enumerator.new do |yielder|
    @http.request('GET', '/organizations').each do |e|
      yielder.yield e
    end
  end
end

#update_organization(organization_id, name: nil, picture: nil, email: nil) ⇒ Object

Gets an organization given its ID [#reference](api.zanshin.tenchisecurity.com/#operation/editOrganizationById)

Parameters:

  • organization_id (UUID)

    of the organization

  • name (String) (defaults to: nil)

    Optional name of the organization

  • picture (String) (defaults to: nil)

    Optional picture URL of the organization, accepted formats: jpg, jpeg, png, svg

  • email (String) (defaults to: nil)

    Optional e-mail contact of the organization

Returns:

  • an Object representing the organization


42
43
44
45
46
47
48
49
# File 'lib/zanshin/organizations.rb', line 42

def update_organization(organization_id, name: nil, picture: nil, email: nil)
  body = {
    'name' => name,
    'picture' => picture,
    'email' => email
  }
  @http.request('PUT', "/organizations/#{validate_uuid(organization_id)}", body)
end