Sha256: 19cbc74a8757ee1d11e5530479b0904ad8ed6d359f64a8736fe3c1a9931f5bbd

Contents?: true

Size: 588 Bytes

Versions: 1

Compression:

Stored size: 588 Bytes

Contents

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
    end
    
    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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ruby-pardot-1.1.0 lib/pardot/authentication.rb