Sha256: 969a82bbdb07dacb4486bb255dd23921fcb7f5991c775bc3965f79269901a31c

Contents?: true

Size: 880 Bytes

Versions: 2

Compression:

Stored size: 880 Bytes

Contents

require 'rest_client'
require 'json'

module Sauce
  # The module that brokers most communication with Sauce Labs' REST API
  class Client
    class BadAccessError < StandardError; end #nodoc
    class MisconfiguredError < StandardError; end #nodoc

    attr_accessor :username, :access_key, :client, :ip, :api_url
    attr_accessor :tunnels

    def initialize(options)
      @username   = options[:username]
      @access_key = options[:access_key]
      @ip         = options[:ip]

      raise MisconfiguredError if @username.nil? or @access_key.nil?
      @api_url = "https://#{@username}:#{@access_key}@saucelabs.com/rest/#{@username}/"
      @client = RestClient::Resource.new @api_url

      @tunnels = Sauce::Tunnel
      @tunnels.client = @client
      @tunnels.account = {:username => @username,
        :access_key => @access_key,
        :ip => @ip}
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sauce-0.2.2 lib/rest.rb
sauce-0.2.1 lib/rest.rb