lib/pardot/authentication.rb in ruby-pardot-1.0.2 vs lib/pardot/authentication.rb in ruby-pardot-1.1.0
- old
+ new
@@ -1,10 +1,11 @@
module Pardot
module Authentication
def authenticate
resp = post "login", nil, :email => @email, :password => @password, :user_key => @user_key
+ update_version(resp["version"]) if resp && resp["version"]
@api_key = resp && resp["api_key"]
end
def authenticated?
@api_key != nil
@@ -12,8 +13,17 @@
def reauthenticate
@api_key = nil
authenticate
end
-
+
+ private
+
+ def update_version version
+ if version.is_a? Array
+ version = version.last
+ end
+ @version = version if version.to_i > 3
+ end
+
end
end