Sha256: bdea33f524c7e6f60f26dd0b4bdfe4a97c63196f438f5e720938752633858439

Contents?: true

Size: 1.23 KB

Versions: 1

Compression:

Stored size: 1.23 KB

Contents

require 'rubygems'
require 'cli/command'

module Factor
  module CLI
    class ChannelTask < Command
      desc "list", "list all the channels"
      #method_option :key, :alias=>"-k", :type=>:string, :desc=>"key reference"
      def list
        @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 "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 "delete NAME", "remove a workflow"
      def delete(name)
        puts @client.delete_channel(name)["notice"]
      end
  

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
factor-0.3.1 lib/cli/channel_task.rb