Module: Novu::Api::Environments

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

Overview

Module Novu::Api::Environments provides an API for managing environments in the Novu application.

This module includes methods for creating, retrieving, and updating environments. It also includes methods for getting and regenerating the api keys also for updatation of widget settings .

For more information on the Novu API(api.novu.co/api#/Environments), see docs.novu.co/api/get-current-environment/.

Instance Method Summary collapse

Instance Method Details

#api_keysHash, number

Returns a list of api keys

Returns:

  • (Hash)

    The list of api keys.

  • (number)

    status

    • Returns 200 if successful



65
66
67
# File 'lib/novu/api/environments.rb', line 65

def api_keys
  get("/environments/api-keys")
end

#create_environment(body) ⇒ Hash, number

Creates a new environment.

@bodyparams:

Parameters:

  • `name` (String)
  • `parentId` (String(optional))

Returns:

  • (Hash)

    The created environment entity.

  • (number)

    status - The status code. Returns 201 if the environment has been successfully created.



29
30
31
# File 'lib/novu/api/environments.rb', line 29

def create_environment(body)
  post("/environments", body: body)
end

#current_environmentHash, number

Retrieves the current environment

Returns:

  • (Hash)

    The retrieved environment.

  • (number)

    status

    • Returns 200 if successful



17
18
19
# File 'lib/novu/api/environments.rb', line 17

def current_environment
  get("/environments/me")
end

#environmentsHash, number

Returns a list of environments

Returns:

  • (Hash)

    The list of environments.

  • (number)

    status

    • Returns 200 if successful



38
39
40
# File 'lib/novu/api/environments.rb', line 38

def environments
  get("/environments")
end

#regenerate_api_keysHash, number

Return regenerated api keys

Returns:

  • (Hash)

    Api keys.

  • (number)

    status

    • Returns 200 if successful



74
75
76
# File 'lib/novu/api/environments.rb', line 74

def regenerate_api_keys
  post("/environments/api-keys/regenerate")
end

#update_environment(environment_id, body) ⇒ Hash, number

Update the environment.

@pathparams:

Parameters:

  • `environment_id` (String)

    The ID of the environment to update.

  • `name` (String(optional))
  • `identifier` (String(optional))
  • `parentId` (String(optional))
  • `dns` (Hash)

Returns:

  • (Hash)

    The updated environment.

  • (number)

    status

    • Returns 200 if the environment with the environment_id provided has been updated correctly.



56
57
58
# File 'lib/novu/api/environments.rb', line 56

def update_environment(environment_id, body)
  put("/environments/#{environment_id}", body: body)
end

#update_widget_settings(body) ⇒ Hash, number

Update the widget settings.

Parameters:

  • `notificationCenterEncryption` (Boolean)

Returns:

  • (Hash)

    The updated environment entity.

  • (number)

    status

    • Returns 200 if the environment entity updated.



86
87
88
# File 'lib/novu/api/environments.rb', line 86

def update_widget_settings(body)
  put("/environments/widget/settings", body: body)
end