Skip to content

Instantly share code, notes, and snippets.

@DylanLacey
Created March 22, 2013 04:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save DylanLacey/5218959 to your computer and use it in GitHub Desktop.
Save DylanLacey/5218959 to your computer and use it in GitHub Desktop.
Using RestClient with the Sauce Labs REST API
http = "https://saucelabs.com/rest/v1/#{username}/jobs/#{job_id}"
body = {"name" => "Log In Test"}.to_json
RestClient::Request.execute(
:method => :put,
:url => http,
:user => username,
:password => access_key,
:headers => {:content_type => "application/json"},
:payload => body
)
http_auth = "https://#{username}:#{access_key}@saucelabs.com/rest/v1/#{username}/jobs/#{job_id}"
body = {"name" => "Log In Test"}.to_json
RestClient.put(http_auth, body, {:content_type => "application/json"})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment