Module: Pixela::Client::ChannelMethods
- Included in:
- Pixela::Client
- Defined in:
- lib/pixela/client/channel_methods.rb
Instance Method Summary collapse
-
#create_channel(channel_id:, name:, type:, detail:) ⇒ Pixela::Response
Create a new channel settings for notification.
-
#create_slack_channel(channel_id:, name:, url:, user_name:, channel_name:) ⇒ Pixela::Response
Create a new channel settings for slack notification.
-
#delete_channel(channel_id:) ⇒ Pixela::Response
Delete predefined channel settings.
-
#get_channels ⇒ Array<Pixela::Response>
Get all predefined channels.
-
#update_channel(channel_id:, name:, type:, detail:) ⇒ Pixela::Response
Update predefined channel settings.
-
#update_slack_channel(channel_id:, name:, url:, user_name:, channel_name:) ⇒ Pixela::Response
Update predefined slack channel settings.
Instance Method Details
#create_channel(channel_id:, name:, type:, detail:) ⇒ Pixela::Response
Create a new channel settings for notification.
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/pixela/client/channel_methods.rb', line 17 def create_channel(channel_id:, name:, type:, detail:) params = { id: channel_id, name: name, type: type, detail: detail, } with_error_handling do connection.post("users/#{username}/channels", compact_hash(params)).body end end |
#create_slack_channel(channel_id:, name:, url:, user_name:, channel_name:) ⇒ Pixela::Response
Create a new channel settings for slack notification.
46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/pixela/client/channel_methods.rb', line 46 def create_slack_channel(channel_id:, name:, url:, user_name:, channel_name:) create_channel( channel_id: channel_id, name: name, type: "slack", detail: { url: url, userName: user_name, channelName: channel_name, }, ) end |
#delete_channel(channel_id:) ⇒ Pixela::Response
Delete predefined channel settings.
143 144 145 146 147 |
# File 'lib/pixela/client/channel_methods.rb', line 143 def delete_channel(channel_id:) with_error_handling do connection.delete("users/#{username}/channels/#{channel_id}").body end end |
#get_channels ⇒ Array<Pixela::Response>
Get all predefined channels.
69 70 71 72 73 |
# File 'lib/pixela/client/channel_methods.rb', line 69 def get_channels with_error_handling do connection.get("users/#{username}/channels").body.channels end end |
#update_channel(channel_id:, name:, type:, detail:) ⇒ Pixela::Response
Update predefined channel settings.
90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/pixela/client/channel_methods.rb', line 90 def update_channel(channel_id:, name:, type:, detail:) params = { name: name, type: type, detail: detail, } with_error_handling do connection.put("users/#{username}/channels/#{channel_id}", compact_hash(params)).body end end |
#update_slack_channel(channel_id:, name:, url:, user_name:, channel_name:) ⇒ Pixela::Response
Update predefined slack channel settings.
118 119 120 121 122 123 124 125 126 127 128 129 |
# File 'lib/pixela/client/channel_methods.rb', line 118 def update_slack_channel(channel_id:, name:, url:, user_name:, channel_name:) update_channel( channel_id: channel_id, name: name, type: "slack", detail: { url: url, userName: user_name, channelName: channel_name, }, ) end |