lib/rforce/binding.rb
# Log in to the server with OAuth, remembering
# the session ID returned to us by SalesForce.
Log in to the server with OAuth, remembering
the session ID returned to us by SalesForce.
Log in to the server with OAuth remembering the session ID returned to us by SalesForce .
def login_with_oauth
      result = @server.post @oauth[:login_url], '', {}
      case result
      when Net::HTTPSuccess
        doc = REXML::Document.new result.body
        @session_id = doc.elements['*/sessionId'].text
        server_url  = doc.elements['*/serverUrl'].text
        init_server server_url
        return {:sessionId => @sessionId, :serverUrl => server_url}
      when Net::HTTPUnauthorized
        raise 'Invalid OAuth tokens'
      else
        raise "Unexpected error: #{response.inspect}"
      end
    end
def login_with_oauth result = @server . post @oauth [ :login_url ] , '' , { } case result when Net :: HTTPSuccess doc = REXML :: Document . new result . body @session_id = doc . elements [ '*/sessionId' ] . text server_url = doc . elements [ '*/serverUrl' ] . text init_server server_url return { :sessionId => @sessionId , :serverUrl => server_url } when Net :: HTTPUnauthorized raise 'Invalid OAuth tokens' else raise "Unexpected error: #{response.inspect}" end end
Log in to the server with OAuth, remembering
the session ID returned to us by SalesForce.
Log in to the server with OAuth remembering the session ID returned to us by SalesForce .