0.0
The project is in a healthy, maintained state
Ruby wrapper to mimick parts of ActiveRecord query interface to obtain data conveniently (and human friendly 😅) from Salesforce RESTful API.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 3.2

Runtime

~> 13.0
~> 3.2
~> 1.3
~> 2.10.0
~> 7.5.0
 Project Readme

UseTheForce

Ruby wrapper to mimick parts of ActiveRecord query interface to obtain data conveniently (and human friendly 😅) from Salesforce RESTful API.

Installation

Add this line to your application's Gemfile:

gem 'use_the_force'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install use_the_force

Usage

Put your authentication credentials in an initializer:

UseTheForce.configuration do |config|
  config.username = ENV["SALESFORCE_USERNAME"]
  config.pw = ENV["SALESFORCE_PW"]
  config.api_version = ENV["SALESFORCE_API_VERSION"]
  config.client_id = ENV["SALESFORCE_CLIENT_ID"]
  config.client_secret = ENV["SALESFORCE_CLIENT_SECRET"]
  config.security_token = ENV["SALESFORCE_SECURITY_TOKEN"]
  config.instance_url = ENV["SALESFORCE_INSTANCE_URL"]
end

Define your Salesforce models:

class Salesforce::User < UseTheForce::Base
  fields :Email, :Name, :IsPirate__c
  table_name :User__c
end

Lookup records in a similar fashion like ActiveRecord, for example, you can use find_by:

user = Salesforce::User.find_by(Email: "guybrush.threepwood@trendence.de")
user.Name # Guybrush Threepwood

… or where for filering:

pirates = Salesforce::Pirate.where(Flag__c: "black").where(HasWoodenLeg: false).all
pirates.count # 42