Press →, scroll, or swipe to advance
Made with Keydown
# configure client id/secret explicitly # client = Databasedotcom::Client.new :client_id => "xxx", :client_secret => "yyy" # configure client id/secret from a YAML file # client = Databasedotcom::Client.new "databasedotcom.yml" # configure client id/secret from the environment # client = Databasedotcom::Client.new
# authenticate with a username and password # client.authenticate(:username => "wayne@manor.com", :password => "arkham") # authenticate with a callback hash from Omniauth # client.authenticate(hash_from_omniauth) # authenticate with an externally-acquired OAuth2 access token # client.authenticate(:token => "whoa-that-is-long")
sobject_classnames = client.list_sobjects #=> ['Contact', 'Car', 'Company'] client.materialize('Contact') Contact.create "Name" => "Ron Jenkins" pivots = Contact.find_all_by_Company("Pivotal Labs") ron = Contact.find_by_Id("whatever") ron.update_attributes "Company" => "Some New Gig, LLC" ron.delete
client.materialize("Contact") Contact.attributes #=> ["Name", "Company", "Phone"] ron = Contact.find("rons_id") puts ron["Company"] #=> "The Olde Company, Inc." ron["Company"] = "Some New Gig, LLC" ron.reload["Company"] #=> "The Olde Company, Inc." ron["Company"] = "Some New Gig, LLC" ron.save ron.reload["Company"] #=> "Some New Gig, LLC"
Contact.label_for("Phone") #=> "Phone Number" Contact.picklist_values("Honorific") #=> ["Mr.", "Ms.", "Dr."]
Contact.find('some-id') Contact.first("Company = 'Pivotal Labs'")
Contact.find_by_Company_and_Title('Pivotal Labs', 'CEO') Contact.find_all_by_Company('Pivotal Labs')
Car.query("Color = 'Blue'") #=> a Collection of Cars
Account.search("FIND {bar}") #=> a Colletion of Accounts
cars = Car.all cars.length #=> 20 cars.total_size #=> 25 cars.next_page? #=> true more_cars = cars.next_page more_cars.length #=> 5 more_cars.total_size #=> 25 more_cars.next_page? #=> false more_cars.previous_page? #=> true
feed_items = Databasedotcom::Chatter::CompanyFeed.find(client, "me") feed_items.each do |feed_item| feed_item.likes #=> a Collection of Likes feed_item.comments #=> a Collection of Comments feed_item.raw_hash #=> a hash describing this FeedItem feed_item.comment("This is cool") #=> create a new comment on the FeedItem feed_item.like #=> like the FeedItem end me = Databasedotcom::Chatter::User.find(client, "me") me.followers #=> a Collection of Users me.post_status("what I'm doing now") #=> post a new status you = Databasedotcom::Chatter::User.find(client, "your-user-id") me.follow(you) #=> start following a user