asf-soap-adapter 1.1.0 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE CHANGED
@@ -1,20 +1,25 @@
1
- Copyright (c) 2009 Raymond Gao
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining
4
- a copy of this software and associated documentation files (the
5
- "Software"), to deal in the Software without restriction, including
6
- without limitation the rights to use, copy, modify, merge, publish,
7
- distribute, sublicense, and/or sell copies of the Software, and to
8
- permit persons to whom the Software is furnished to do so, subject to
9
- the following conditions:
10
-
11
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
13
-
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1
+ Copyright (c) 2010, Salesforce.com
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without
5
+ modification, are permitted provided that the following conditions are met:
6
+
7
+ * Redistributions of source code must retain the above copyright notice, this
8
+ list of conditions and the following disclaimer.
9
+ * Redistributions in binary form must reproduce the above copyright notice,
10
+ this list of conditions and the following disclaimer in the documentation
11
+ and/or other materials provided with the distribution.
12
+ * Neither the name of Salesforce.com nor the names of its contributors may be
13
+ used to endorse or promote products derived from this software without
14
+ specific prior written permission.
15
+
16
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
data/Rakefile CHANGED
@@ -12,14 +12,9 @@ begin
12
12
  gem.authors = ["Doug Chasman","Luigi Montanez","Senthil Nayagam","Justin Ball","Jesse Hallett", "Andrew Freeberg", "Blaine Schanfeldt", "Matte Edens", "Raymond Gao"]
13
13
 
14
14
  # Requiring RForce as an add-on gem, rather than hard-code the 0.4.0
15
- # Using Ray Gao's version of Rforce, since the DEFAULT_BATCH_SIZE (rforce/binding.rb) has been expanded from 10 to 2000
16
- # Furthermore, added 'oath' gem as a dependency, which is needed by 'Rforce' gem
17
- #gem.add_dependency('rforce-raygao', '>=1.0')
18
- gem.add_dependency('rforce', '>=0.6')
15
+ gem.add_dependency('rforce', '>=0.4.1')
19
16
  gem.add_dependency('builder', '>= 1.2.4')
20
17
  gem.add_dependency('hpricot', '>=0.8.2')
21
- gem.add_dependency('facets', '=2.8.4')
22
- gem.add_dependency('oauth', '=0.4.4')
23
18
 
24
19
  #gem.add_dependency('rails', '>= 2.3.3')
25
20
  # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.0
1
+ 1.3.0
@@ -5,26 +5,21 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{asf-soap-adapter}
8
- s.version = "1.1.0"
8
+ s.version = "1.3.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Doug Chasman", "Luigi Montanez", "Senthil Nayagam", "Justin Ball", "Jesse Hallett", "Andrew Freeberg", "Blaine Schanfeldt", "Matte Edens", "Raymond Gao"]
12
- s.date = %q{2011-01-19}
11
+ s.authors = ["Doug Chasman", "Luigi Montanez", "Senthil Nayagam", "Justin Ball", "Jesse Hallett", "Andrew Freeberg", "Blaine Schanfeldt", "Matte Edens", "Raymond Gao", "Quinton Wall"]
12
+ s.date = %q{2010-02-04}
13
13
  s.description = %q{ASF-Soap-Adapter is an improved version of ActiveSalesforce (ASF) is a Rails connection adapter that provides direct access to Salesforce.com hosted data and metadata via the ActiveRecord model layer. Objects, fields, and relationships are all auto surfaced as active record attributes and rels. It has been patched to V20 of the Web Services API and has support Chatter model.}
14
- s.email = %q{raygao2000@yahoo.com}
14
+ s.email = %q{qwall@salesforce.com}
15
15
  s.extra_rdoc_files = [
16
16
  "LICENSE",
17
- "README.rdoc"
18
17
  ]
19
18
  s.files = [
20
- ".document",
21
- ".gitignore",
22
19
  "LICENSE",
23
- "README.rdoc",
24
20
  "Rakefile",
25
21
  "VERSION",
26
22
  "asf-soap-adapter.gemspec",
27
- "asf-soap-adapter.pptx",
28
23
  "deploy",
29
24
  "lib/active_record/connection_adapters/activesalesforce.rb",
30
25
  "lib/active_record/connection_adapters/activesalesforce_adapter.rb",
@@ -280,24 +275,18 @@ Gem::Specification.new do |s|
280
275
  s.specification_version = 3
281
276
 
282
277
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
283
- s.add_runtime_dependency(%q<rforce>, [">= 0.6"])
278
+ s.add_runtime_dependency(%q<rforcedotcom>, [">= 20.0.0"])
284
279
  s.add_runtime_dependency(%q<builder>, [">= 1.2.4"])
285
280
  s.add_runtime_dependency(%q<hpricot>, [">= 0.8.2"])
286
- s.add_runtime_dependency(%q<facets>, ["= 2.8.4"])
287
- s.add_runtime_dependency(%q<oauth>, ["= 0.4.4"])
288
281
  else
289
- s.add_dependency(%q<rforce>, [">= 0.6"])
282
+ s.add_runtime_dependency(%q<rforcedotcom>, [">= 20.0.0"])
290
283
  s.add_dependency(%q<builder>, [">= 1.2.4"])
291
284
  s.add_dependency(%q<hpricot>, [">= 0.8.2"])
292
- s.add_dependency(%q<facets>, ["= 2.8.4"])
293
- s.add_dependency(%q<oauth>, ["= 0.4.4"])
294
285
  end
295
286
  else
296
- s.add_dependency(%q<rforce>, [">= 0.6"])
287
+ s.add_runtime_dependency(%q<rforcedotcom>, [">= 20.0.0"])
297
288
  s.add_dependency(%q<builder>, [">= 1.2.4"])
298
289
  s.add_dependency(%q<hpricot>, [">= 0.8.2"])
299
- s.add_dependency(%q<facets>, ["= 2.8.4"])
300
- s.add_dependency(%q<oauth>, ["= 0.4.4"])
301
290
  end
302
291
  end
303
292
 
@@ -279,11 +279,8 @@ module ActiveRecord
279
279
  if commands.length >= MAX_BOXCAR_SIZE or (previous_command and (command.verb != previous_command.verb))
280
280
  send_commands(commands)
281
281
 
282
- #Patch from Kostyl
283
- commands = [command] # Otherwise command will be lost at all (every 200th command (MAX_BOXCAR_SIZE = 200))
284
- previous_command = command
285
- #commands = []
286
- #previous_command = nil
282
+ commands = []
283
+ previous_command = nil
287
284
  else
288
285
  commands << command
289
286
  previous_command = command
@@ -864,7 +861,7 @@ module ActiveRecord
864
861
  # See if a table name to AR class mapping was registered
865
862
  klass = @class_to_entity_map[table_name.upcase]
866
863
 
867
- entity_name = klass ? raw_table_name : table_name.camelize
864
+ entity_name = klass ? raw_table_name : (table_name =~ /__/ ? table_name : table_name.camelize)
868
865
  entity_def = get_entity_def(entity_name)
869
866
 
870
867
  [table_name, entity_def.columns, entity_def]
@@ -912,4 +909,4 @@ module ActiveRecord
912
909
  end
913
910
 
914
911
  end
915
- end
912
+ end
@@ -0,0 +1,2 @@
1
+ Use this README file to introduce your application and point to useful places in the API for learning more.
2
+ Run "rake doc:app" to generate API documentation for your models, controllers, helpers, and libraries.
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asf-soap-adapter
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
- - 1
8
+ - 3
9
9
  - 0
10
- version: 1.1.0
10
+ version: 1.3.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Doug Chasman
@@ -19,26 +19,28 @@ authors:
19
19
  - Blaine Schanfeldt
20
20
  - Matte Edens
21
21
  - Raymond Gao
22
+ - Quinton Wall
22
23
  autorequire:
23
24
  bindir: bin
24
25
  cert_chain: []
25
26
 
26
- date: 2011-01-19 00:00:00 -06:00
27
+ date: 2010-02-04 00:00:00 -08:00
27
28
  default_executable:
28
29
  dependencies:
29
30
  - !ruby/object:Gem::Dependency
30
- name: rforce
31
+ name: rforcedotcom
31
32
  prerelease: false
32
33
  requirement: &id001 !ruby/object:Gem::Requirement
33
34
  none: false
34
35
  requirements:
35
36
  - - ">="
36
37
  - !ruby/object:Gem::Version
37
- hash: 7
38
+ hash: 191
38
39
  segments:
40
+ - 20
41
+ - 0
39
42
  - 0
40
- - 6
41
- version: "0.6"
43
+ version: 20.0.0
42
44
  type: :runtime
43
45
  version_requirements: *id001
44
46
  - !ruby/object:Gem::Dependency
@@ -73,56 +75,19 @@ dependencies:
73
75
  version: 0.8.2
74
76
  type: :runtime
75
77
  version_requirements: *id003
76
- - !ruby/object:Gem::Dependency
77
- name: facets
78
- prerelease: false
79
- requirement: &id004 !ruby/object:Gem::Requirement
80
- none: false
81
- requirements:
82
- - - "="
83
- - !ruby/object:Gem::Version
84
- hash: 39
85
- segments:
86
- - 2
87
- - 8
88
- - 4
89
- version: 2.8.4
90
- type: :runtime
91
- version_requirements: *id004
92
- - !ruby/object:Gem::Dependency
93
- name: oauth
94
- prerelease: false
95
- requirement: &id005 !ruby/object:Gem::Requirement
96
- none: false
97
- requirements:
98
- - - "="
99
- - !ruby/object:Gem::Version
100
- hash: 7
101
- segments:
102
- - 0
103
- - 4
104
- - 4
105
- version: 0.4.4
106
- type: :runtime
107
- version_requirements: *id005
108
78
  description: ASF-Soap-Adapter is an improved version of ActiveSalesforce (ASF) is a Rails connection adapter that provides direct access to Salesforce.com hosted data and metadata via the ActiveRecord model layer. Objects, fields, and relationships are all auto surfaced as active record attributes and rels. It has been patched to V20 of the Web Services API and has support Chatter model.
109
- email: raygao2000@yahoo.com
79
+ email: qwall@salesforce.com
110
80
  executables: []
111
81
 
112
82
  extensions: []
113
83
 
114
84
  extra_rdoc_files:
115
85
  - LICENSE
116
- - README.rdoc
117
86
  files:
118
- - .document
119
- - .gitignore
120
87
  - LICENSE
121
- - README.rdoc
122
88
  - Rakefile
123
89
  - VERSION
124
90
  - asf-soap-adapter.gemspec
125
- - asf-soap-adapter.pptx
126
91
  - deploy
127
92
  - lib/active_record/connection_adapters/activesalesforce.rb
128
93
  - lib/active_record/connection_adapters/activesalesforce_adapter.rb
data/.document DELETED
@@ -1,5 +0,0 @@
1
- README.rdoc
2
- lib/**/*.rb
3
- bin/*
4
- features/**/*.feature
5
- LICENSE
data/.gitignore DELETED
@@ -1,25 +0,0 @@
1
- ## MAC OS
2
- .DS_Store
3
-
4
- ## TEXTMATE
5
- *.tmproj
6
- tmtags
7
-
8
- ## EMACS
9
- *~
10
- \#*
11
- .\#*
12
-
13
- ## VIM
14
- *.swp
15
-
16
- ## PROJECT::GENERAL
17
- coverage
18
- rdoc
19
- doc
20
- pkg
21
- .yardoc
22
-
23
- ## PROJECT::SPECIFIC
24
- nbproject/*
25
- recorded_results/*
@@ -1,125 +0,0 @@
1
- == Welcome to ActiveSalesforce SOAP Adapter (asf-soap-adapter)
2
-
3
- The "asf-soap-adapter" is based on the ActiveSalesforce-Adapter (link:classes/ActiveRecord/Base.html and link:classes/ActiveRecord/ConnectionAdapters/SalesforceAdapter.html). It has been updated to include new methods/APIs from the latest version of the Salesforce Web Services (SOAP-based) APIs. At the time of release, that API is at version 20.
4
- Major features:
5
- 1. Removed hardcoded version of v19, v18, etc in the code. Now, you just specify it in the 'database.yml' file with 'api_version'. By default it is at 20.0
6
- 2. Adding RForce GEM as a prerequisite. By removing embedded RForce 0.4.0 files, we can now taken advantage of RForce 0.4.1 GEM, which is cleaner and addressed several problems with Hash. One thing to note: if you are using <em>RFORCE:MethodHash</em> class. It has been been replaced by <OpenHash> class. To use it, simply call <em>OpenHash.new({})</em> in place of MethodHash. Previously, there was a bug with the MethodHash class causing Id to be put into an array, e.g. FeedPost.Id[0], even though there was only one element. So, now it is FeedPost.Id.
7
- 3. Adding several useful Salesforce convenience classes, which is under Saleforce module. You can use <em>Salesforce::Account, Salesforce::User</em>, etc. This frees you from having to create Ruby Models in your application, which can be in a pain, if you using Rails db generation tools, e.g. Hobo, which checks to see if you have a database table for that class. With these convenience classes, you are no longer required to create those tables.
8
- 4. Support for Chatter newsfeeds. Retrieving Chatter Feed has always been difficult. There are several challenges. First, you can not select directly from the <em>FeedPost</em>, <em>FeedTrackedChanges</em>, and <em>FeedComments</em> tables. That means you always needed to put that in a subquery, as: <em>SELECT Id, Type, (FeedPost.ID, FeedPost.Body, FeedPost.ContentType, et.... ), (Select Id, FieldName, OldValue, NewValue from FeedTrackedChanges), (Select Id, CommentBody, .... from FeedComments) form {feed_type}Feed where parentid='#####'</em>. Doing that over and over again can be repetitive and against the DRY (Don't Repeat Yourself) principle of Rails programming. Therefore, a convenience class has been provided from you. see <em>Salesforce::ChatterFeed</em>. See following example.
9
- chatter_feed_finder = Salesforce::ChatterFeed.new
10
- # The following two lines shows how to get the account_feed.id. You can replace it with your
11
- account_feed = Salesforce::AccountFeed.first
12
- object_id = account_feed.id
13
- feed_no_attachment = chatter_feed_finder.get_all_chatter_feeds_without_attachments(object_id, 'Account', user.connection.binding, 'test-session-id')
14
- Furthermore, the syntaxes from the methods are:
15
- chatter_feed_finder.get_all_chatter_feeds_with_attachments(object_id, object_type, binding, directory_name, limit, get_attachment)
16
- chatter_feed_finder.get_all_chatter_feeds_without_attachments(object_id, object_type, binding, directory_name, limit)
17
- chatter_feed_finder.get_single_chatter_feed_with_attachment(feedpost_id, feed_type, binding, directory_name, limit)
18
- where,
19
- object_id -> id of the feed
20
- object_type -> type of feed, e.g. AccountFeed, CampaignFeed, ContactFeed, UserFeed, ....
21
- binding -> the RForce binding used to for connecting to Salesforce Web Services Server
22
- directory_name -> where the attachment will be saved at, it is stored under the RAILS_ROOT/public/tmp/{your directory}
23
- limit -> max of number of feed retrieved which this call
24
- get_attachment -> boolean flag: yes (get attachment), no (don't get attachment)
25
- 5. Salesforce Object lookup utility, provide a Salesforce object Id, and figure out if it is an Account, User, Lead, etc. <em>Salesforce::SfUtility.determine_sf_object_type(id)</em>. See the document for other useful method in this class.
26
- 6. Ability to call non-traditional SQLs. e.g. with "LIMIT", "GROUP BY", "HAVING", and "WITH DATA CATEGORY". example:
27
- another = Salesforce::SfBase.query_by_sql("SELECT LeadSource, COUNT(Name) FROM Lead GROUP BY LeadSource")
28
- assert another.size
29
- 7. more ....
30
-
31
- zero_result = Salesforce::SfBase.query_by_sql("SELECT Name, Count(Id) FROM Account GROUP BY Name HAVING Count(Id) > 100")
32
- assert_nil zero_result
33
- 6. The best part, is this gem is backward compatible with the original ActiveSalesforce-Adapter GEM release. You only need to make minimum changes to your application to use this GEM. To use this gem, simply replace the declaration in <em>config/environment.rb</em> with <em>config.gem "asf-soap-adapter", :lib => "activerecord-activesalesforce-adapter"</em> in the <em>Rails::Initializer.run do |config|</em> section.
34
- == Significant Changes
35
- 1. Detached hardcoded RForce 0.4.0 and replaced with RForce 0.4.1 gem.
36
- 2. Dynamic Adapter version from 'database.yml' file via 'api_version' parameter
37
- 3. Conveninence classes, Salesforce::Account, User, ....
38
- 4. Chatter Feed
39
- 5. Object Lookup Utility (SF id -> SF object type)
40
- 6. Nontraditional query support
41
-
42
- == Installation
43
-
44
- 1. Add: <em>config.gem "asf-soap-adapter", :lib => "activerecord-activesalesforce-adapter"</em> to <em>Rails::Initializer.run do |config|</em> section in your <em>config/environment.rb</em> file.
45
- 2. run <em>sudo rake gems:install</em> from your rails base directory.
46
-
47
- == Getting started
48
-
49
- 1. If you have not already done so generate your initial rails app:
50
-
51
- rails myappname
52
-
53
- 2. Edit config/environment.rb and add a config.gem requirement:
54
-
55
- Rails::Initializer.run do |config|
56
- ...
57
- config.gem "asf-soap-adapter", :lib => 'asf-soap-adapter'
58
- ...
59
- end
60
-
61
- 3. Edit database.yml
62
-
63
- salesforce-default-realm:
64
- adapter: activesalesforce
65
- url: https://www.salesforce.com
66
- username: <username>
67
- password: <password + security token>
68
- api_version: 20.0
69
-
70
- NOTE: "url" is an optional parameter. If you want to access your Salesforce Sandbox account add the following line.
71
- url: https://test.salesforce.com
72
- "api_version" is also optional. If you don't specify a version, it is automatically default to 20.0.
73
-
74
- 4. Create your salesforce models using a Salesforce::<ModelName> namespace.
75
-
76
- A lot of the Salesforce Models have already been provided as convenience class. If you need to add more:
77
-
78
- script/generate model Salesforce::NewObject
79
-
80
- update the file
81
- module Salesforce
82
- # See http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_list.htm
83
- # For complete list of Salesforce Standard Objects in V20.
84
- class NewObject < SfBase
85
- set_table_name 'NewObject' # must be a valid Salesforce Table, otherwise, it will complain.
86
- end
87
- end
88
-
89
- 5. Run a quick test to make sure things are working
90
-
91
- > script/console
92
- Loading development environment (Rails 2.3.9)
93
-
94
- >> Salesforce::Contact.first
95
- => <Salesforce::Contact id: "003T000000GqvJsIAJ", ... >
96
-
97
- 6. Proceed using standard Rails development techniques!
98
-
99
- == Advanced Features
100
-
101
- 1. Session ID based Authentication: Add the following to /app/controllers/application.rb to enable SID auth for all controllers
102
-
103
- class ApplicationController < ActionController::Base
104
- before_filter ActiveSalesforce::SessionIDAuthenticationFilter
105
- end
106
-
107
- 2. Boxcar'ing of updates, inserts, and deletes. Use <YourModel>.transaction() to demark boxcar boundaries.
108
-
109
- == Description of contents
110
-
111
- lib
112
- Application specific libraries. Basically, any kind of custom code that doesn't
113
- belong under controllers, models, or helpers. This directory is in the load path.
114
- -- active_record -> asf model
115
- -- salesforce -> convenience classes and utilities
116
-
117
- test
118
- Unit and functional tests along with fixtures. See enclosed test app (asf-soap-adapter-rails-app) for full-fledge tests.
119
-
120
- == Additional Note:
121
- The enclosed test app (asf-soap-adapter-rails-app) shows how to use the framework. Go into its "test/unit" directory, where examples are provided.
122
-
123
- I am currently, updating my reference app SFRWatcher to SFRWatcher_v20 to match the switch from the old gem to this new gem. Once it is ready, it will be posted on the web soon. The project home: http://asf-soap-adapter.are4.us
124
-
125
- Copyright (c) 2010 Raymond Gao. See LICENSE for details.
Binary file