lib/nodester/client.rb in nodester-0.0.3 vs lib/nodester/client.rb in nodester-0.0.5

- old
+ new

@@ -45,11 +45,11 @@ # # @param [HTTParty::Response] the response as returned by the web request. # @raise [ResponseError] raised in case of a web service related error. # @raise [StandardError] raised in case of an error that is not web service related. # @return [HTTParty::Response] the response as returned by the web request. - def self.bad_response(response) + def bad_response(response) if response.class == HTTParty::Response raise ResponseError, response end raise StandardError, "Unkown error" end @@ -155,11 +155,11 @@ # @param (String) appname the name of the app. # @param (Boolean) running true to start the app; false to stop the app. # @return [HTTParty::Response] A response. def start_stop_app(appname,running = true) - options={:body=> {:appname => appname, :running=>start}, :basic_auth => @auth} + options={:body=> {:appname => appname, :running=>running}, :basic_auth => @auth} handle_result self.class.put('/app', options) end # Deletes an app. # @param (String) appname the name of the app. @@ -218,12 +218,10 @@ # @return [HTTParty::Response] A response. def env(appname,key) options={:body => {:appname => appname,:key=>key},:basic_auth => @auth} handle_result self.class.get('/env', options) end - - # curl -X POST -u "mwawrusch:mw09543089" -d "appname=myappname&action=install&package=express" http://api.nodester.com/npm - + # Manages the NPM package manager associated with an app. # @param (String) appname the name of the app. # @param (String) action the action to perform. Can be install|upgrade|uninstall. Check official documentation # for more info. # @param (String) package the name of the package that should be worked with.