Class: CareerBuilder::Requests::Authentication

Inherits:
CareerBuilder::Request show all
Defined in:
lib/career_builder/requests/authentication.rb

Constant Summary

Constants inherited from CareerBuilder::Request

CareerBuilder::Request::RESUME_SERVICE_ENDPOINT_URL

Instance Attribute Summary

Attributes inherited from CareerBuilder::Request

#client, #options

Instance Method Summary collapse

Methods inherited from CareerBuilder::Request

#initialize

Constructor Details

This class inherits a constructor from CareerBuilder::Request

Instance Method Details

#performObject



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/career_builder/requests/authentication.rb', line 7

def perform
  response = perform_request("BeginSessionV2", "<Email>#{options[:email]}</Email><Password>#{options[:password]}</Password>")
  packet = Nokogiri::XML(response)

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