lib/gooddata/connection.rb in gooddata-0.5.11 vs lib/gooddata/connection.rb in gooddata-0.5.12
- old
+ new
@@ -33,11 +33,13 @@
LOGIN_PATH = '/gdc/account/login'
TOKEN_PATH = '/gdc/account/token'
STAGE_PATH = '/uploads/'
attr_reader(:auth_token)
+ attr_accessor :status
+
# Options:
# * :tries - Number of retries to perform. Defaults to 1.
# * :on - The Exception on which a retry will be performed. Defaults to Exception, which retries on any Exception.
#
# Example
@@ -73,10 +75,19 @@
@username = username
@password = password
@url = url || DEFAULT_URL
@auth_token = options.delete(:auth_token)
@options = options
+
+ @server = RestClient::Resource.new @url,
+ :timeout => @options[:timeout],
+ :headers => {
+ :content_type => :json,
+ :accept => [ :json, :zip ],
+ :user_agent => GoodData.gem_version_string,
+ }
+
end
# Returns the user JSON object of the currently logged in GoodData user account.
def user
ensure_connection
@@ -276,17 +287,9 @@
'login' => @username,
'password' => @password,
'remember' => 1
}
}
-
- @server = RestClient::Resource.new @url,
- :timeout => @options[:timeout],
- :headers => {
- :content_type => :json,
- :accept => [ :json, :zip ],
- :user_agent => GoodData.gem_version_string,
- }
GoodData.logger.debug "Logging in..."
@user = post(LOGIN_PATH, credentials, :dont_reauth => true)['userLogin']
refresh_token :dont_reauth => true # avoid infinite loop if refresh_token fails with 401