restforce to your
Gemfile, then run
bundle install (or install it manually with
gem 'restforce', '~> 2.5.3'
If you're using Ruby 1.9.3, you'll need to install version
2.4.2 - but we'd strongly recommend upgrading as Ruby 1.9 was deprecated long ago.
# 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 an absolute pro.
my_leads = client.query("SELECT Id, Source FROM Lead where OwnerId = 'INSERT_USER_ID_HERE'") # => #<Restforce::Collection >
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?