require_relative 'auth' require 'savon' require 'json' module LeapSalesforce # Holds information about a login session class Session # @return [String] Session id returned from SOAP API attr_accessor :session_id # @return [String] User id returned from SOAP API attr_accessor :user_id def initialize(username, password) login_body = LeapSalesforce::Session.soap_login username, password self.session_id = login_body[:login_response][:result][:session_id] self.user_id = login_body[:login_response][:result][:session_id] end class << self # Login via SOAP API def soap_login(username, password) client = Savon.client do endpoint "#{SoqlHandler.instance_url}/services/Soap/u/51.0" namespace "urn:partner.soap.sforce.com" end response = client.call(:login, message: { username: username, password: password }) response.body end end end end