restforce to your
Gemfile, then run
bundle install (or install it manually with
gem 'restforce', '~> 2.5.0'
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 >
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?