Sha256: 6fff3e23dbb984ca282b1584c36cdb20914307ce4d34222819e3ffa736d15d5d

Contents?: true

Size: 598 Bytes

Versions: 4

Compression:

Stored size: 598 Bytes

Contents

module Pardot
  module Authentication
    
    def authenticate
      resp = post "login", nil, nil, 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

4 entries across 4 versions & 1 rubygems

Version Path
ruby-pardot-1.3.2 lib/pardot/authentication.rb
ruby-pardot-1.3.1 lib/pardot/authentication.rb
ruby-pardot-1.3.0 lib/pardot/authentication.rb
ruby-pardot-1.2.0 lib/pardot/authentication.rb