Class: Pixela::Notification
- Inherits:
-
Object
- Object
- Pixela::Notification
- Defined in:
- lib/pixela/notification.rb
Instance Attribute Summary collapse
- #client ⇒ Pixela::Client readonly
- #graph_id ⇒ String readonly
- #notification_id ⇒ String readonly
Instance Method Summary collapse
-
#create(name:, target:, condition:, threshold:, remind_by: nil, channel_id:) ⇒ Pixela::Response
Create a notification rule.
-
#delete ⇒ Pixela::Response
Delete predefined notification settings.
-
#initialize(client:, graph_id:, notification_id:) ⇒ Notification
constructor
A new instance of Notification.
-
#update(name:, target:, condition:, threshold:, channel_id:) ⇒ Pixela::Response
Update predefined notification rule.
Constructor Details
#initialize(client:, graph_id:, notification_id:) ⇒ Notification
Returns a new instance of Notification.
18 19 20 21 22 |
# File 'lib/pixela/notification.rb', line 18 def initialize(client:, graph_id:, notification_id:) @client = client @graph_id = graph_id @notification_id = notification_id end |
Instance Attribute Details
#client ⇒ Pixela::Client (readonly)
5 6 7 |
# File 'lib/pixela/notification.rb', line 5 def client @client end |
#graph_id ⇒ String (readonly)
9 10 11 |
# File 'lib/pixela/notification.rb', line 9 def graph_id @graph_id end |
#notification_id ⇒ String (readonly)
13 14 15 |
# File 'lib/pixela/notification.rb', line 13 def notification_id @notification_id end |
Instance Method Details
#create(name:, target:, condition:, threshold:, remind_by: nil, channel_id:) ⇒ Pixela::Response
Create a notification rule.
41 42 43 |
# File 'lib/pixela/notification.rb', line 41 def create(name:, target:, condition:, threshold:, remind_by: nil, channel_id:) client.create_notification(graph_id: graph_id, notification_id: notification_id, name: name, target: target, condition: condition, threshold: threshold, remind_by: remind_by, channel_id: channel_id) end |
#delete ⇒ Pixela::Response
Delete predefined notification settings.
75 76 77 |
# File 'lib/pixela/notification.rb', line 75 def delete client.delete_notification(graph_id: graph_id, notification_id: notification_id) end |
#update(name:, target:, condition:, threshold:, channel_id:) ⇒ Pixela::Response
Update predefined notification rule.
61 62 63 |
# File 'lib/pixela/notification.rb', line 61 def update(name:, target:, condition:, threshold:, channel_id:) client.update_notification(graph_id: graph_id, notification_id: notification_id, name: name, target: target, condition: condition, threshold: threshold, channel_id: channel_id) end |