Class: DatabasusRuby::Notifiers
- Includes:
- Endpoint
- Defined in:
- lib/databasus_ruby/objects/notifiers.rb,
sig/databasus_ruby.rbs
Overview
Notification channels.
client.notifiers.save(name: "ops", notifierType: "SLACK",
workspaceId: id, slackNotifier: { ... })
POST /notifiers both creates and updates: include id in the payload to
update an existing notifier.
Constant Summary collapse
- TYPES =
%w[EMAIL TELEGRAM WEBHOOK SLACK DISCORD TEAMS].freeze
- NOTIFICATION_TYPES =
%w[ ALL BACKUP_SUCCESS BACKUP_FAILED HEALTHCHECK_SUCCESS HEALTHCHECK_FAILED VERIFICATION_SUCCESS VERIFICATION_FAILED ].freeze
Instance Attribute Summary
Attributes included from Endpoint
Instance Method Summary collapse
-
#delete(id) ⇒ Boolean
DELETE /notifiers/id.
-
#direct_test(**attributes) ⇒ Boolean
POST /notifiers/direct-test — tests a payload that has not been saved yet.
-
#get(id) ⇒ Object
(also: #find)
GET /notifiers/id.
-
#list(workspace_id: nil) ⇒ Collection
(also: #all)
GET /notifiers.
-
#save(**attributes) ⇒ Object
(also: #create, #update)
POST /notifiers.
-
#test(id) ⇒ Boolean
POST /notifiers/id/test — sends a test notification.
-
#transfer(id, target_workspace_id:) ⇒ Boolean
POST /notifiers/id/transfer.
Methods included from Endpoint
#acknowledged, #build, #collection, #compact, #escape, #http_delete, #http_get, #http_post, #http_put, #initialize, #inspect, #object, #single_value, #with_default_workspace
Methods inherited from Object
#==, #[], #hash, #initialize, #inspect, #key?, #keys, #method_missing, #respond_to_missing?, #to_h
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class DatabasusRuby::Object
Instance Method Details
#delete(id) ⇒ Boolean
DELETE /notifiers/id
40 41 42 |
# File 'lib/databasus_ruby/objects/notifiers.rb', line 40 def delete(id) acknowledged(http_delete("notifiers/#{escape(id)}")) end |
#direct_test(**attributes) ⇒ Boolean
POST /notifiers/direct-test — tests a payload that has not been saved yet.
50 51 52 |
# File 'lib/databasus_ruby/objects/notifiers.rb', line 50 def direct_test(**attributes) acknowledged(http_post("notifiers/direct-test", attributes)) end |
#get(id) ⇒ Object Also known as: find
GET /notifiers/id
27 28 29 |
# File 'lib/databasus_ruby/objects/notifiers.rb', line 27 def get(id) object(http_get("notifiers/#{escape(id)}")) end |
#list(workspace_id: nil) ⇒ Collection Also known as: all
GET /notifiers
21 22 23 |
# File 'lib/databasus_ruby/objects/notifiers.rb', line 21 def list(workspace_id: nil) collection(http_get("notifiers", { workspace_id: workspace_id || client.workspace_id! }), key: "notifiers") end |
#save(**attributes) ⇒ Object Also known as: create, update
POST /notifiers
33 34 35 |
# File 'lib/databasus_ruby/objects/notifiers.rb', line 33 def save(**attributes) object(http_post("notifiers", with_default_workspace(attributes))) end |
#test(id) ⇒ Boolean
POST /notifiers/id/test — sends a test notification.
45 46 47 |
# File 'lib/databasus_ruby/objects/notifiers.rb', line 45 def test(id) acknowledged(http_post("notifiers/#{escape(id)}/test")) end |
#transfer(id, target_workspace_id:) ⇒ Boolean
POST /notifiers/id/transfer
55 56 57 |
# File 'lib/databasus_ruby/objects/notifiers.rb', line 55 def transfer(id, target_workspace_id:) acknowledged(http_post("notifiers/#{escape(id)}/transfer", { targetWorkspaceId: target_workspace_id })) end |