def initialize(options={})
options = DEFAULT_OPTIONS.merge(options)
@options = options
@options[:rest_base_path] = @options[:context_path] + @options[:rest_base_path]
case options[:auth_type]
when :oauth
@request_client = OauthClient.new(@options)
@consumer = @request_client.consumer
when :basic
@request_client = HttpClient.new(@options)
when :cookie
raise ArgumentError, 'Options: :use_cookies must be true for :cookie authorization type' if @options.key?(:use_cookies) && !@options[:use_cookies]
@options[:use_cookies] = true
@request_client = HttpClient.new(@options)
@request_client.make_cookie_auth_request
else
raise ArgumentError, 'Options: ":auth_type" must be ":oauth", ":cookie" or ":basic"'
end
@http_debug = @options[:http_debug]
@options.freeze
@cache = OpenStruct.new
end