Skip to content

A plugin to connect to Salesforce.com using ActiveRecord-like syntax

License

Notifications You must be signed in to change notification settings

paulsingh/simple_salesforce

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SimpleSalesforce

SimpleSalesforce allows you to interact with Salesforce.com accounts as if they were ActiveRecord databases.

Simply subclass SimpleSalesforce::SalesforceObject::Base with whatever class name you like, choose which Salesforce object type it should represent, and map whichever fields you like to your local object.

On installation, a blank salesforce.yml will be copied into RAILS_ROOT/config – ensure you fill in your username, password and security token.

Installation

script/plugin install git://github.com/survival/simple_salesforce.git

You will also need the RForce (>=0.3) gem, so if you haven’t already in environment.rb:

config.gem 'rforce'

then

rake gems:install

Setting up the model

class SalesforceContact < SimpleSalesforce::SalesforceObject::Base

  use_salesforce_object "Contact"
  map_field :first_name, :to_salesforce_field => :FirstName
  map_field :last_name, :to_salesforce_field => :LastName
  map_field :Salutation    # this is the equivalent of map_field :Salutation, :to_salesforce_field => :Salutation

end

Interacting with the model

SalesforceContact.create(:first_name => "John", :last_name => "Doe")
SalesforceContact.find_by_last_name("Doe")
SalesforceContact.find_all_by_first_name("Jo%")
SalesforceContact.find(:first)

john = SalesforceContact.find(:all, :conditions => {:first_name => "John"})
john.first_name = "Jonathan"
john.save

john.update_attributes(:last_name => "Doer")

john.destroy

Copyright © 2009 Survival International, released under the MIT license

About

A plugin to connect to Salesforce.com using ActiveRecord-like syntax

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published