Module: Novu::Api::Layouts
- Included in:
- Client
- Defined in:
- lib/novu/api/layouts.rb
Overview
Module Novu::Api::Layouts provides an API for managing layouts in the Novu application.
This module includes methods for creating, retrieving, updating, and deleting layouts. It also includes methods for setting and getting the default layout.
For more information on the Novu API(api.novu.co/api#/Layouts), see docs.novu.co/api/layout-creation/.
Instance Method Summary collapse
-
#create_layout(body) ⇒ _id: "_id", number
Creates a new layout.
-
#delete_layout(layout_id) ⇒ Hash, number
Execute a soft delete of a layout given a certain ID.
-
#layout(layout_id) ⇒ Hash, number
Retrieves the layout with the given ID.
-
#layouts(query = {}) ⇒ Hash, number
Returns a list of layouts that can be paginated using the ‘page` query parameter and filtered by the environment where it is executed from the organization the user belongs to.
-
#make_default_layout(layout_id) ⇒ number
Sets the default layout for the environment and updates to non default to the existing default layout (if any).
-
#update_layout(layout_id, body) ⇒ Hash, number
Update the name, content and variables of a layout.
Instance Method Details
#create_layout(body) ⇒ _id: "_id", number
Creates a new layout.
@bodyparams:
23 24 25 |
# File 'lib/novu/api/layouts.rb', line 23 def create_layout(body) post("/layouts", body: body) end |
#delete_layout(layout_id) ⇒ Hash, number
Execute a soft delete of a layout given a certain ID.
@pathparams:
67 68 69 |
# File 'lib/novu/api/layouts.rb', line 67 def delete_layout(layout_id) delete("/layouts/#{layout_id}") end |
#layout(layout_id) ⇒ Hash, number
Retrieves the layout with the given ID.
53 54 55 |
# File 'lib/novu/api/layouts.rb', line 53 def layout(layout_id) get("/layouts/#{layout_id}") end |
#layouts(query = {}) ⇒ Hash, number
Returns a list of layouts that can be paginated using the ‘page` query parameter and filtered by the environment where it is executed from the organization the user belongs to.
@queryparams:
40 41 42 |
# File 'lib/novu/api/layouts.rb', line 40 def layouts(query = {}) get("/layouts", query: query) end |
#make_default_layout(layout_id) ⇒ number
Sets the default layout for the environment and updates to non default to the existing default layout (if any).
@pathparams:
101 102 103 |
# File 'lib/novu/api/layouts.rb', line 101 def make_default_layout(layout_id) post("/layouts/#{layout_id}/default") end |
#update_layout(layout_id, body) ⇒ Hash, number
Update the name, content and variables of a layout. Also change it to be default or no.
@pathparams:
89 90 91 |
# File 'lib/novu/api/layouts.rb', line 89 def update_layout(layout_id, body) patch("/layouts/#{layout_id}", body: body) end |