lib/client/client.rb in factor-0.0.99 vs lib/client/client.rb in factor-0.1.00

- old
+ new

@@ -9,10 +9,11 @@ module Client class Client attr_accessor :host def initialize(host="http://factor.io") + #def initialize(host="http://localhost:3000/") @host=host end def register(email,password) end @@ -112,28 +113,29 @@ def get_workflows() rest_get("workflows") end - def remove_workflow(name="") - rest_delete("workflows",{:name=>name}) - end + # def remove_workflow(name="") + # rest_delete("workflows",{:name=>name}) + # end # channels - def add_channel(key,path) - file=zip(path) - rest_post("channels",{:name=>key,:zip=>file}) + def add_channel(path,definition_file) + file=zip(File.expand_path(path)) + definition = File.read(definition_file) + rest_post("channels",{:zip=>file,:definition=>definition}) end def get_channels() rest_get("channels") end - def remove_channel(name="") - rest_delete("channels",{:name=>name}) - end + # def remove_channel(name="") + # rest_delete("channels",{:name=>name}) + # end @@ -172,10 +174,10 @@ end def zip(directory) path=directory.dup path.sub!(%r[/$],'') - zip_path = File.join(path,File.basename(path))+'.zip' + zip_path = File.join(path,"..",File.basename(path))+'.zip' FileUtils.rm zip_path, :force=>true Zip::ZipFile.open(zip_path, 'w') do |zip| Dir["#{path}/**/**"].reject{|f|f==zip_path}.each do |file| zip.add(file.sub(path+'/',''),file) end \ No newline at end of file