Module: CareerBuilder::Client::Authentication

Included in:
CareerBuilder::Client
Defined in:
lib/career_builder/client/authentication.rb

Instance Method Summary collapse

Instance Method Details

#authenticateObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/career_builder/client/authentication.rb', line 9

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

#authenticated?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/career_builder/client/authentication.rb', line 24

def authenticated?
  !session_token.nil?
end

#session_tokenObject



5
6
7
# File 'lib/career_builder/client/authentication.rb', line 5

def session_token
  @session_token
end