class Restforce::Client
def initialize(options = {})
:instance_url => 'https://na1.salesforce.com'
Restforce::Client.new :oauth_token => 'access token',
# Initialize a new client with using any authentication middleware:
# => #
:client_secret => 'client secret'
:client_id => 'client id',
:instance_url => 'https://na1.salesforce.com',
:refresh_token => 'refresh token',
Restforce::Client.new :oauth_token => 'access token',
# Initialize a new client using oauth authentication:
# => #
:client_secret => 'client secret'
:client_id => 'client id',
:security_token => 'security token',
:password => 'pass',
Restforce::Client.new :username => 'user',
# Initialize a new client using password authentication:
Examples
:api_version - The String REST api version to use (default: '24.0')
authentication requests (default: 'login.salesforce.com').
:host - The String hostname to use during
:client_secret - The oauth client secret to use.
password and oauth authentication
:client_id - The oauth client id to use. Needed for both
(required if oauth authentication is used).
:instance_url - The String base url for all api requests
authentication is used).
oauth access tokens (required if oauth
:refresh_token - The String refresh token to obtain fresh
authentication is used).
calls (required unless password
:oauth_token - The String oauth access token to authenticate api
(required for password authentication).
:security_token - The String security token to use
:password - The String password to use (required for password authentication).
:username - The String username to use (required for password authentication).
options - A hash of options to be passed in (default: {}).
Public: Creates a new client instance
def initialize(options = {}) raise 'Please specify a hash of options' unless options.is_a?(Hash) @options = {}.tap do |options| [:username, :password, :security_token, :client_id, :client_secret, :host, :api_version, :oauth_token, :refresh_token, :instance_url, :cache, :authentication_retries].each do |option| options[option] = Restforce.configuration.send option end end @options.merge!(options) end