Class: Codebot::Options::Integration
- Inherits:
-
Thor
- Object
- Thor
- Codebot::Options::Integration
- Defined in:
- lib/codebot/options/integration.rb
Overview
A class that handles the codebot integration command.
Class Method Summary collapse
-
.exit_on_failure? ⇒ Boolean
Ensures that thor uses the correct exit code.
-
.shared_propery_options ⇒ Object
Sets shared options for specifying properties belonging to the Integration class.
Instance Method Summary collapse
-
#create(name) ⇒ Object
Creates a new integration with the specified name.
-
#destroy(name) ⇒ Object
Destroys the integration with the specified name.
-
#list(search = nil) ⇒ Object
Lists all integrations, or integrations with names containing the given search term.
-
#update(name) ⇒ Object
Updates the integration with the specified name.
Class Method Details
.exit_on_failure? ⇒ Boolean
Ensures that thor uses the correct exit code.
84 85 86 |
# File 'lib/codebot/options/integration.rb', line 84 def self.exit_on_failure? true end |
.shared_propery_options ⇒ Object
Sets shared options for specifying properties belonging to the Integration class.
13 14 15 16 17 18 |
# File 'lib/codebot/options/integration.rb', line 13 def self. option :endpoint, aliases: '-e', desc: 'Set the endpoint for incoming webhooks' option :secret, aliases: '-s', desc: 'Set the secret for verifying webhook payloads' end |
Instance Method Details
#create(name) ⇒ Object
Creates a new integration with the specified name.
28 29 30 31 32 33 |
# File 'lib/codebot/options/integration.rb', line 28 def create(name) Options.with_core(, true) do |core| map_channels!(, :channels) IntegrationManager.new(core.config).create(.merge(name: name)) end end |
#destroy(name) ⇒ Object
Destroys the integration with the specified name.
63 64 65 66 67 |
# File 'lib/codebot/options/integration.rb', line 63 def destroy(name) Options.with_core(, true) do |core| IntegrationManager.new(core.config).destroy(name, ) end end |
#list(search = nil) ⇒ Object
Lists all integrations, or integrations with names containing the given search term.
75 76 77 78 79 |
# File 'lib/codebot/options/integration.rb', line 75 def list(search = nil) Options.with_core(, true) do |core| IntegrationManager.new(core.config).list(search) end end |
#update(name) ⇒ Object
Updates the integration with the specified name.
51 52 53 54 55 56 |
# File 'lib/codebot/options/integration.rb', line 51 def update(name) Options.with_core(, true) do |core| map_channels!(, :add_channel) IntegrationManager.new(core.config).update(name, ) end end |