Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/appfolio/activeforce
Activeforce provides a simple to use and extend interface to Salesforce using the REST API
https://github.com/appfolio/activeforce
Last synced: about 1 month ago
JSON representation
Activeforce provides a simple to use and extend interface to Salesforce using the REST API
- Host: GitHub
- URL: https://github.com/appfolio/activeforce
- Owner: appfolio
- License: mit
- Archived: true
- Created: 2012-06-29T21:45:52.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2019-06-25T19:24:32.000Z (over 5 years ago)
- Last Synced: 2024-10-31T08:15:33.537Z (2 months ago)
- Language: Ruby
- Size: 113 KB
- Stars: 9
- Watchers: 148
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# ActiveForce
[![Gem Version](https://badge.fury.io/rb/activeforce.svg)](http://badge.fury.io/rb/activeforce)
[![Build Status](https://travis-ci.org/appfolio/activeforce.svg?branch=master)](https://travis-ci.org/appfolio/activeforce)Activeforce provides a clean ActiveRecord-like interface to the SalesForce.com REST API.
Activeforce does not provide any integration with any Appfolio products.
* Detects the schema of the SalesForce Objects on the fly, so that you can interact with the familiar ActiveRecord style attribute accessor methods.
* Provides full access to all methods provided to the SQL-like Salesforce Object Query Language (SOQL).
* Integrates with Salesforce.com REST-based BULK API.## Configuration
### Simple Usage
Salesforce.configure do
username "[email protected]"
password "salesforcepassword"
end
The password is a combination of your salesforce password and the API Token### Specifying a particular API version
By default, activeforce uses version 22 of the Salesforce REST API. To specify another version:
Salesforce.configure do
username "[email protected]"
password "salesforcepasswordapitoken" # This should be your salesforce password + your API Token
api_version 18
end### Using the Sandbox
Salesforce.configure do
username "[email protected]"
password "salesforcepassword"
end### Finders
activeforce provides implementation for some standard Salesforce Objects like Account, Contact, Opportunity, etc
### Accessing custom objects
activeforce provides an easy way to declare models for custom objects or other SalesForce objects that are not included by default.
class Salesforce::CustomObject < Salesforce::Base
self.custom_object = true
end
# or
class Salesforce::Feed < Salesforce::Base
end
#### Find all objects
Salesforce::Account.all
#### Find Account by id
Salesforce::Account.find("accountid")
#### Dynamic Finders
Salesforce::Account.find_by_name("accountname")
#### Specifying conditionshttp://www.salesforce.com/us/developer/docs/api/index_Left.htm#CSHID=sforce_api_calls_soql.htm|StartTopic=Content%2Fsforce_api_calls_soql.htm|SkinName=webhelp
Salesforce::Account.find(:all, :conditions => ":name = :value", :value => "my special name")
# Issues a SOQL query to search for all Account objects where the field 'Name' matches "my special name"
# The SOQL Query is SELECT Id,Name,... FROM Account WHERE Name = 'my special name'
#
# This method of specifying columns in the query handles custom columns as well.
Salesforce::Account.find(:all, :conditions => ":account_type = :value", :value => "Special")
# The SOQL Query issued here is SELECT Id,Name,... FROM Account WHERE Account_Type__c = 'Special'
#### Creating and Updating Objects#### Deleting Objects
## Salesforce Bulk API
You can create and schedule a job by:
job = Salesforce::Account.bulk_update do
batch do
record account_1 # account_1 is an object of type Salesforce::Account
record account_2 # account_1 is an object of type Salesforce::Account
end
endYou can specify the columns that you want to update
job = Salesforce::Account.bulk_update(:name, :website) do
batch do
record account_1 # account_1 is an object of type Salesforce::Account
record account_2 # account_1 is an object of type Salesforce::Account
end
end
### Contributing to activeforce
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
* Fork the project
* Start a feature/bugfix branch
* Commit and push until you are happy with your contribution
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.### Copyright
Copyright (c) 2012 AppFolio, Inc.. See LICENSE.txt for further details.