lib/testingbot/api.rb in testingbot-0.2.2 vs lib/testingbot/api.rb in testingbot-0.2.3

- old
+ new

@@ -49,10 +49,34 @@ def get_available_devices get("/devices/available") end + def get_team + get("/team-management") + end + + def get_users_in_team(offset = 0, count = 10) + get("/team-management/users?offset=#{offset}&count=#{count}") + end + + def get_user_in_team(user_id) + get("/team-management/users/#{user_id}") + end + + def create_user_in_team(user = {}) + post("/team-management/users/", user) + end + + def update_user_in_team(user_id, user = {}) + put("/team-management/users/#{user_id}", user) + end + + def reset_credentials(user_id) + post("/team-management/users/#{user_id}/reset-keys") + end + def update_user_info(params = {}) new_params = {} params.keys.each do |key| new_params["user[#{key}]"] = params[key] end @@ -97,10 +121,22 @@ def delete_build(build_identifier) delete("/builds/#{build_identifier}") end + def take_screenshots(configuration) + post("/screenshots", configuration) + end + + def get_screenshots_history(offset = 0, count = 10) + get("/screenshots?offset=#{offset}&count=#{count}") + end + + def get_screenshots(screenshots_id) + get("/screenshots/#{screenshots_id}") + end + def get_tunnels get("/tunnel/list") end def delete_tunnel(tunnel_identifier) @@ -147,25 +183,12 @@ end private def load_config_file - is_windows = false - - begin - require 'rbconfig' - is_windows = (RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/) - rescue - is_windows = (RUBY_PLATFORM =~ /w.*32/) || (ENV["OS"] && ENV["OS"] == "Windows_NT") - end + config_file = File.join(Dir.home, ".testingbot") - if is_windows - config_file = "#{ENV['HOMEDRIVE']}\\.testingbot" - else - config_file = File.expand_path("#{Dir.home}/.testingbot") - end - - if File.exists?(config_file) + if File.exist?(config_file) str = File.open(config_file) { |f| f.readline }.chomp return str.split(':') end return nil