restforce to your
Gemfile, then run
bundle install (or install it manually with
gem 'restforce', '~> 3.1.0'
The gem only supports Ruby 2.3 onwards. To use Restforce with earlier versions of Ruby, you'll need to specifically install v2.5.3 or earlier.
# Don't commit your authentication details with your code - use environment variables <3 export SALESFORCE_USERNAME="username" export SALESFORCE_PASSWORD="password" export SALESFORCE_SECURITY_TOKEN="security token" export SALESFORCE_CLIENT_ID="client id" export SALESFORCE_CLIENT_SECRET="client secret" export SALESFORCE_API_VERSION="38.0"
client = Restforce.new
3. Query Salesforce like a pro.
my_leads = client.query("SELECT Id, Source FROM Lead where OwnerId = 'INSERT_USER_ID_HERE'") # => #<Restforce::Collection >
NoMethodErrorwhen upserting an existing record.
upsert!mutated the provided attributes, starts raising an error where a custom external ID field name is supplied to
upsert!but it is missing from the provided attributes, and uses the client's configured SSL options for authentication requests. (changelog)
upserting with an ID, and relaxes the gem's dependency on Faraday to allow upgrading it to 1.0. (changelog)
SALESFORCE_API_VERSIONenvironment variable. (changelog)
300is returned due to an external ID matching multiple records for an upsert operation. (changelog)
Restforce::ServerErrorwhen Salesforce is experiencing problems, and improves the handling of the response body in errors. (changelog)
If you have any questions, contact Tim Rogers, the maintainer.
Want help using Restforce, with contributing, or have another question?