SnoozeForce - A Client for Saleforce.com's REST API
Ruby
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
spec
.gitignore
.rvmrc
Gemfile
Gemfile.lock
LICENSE
README.textile
Rakefile
snooze_force.gemspec

README.textile

SnoozeForce – A Client for Saleforce.com’s REST API

Setup


  client = SnoozeForce::Client.new(:instance_url => 'https://XXX.salesforce.com', 
                                   :token => '00D...cg3', 
                                   :uid => '005...IAC', 
                                   :refresh_token => "5Ae...JcQ==",
                                   :client_id => '3MV...zYT',
                                   :client_secret => '782...385')

Use

Direct Access


  res = client.get('sobjects/User/005...IAC')
  puts res.inspect

Access Attributes


  res = client.user.me # same as: 
                       # client.get('sobjects/User/005...IAC')
                       # client.user.get('/005...IAC')
  puts res['Username'] # => 'joesmith'

Object Access


  res = client.news_feed.get # same as: 
                             # client.news_feed.get('/')
  puts res.inspect
  
  res = client.user.me # same as: 
                       # client.get('sobjects/User/005...IAC')
                       # client.user.get('/005...IAC')
  
  res = client.account.get('/XXXX')
  # etc....

SObject Details


  puts client.account._sobject.inspect # returns the details of the sobject

Describe


  puts client.account._describe

Fields


  puts client.account._fields

Query


  res = client.query("SELECT Id, Name FROM Account")
  puts res.inspect

Search


  res = client.search("FIND+{Oil}")
  puts res.inspect

Post


  res = client.account.post('/', {:body => {'Name' => 'Billy Bob'}})
  puts res.inspect