Salesforce_connector

Rails gem to connect an application to Salesforce accounts.

Install in your Gemfile

gem 'salesforce_connector'

Dependencies

Salesforce Connector is based on HTTParty to access Salesforce API and on OmniAuth to retrieve OAuth2 tokens.

Usage

In your initiliazer (Rails3) or config.ru file (Sinatra or Padrino) add the 4 following elements

Add the Forcedotcom OAuth Strategy

module OmniAuth
  module Strategies
    #tell omniauth to load our strategy
    autoload :Forcedotcom, '???'
  end
end

Define the current host:

OmniAuth.config.full_host = 'https://localhost:3000'

Configure the Salesforce remote server URL and version

ENV['sfdc_instance_url'] = "https://eu1.salesforce.com"
ENV['sfdc_api_version']  = "21.0"

Load the Forcedotcom OAuth strategy

use OmniAuth::Builder do
  provider :forcedotcom, '3MVG9PhR6g6B7ps6in8a_o8S1IvXGM41y725iSJXhSWZm5GJ0gZgvuQkLdT7YWOLciMWxn5yDglwAcjkGzcal', '2539130913145733702'
end

Note

Salesforce OAuth only implement https authentication. Be sure that your server (requester) is also running behing https.

License

Copyright © 2011 Vzmind

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.