lib/cli/channel_task.rb in factor-0.1.10 vs lib/cli/channel_task.rb in factor-0.3.1
- old
+ new
@@ -1,37 +1,35 @@
require 'rubygems'
require 'cli/command'
-require 'zip/zip'
-require 'zip/zipfilesystem'
module Factor
module CLI
class ChannelTask < Command
-
- desc "call CHANNEL METHOD TARGET","start a workflow"
- method_option :parameters, :type=>:hash, :default=>{}, :required=>false
- def call(channel, method, target)
-
- puts "not implemented"
-
- end
-
-
-
desc "list", "list all the channels"
#method_option :key, :alias=>"-k", :type=>:string, :desc=>"key reference"
def list
- puts @client.get_channels
+ @client.get_channels().each do |channel|
+ puts "#{channel['name']} (#{channel['slug']})"
+ puts " Listeners:" if channel['listeners'].count>0
+ channel['listeners'].each do |listener|
+ puts " #{listener['name']}: #{listener['description']}"
+ end
+ puts " Actions:" if channel['actions'].count>0
+ channel['actions'].each do |action|
+ puts " #{action['name']}: #{action['description']}"
+ end
+ end
end
- desc "add DIRECTORY DEFINITION", "add a key and value for the credential"
- def add(directory,definition_file)
- puts @client.add_channel(directory,definition_file)
+ desc "create DIRECTORY DEFINITION", "add a key and value for the credential"
+ method_option :organization, :alias=>"-o", :type=>:string, :desc=>"Organizoation to which this workflow belongs"
+ def create(directory,definition_file)
+ puts @client.create_channel(directory,definition_file,options[:organization])["notice"]
end
- desc "remove NAME", "remove a workflow"
- def remove(name)
- puts @client.remove_channel(name)
+ desc "delete NAME", "remove a workflow"
+ def delete(name)
+ puts @client.delete_channel(name)["notice"]
end
end
end
\ No newline at end of file