Class: Pixela::Channel
- Inherits:
-
Object
- Object
- Pixela::Channel
- Defined in:
- lib/pixela/channel.rb
Instance Attribute Summary collapse
- #channel_id ⇒ String readonly
- #client ⇒ Pixela::Client readonly
- #id ⇒ String readonly
Instance Method Summary collapse
-
#create(name:, type:, detail:) ⇒ Pixela::Response
Create a new channel settings for notification.
-
#create_with_slack(name:, url:, user_name:, channel_name:) ⇒ Pixela::Response
Create a new channel settings for slack notification.
-
#delete ⇒ Pixela::Response
Delete predefined channel settings.
-
#initialize(client:, channel_id:) ⇒ Channel
constructor
A new instance of Channel.
-
#update(name:, type:, detail:) ⇒ Pixela::Response
Update predefined channel settings.
-
#update_with_slack(name:, url:, user_name:, channel_name:) ⇒ Pixela::Response
Update predefined slack channel settings.
Constructor Details
#initialize(client:, channel_id:) ⇒ Channel
Returns a new instance of Channel.
13 14 15 16 |
# File 'lib/pixela/channel.rb', line 13 def initialize(client:, channel_id:) @client = client @channel_id = channel_id end |
Instance Attribute Details
#channel_id ⇒ String (readonly)
9 10 11 |
# File 'lib/pixela/channel.rb', line 9 def channel_id @channel_id end |
#client ⇒ Pixela::Client (readonly)
5 6 7 |
# File 'lib/pixela/channel.rb', line 5 def client @client end |
#id ⇒ String (readonly)
9 |
# File 'lib/pixela/channel.rb', line 9 attr_reader :channel_id |
Instance Method Details
#create(name:, type:, detail:) ⇒ Pixela::Response
Create a new channel settings for notification.
32 33 34 |
# File 'lib/pixela/channel.rb', line 32 def create(name:, type:, detail:) client.create_channel(channel_id: channel_id, name: name, type: type, detail: detail) end |
#create_with_slack(name:, url:, user_name:, channel_name:) ⇒ Pixela::Response
Create a new channel settings for slack notification.
51 52 53 |
# File 'lib/pixela/channel.rb', line 51 def create_with_slack(name:, url:, user_name:, channel_name:) client.create_slack_channel(channel_id: channel_id, name: name, url: url, user_name: user_name, channel_name: channel_name) end |
#delete ⇒ Pixela::Response
Delete predefined channel settings.
102 103 104 |
# File 'lib/pixela/channel.rb', line 102 def delete client.delete_channel(channel_id: channel_id) end |
#update(name:, type:, detail:) ⇒ Pixela::Response
Update predefined channel settings.
69 70 71 |
# File 'lib/pixela/channel.rb', line 69 def update(name:, type:, detail:) client.update_channel(channel_id: channel_id, name: name, type: type, detail: detail) end |
#update_with_slack(name:, url:, user_name:, channel_name:) ⇒ Pixela::Response
Update predefined slack channel settings.
88 89 90 |
# File 'lib/pixela/channel.rb', line 88 def update_with_slack(name:, url:, user_name:, channel_name:) client.update_slack_channel(channel_id: channel_id, name: name, url: url, user_name: user_name, channel_name: channel_name) end |