lib/vmc/client.rb in vmc-0.3.10 vs lib/vmc/client.rb in vmc-0.3.12.beta.1

- old
+ new

@@ -9,10 +9,11 @@ # client.create_service('redis', 'my_redis_service', opts); # require 'rubygems' require 'json/pure' +require 'open-uri' require File.expand_path('../const', __FILE__) class VMC::Client @@ -291,15 +292,21 @@ def proxy_for(proxy) @proxy = proxy end + def users + check_login_status + json_get(VMC::USERS_PATH) + end + def add_user(user_email, password) json_post(VMC::USERS_PATH, { :email => user_email, :password => password }) end def delete_user(user_email) + check_login_status http_delete("#{VMC::USERS_PATH}/#{user_email}") end ###################################################### @@ -372,10 +379,10 @@ rescue URI::Error, SocketError, Errno::ECONNREFUSED => e raise BadTarget, "Cannot access target (%s)" % [ e.message ] end def perform_http_request(req) - RestClient.proxy = ENV['https_proxy'] || ENV['http_proxy'] + RestClient.proxy = URI.parse(req[:url]).find_proxy() # Setup tracing if needed unless trace.nil? req[:headers]['X-VCAP-Trace'] = (trace == true ? '22' : trace) end