copious-activerecord-activesalesforce-adapter 2.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README +51 -0
- data/lib/active_record/connection_adapters/activesalesforce.rb +36 -0
- data/lib/active_record/connection_adapters/activesalesforce_adapter.rb +784 -0
- data/lib/active_record/connection_adapters/asf_active_record.rb +40 -0
- data/lib/active_record/connection_adapters/boxcar_command.rb +66 -0
- data/lib/active_record/connection_adapters/column_definition.rb +95 -0
- data/lib/active_record/connection_adapters/entity_definition.rb +59 -0
- data/lib/active_record/connection_adapters/id_resolver.rb +84 -0
- data/lib/active_record/connection_adapters/recording_binding.rb +90 -0
- data/lib/active_record/connection_adapters/relationship_definition.rb +81 -0
- data/lib/active_record/connection_adapters/result_array.rb +31 -0
- data/lib/active_record/connection_adapters/rforce.rb +361 -0
- data/lib/active_record/connection_adapters/sid_authentication_filter.rb +57 -0
- data/test/unit/basic_test.rb +203 -0
- data/test/unit/config.yml +5 -0
- data/test/unit/recorded_results/AsfUnitTestsBasicTest.test_add_notes_to_contact.recording +1966 -0
- data/test/unit/recorded_results/AsfUnitTestsBasicTest.test_assignment_rule_id.recording +1621 -0
- data/test/unit/recorded_results/AsfUnitTestsBasicTest.test_batch_insert.recording +1611 -0
- data/test/unit/recorded_results/AsfUnitTestsBasicTest.test_client_id.recording +1618 -0
- data/test/unit/recorded_results/AsfUnitTestsBasicTest.test_count_contacts.recording +1620 -0
- data/test/unit/recorded_results/AsfUnitTestsBasicTest.test_create_a_contact.recording +1611 -0
- data/test/unit/recorded_results/AsfUnitTestsBasicTest.test_find_a_contact.recording +1611 -0
- data/test/unit/recorded_results/AsfUnitTestsBasicTest.test_find_a_contact_by_first_name.recording +3468 -0
- data/test/unit/recorded_results/AsfUnitTestsBasicTest.test_find_a_contact_by_id.recording +1664 -0
- data/test/unit/recorded_results/AsfUnitTestsBasicTest.test_find_addresses.recording +1635 -0
- data/test/unit/recorded_results/AsfUnitTestsBasicTest.test_get_created_by_from_contact.recording +4307 -0
- data/test/unit/recorded_results/AsfUnitTestsBasicTest.test_master_detail.recording +1951 -0
- data/test/unit/recorded_results/AsfUnitTestsBasicTest.test_read_all_content_columns.recording +1611 -0
- data/test/unit/recorded_results/AsfUnitTestsBasicTest.test_save_a_contact.recording +1611 -0
- data/test/unit/recorded_results/AsfUnitTestsBasicTest.test_use_default_rule.recording +1618 -0
- data/test/unit/recorded_results/AsfUnitTestsBasicTest.test_use_update_mru.recording +1618 -0
- data/test/unit/recorded_test_case.rb +83 -0
- metadata +108 -0
data/README
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
== Welcome to Active Salesforce
|
2
|
+
|
3
|
+
ActiveSalesforce is an extension to the Rails Framework that allows for the dynamic creation and management of
|
4
|
+
ActiveRecord objects through the use of Salesforce meta-data and uses a Salesforce.com organization as the backing store.
|
5
|
+
|
6
|
+
|
7
|
+
== Getting started
|
8
|
+
|
9
|
+
1. gem install activesalesforce
|
10
|
+
2. if you have not already done so generate your initial rails app using "rails <myappname goes here>"
|
11
|
+
3. edit config/environment.rb and add "require_gem 'activesalesforce'" to the end of the "Rails::Initializer.run do |config|" block, e.g.
|
12
|
+
|
13
|
+
Rails::Initializer.run do |config|
|
14
|
+
...
|
15
|
+
|
16
|
+
require 'activesalesforce'
|
17
|
+
end
|
18
|
+
|
19
|
+
4. edit database.yml
|
20
|
+
|
21
|
+
adapter: activesalesforce
|
22
|
+
url: https://www.salesforce.com
|
23
|
+
username: <salesforce user name goes here>
|
24
|
+
password: <salesforce password goes here>
|
25
|
+
|
26
|
+
NOTE: If you want to access your Salesforce Sandbox account use https://test.salesforce.com as your url instead
|
27
|
+
|
28
|
+
5. proceed using standard Rails development techniques!
|
29
|
+
|
30
|
+
== Advanced Features
|
31
|
+
|
32
|
+
1. Session ID based Authentication: Add the following to /app/controllers/application.rb to enable SID auth for all controllers
|
33
|
+
|
34
|
+
class ApplicationController < ActionController::Base
|
35
|
+
before_filter ActiveSalesforce::SessionIDAuthenticationFilter
|
36
|
+
end
|
37
|
+
|
38
|
+
2. Boxcar'ing of updates, inserts, and deletes. Use <YourModel>.transaction() to demark boxcar boundaries.
|
39
|
+
|
40
|
+
== Description of contents
|
41
|
+
|
42
|
+
lib
|
43
|
+
Application specific libraries. Basically, any kind of custom code that doesn't
|
44
|
+
belong under controllers, models, or helpers. This directory is in the load path.
|
45
|
+
|
46
|
+
script
|
47
|
+
Helper scripts for automation and generation.
|
48
|
+
|
49
|
+
test
|
50
|
+
Unit and functional tests along with fixtures.
|
51
|
+
|
@@ -0,0 +1,36 @@
|
|
1
|
+
=begin
|
2
|
+
ActiveSalesforce
|
3
|
+
Copyright 2006 Doug Chasman
|
4
|
+
|
5
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
you may not use this file except in compliance with the License.
|
7
|
+
You may obtain a copy of the License at
|
8
|
+
|
9
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
|
11
|
+
Unless required by applicable law or agreed to in writing, software
|
12
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
See the License for the specific language governing permissions and
|
15
|
+
limitations under the License.
|
16
|
+
=end
|
17
|
+
|
18
|
+
require 'activesalesforce_adapter'
|
19
|
+
|
20
|
+
module ActionView
|
21
|
+
module Helpers
|
22
|
+
# Provides a set of methods for making easy links and getting urls that depend on the controller and action. This means that
|
23
|
+
# you can use the same format for links in the views that you do in the controller. The different methods are even named
|
24
|
+
# synchronously, so link_to uses that same url as is generated by url_for, which again is the same url used for
|
25
|
+
# redirection in redirect_to.
|
26
|
+
module UrlHelper
|
27
|
+
def link_to_asf(active_record, column)
|
28
|
+
if column.reference_to
|
29
|
+
link_to(column.reference_to, { :action => 'show', :controller => column.reference_to.pluralize, :id => active_record.send(column.name) } )
|
30
|
+
else
|
31
|
+
active_record.send(column.name)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|