Sha256: 0458decf69aec38c8c89d52c91bb2099560af52580257d8e5c10711f8466fb15

Contents?: true

Size: 643 Bytes

Versions: 3

Compression:

Stored size: 643 Bytes

Contents

module CareerBuilder
  class Client
    module Authentication

      def session_token
        @session_token
      end

      def authenticate
        response = request("BeginSessionV2", 'Email' => email, 'Password' => password)

        packet = Nokogiri::XML(response)

        if session_token = packet.search("//SessionToken")
          session_token_text = session_token.text
          if session_token_text == "Invalid"
            @session_token = nil
          else
            @session_token = session_token_text
          end
        end
      end

      def authenticated?
        !session_token.nil?
      end

    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
career_builder-0.2.2 lib/career_builder/client/authentication.rb
career_builder-0.2.1 lib/career_builder/client/authentication.rb
career_builder-0.2.0 lib/career_builder/client/authentication.rb