Module: Novu::Api::Organizations

Included in:
Client
Defined in:
lib/novu/api/organizations.rb

Overview

Module Novu::Api::Organizations provides an API for managing Organization within your Novu account.

This module includes methods for creating, retrieving, updating and deleting organization.

For more information on the Novu API see api.novu.co/api#/Organizations, docs.novu.co/api-reference/organizations/create-organization.

Instance Method Summary collapse

Instance Method Details

#create_organization(body) ⇒ Hash, number

@bodyparams:

Parameters:

  • `logo` (String)
    • A valid image URL with one of the following extensions: jpg, jpeg, png, gif, svg.

  • `name` (String)
    • A human-readable name of the organization.

Returns:

  • (Hash)

    data - The list of information with respect to the created organization.

  • (number)

    status - The status code. Returns 200 if the organization has been successfully created.



19
20
21
# File 'lib/novu/api/organizations.rb', line 19

def create_organization(body)
  post("/organizations", body: body)
end

#current_organizationHash, number

Get details of the current organization

Returns:

  • (Hash)

    data - The details of the current organization.

  • (number)

    status - Returns 200 if successful



35
36
37
# File 'lib/novu/api/organizations.rb', line 35

def current_organization()
  get("/organizations/me")
end

#current_organization_membersHash, number

Get all members of the current organization

Returns:

  • (Hash)

    data - The list of all members of the current organization.

  • (number)

    status - Returns 200 if successful



43
44
45
# File 'lib/novu/api/organizations.rb', line 43

def current_organization_members()
  get("/organizations/members")
end

#delete_organization_member(member_id) ⇒ number

Remove a member from organization

Parameters:

  • `member_id` (String)

Returns:

  • (number)

    status - The status code. Returns 200 if memeber was removed successfully by their id.



76
77
78
# File 'lib/novu/api/organizations.rb', line 76

def delete_organization_member(member_id)
  delete("/organizations/members/#{member_id}")
end

#organization_branding(body) ⇒ Hash, number

Update organization branding details

@bodyparams:

Parameters:

  • `logo` (String)
    • A valid image URL with one of the following extensions: jpg, jpeg, png, gif, svg.

  • `color` (String)
    • The hexadecimal color style of the organization.

  • `contentBackground` (String)
    • The hexadecimal content background style of the organization.

  • `fontColor` (String)
    • The hexadecimal font color style of the organization.

  • `fontFamily` (String(optional))
    • The font family style of the organization.

Returns:

  • (Hash)

    data - The list of branding details of the organization.

  • (number)

    status - Returns 200 if successful



66
67
68
# File 'lib/novu/api/organizations.rb', line 66

def organization_branding(body)
  put("/organizations/branding", body: body)
end

#organizationsHash, number

Get all organizations

Returns:

  • (Hash)

    data - The list of organizations already created.

  • (number)

    status - Returns 200 if successful



27
28
29
# File 'lib/novu/api/organizations.rb', line 27

def organizations()
  get("/organizations")
end

#rename_organization(body) ⇒ Hash, number

Rename organization name

Returns:

  • (Hash)

    data - The list of updated details of the organization.

  • (number)

    status - Returns 200 if successful



51
52
53
# File 'lib/novu/api/organizations.rb', line 51

def rename_organization(body)
  patch("/organizations", body: body)
end