aq1018-rforce 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. data/.gitignore +3 -0
  2. data/History.txt +38 -0
  3. data/LICENSE +20 -0
  4. data/README.rdoc +49 -0
  5. data/Rakefile +56 -0
  6. data/VERSION +1 -0
  7. data/aq1018-rforce.gemspec +101 -0
  8. data/bugs/issue-09d998dc3f9d6e8928598fd5d9c6627102dedd65.yaml +18 -0
  9. data/bugs/issue-1b668248120eb4fd055f0ea6b75ff807f6955936.yaml +22 -0
  10. data/bugs/issue-3ef7a7c5c7e38fb76e1f53e1b67f45559e21b104.yaml +18 -0
  11. data/bugs/issue-a7a87cb98d29943a49d1608adb68475838ad2e65.yaml +22 -0
  12. data/bugs/issue-c92d34e10038ba6b9acfd7e3dfb2b154e463baba.yaml +29 -0
  13. data/bugs/project.yaml +16 -0
  14. data/lib/rforce.rb +88 -0
  15. data/lib/rforce/binding.rb +261 -0
  16. data/lib/rforce/method_keys.rb +14 -0
  17. data/lib/rforce/soap_pullable.rb +93 -0
  18. data/lib/rforce/soap_response.rb +7 -0
  19. data/lib/rforce/soap_response_expat.rb +35 -0
  20. data/lib/rforce/soap_response_hpricot.rb +75 -0
  21. data/lib/rforce/soap_response_nokogiri.rb +64 -0
  22. data/lib/rforce/soap_response_rexml.rb +34 -0
  23. data/lib/rforce/version.rb +3 -0
  24. data/spec/rforce_spec.rb +105 -0
  25. data/spec/soap-response.xml +5928 -0
  26. data/spec/spec.opts +1 -0
  27. data/spec/spec_helper.rb +66 -0
  28. data/tasks/timing.rake +21 -0
  29. data/test/oauth_tests.rb +42 -0
  30. data/wsdl/README.html +23 -0
  31. data/wsdl/README.txt +22 -0
  32. data/wsdl/ca.pem +36 -0
  33. data/wsdl/default.rb +1627 -0
  34. data/wsdl/defaultDriver.rb +179 -0
  35. data/wsdl/orderedhash.rb +254 -0
  36. data/wsdl/partner.wsdl.xml +3104 -0
  37. data/wsdl/partner.wsdl.xml.old +1858 -0
  38. data/wsdl/sample/create.rb +37 -0
  39. data/wsdl/sample/describeGlobal.rb +28 -0
  40. data/wsdl/sample/describeSObjects.rb +34 -0
  41. data/wsdl/sample/getServerTimestamp.rb +27 -0
  42. data/wsdl/sample/query.rb +31 -0
  43. data/wsdl/sample/queryMore.rb +32 -0
  44. data/wsdl/sample/retrieve.rb +32 -0
  45. data/wsdl/sforceDriver.rb +43 -0
  46. data/wsdl/soap/property +1 -0
  47. data/wsdl/wsdl.rb +121 -0
  48. metadata +172 -0
data/.gitignore ADDED
@@ -0,0 +1,3 @@
1
+ .DS_Store
2
+ rforce.tmproj
3
+
data/History.txt ADDED
@@ -0,0 +1,38 @@
1
+ == 0.5.1 2010-12-02
2
+
3
+ * Increased default batch size to 2000 (Salesforce's maximum)
4
+ * Using Nokogiri based SOAP response handler
5
+
6
+ == 0.4.2 2010-12-01
7
+
8
+ * Dropping dependency of facet
9
+
10
+ == 0.4.1 2010-01-21
11
+
12
+ * 1 minor enhancement:
13
+ * Fixed bug in search for XML libraries
14
+
15
+ == 0.4.0 2010-01-21
16
+
17
+ * 1 minor enhancement:
18
+ * Moved RubyGems dependencies into the gemspec where they belong
19
+
20
+ == 0.3.0 2009-04-16
21
+
22
+ * 1 minor enhancement:
23
+ * Updated for Ruby 1.9
24
+
25
+ == 0.2.1 2008-07-04
26
+
27
+ * 1 minor enhancement:
28
+ * Updated examples for SalesForce API v10
29
+
30
+ == 0.2.0 2008-07-03
31
+
32
+ * 1 major enhancement:
33
+ * Incorporated fixes from ActiveSalesforce project
34
+
35
+ == 0.1.0 2005-09-02
36
+
37
+ * 1 major enhancement:
38
+ * Initial release
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2005-2010 Ian Dees and contributors
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 NONINFRINGEMENT.
17
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
18
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
20
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,49 @@
1
+ = rforce
2
+
3
+ * http://github.com/aq1018/rforce
4
+
5
+ == DESCRIPTION:
6
+
7
+ RForce is a simple, usable binding to the SalesForce API.
8
+
9
+ == FEATURES/PROBLEMS:
10
+
11
+ Rather than enforcing adherence to the sforce.com schema, RForce assumes you are familiar with the API. Ruby method names become SOAP method names. Nested Ruby hashes become nested XML elements.
12
+
13
+ == SYNOPSIS:
14
+
15
+ binding = RForce::Binding.new \
16
+ 'https://www.salesforce.com/services/Soap/u/10.0'
17
+
18
+ binding.login \
19
+ 'email', 'password_with_token'
20
+
21
+ answer = binding.search \
22
+ :searchString =>
23
+ 'find {McFakerson Co} in name fields returning account(id)'
24
+
25
+ account = answer.searchResponse.result.searchRecords.record
26
+ account = account.first if account.is_a? Array
27
+
28
+ account_id = account.Id
29
+ account_id = account_id.first if account_id.is_a? Array
30
+
31
+ opportunity = [
32
+ :type, 'Opportunity',
33
+ :accountId, account_id,
34
+ :amount, '10.00',
35
+ :name, 'Fakey McFakerson',
36
+ :closeDate, '2008-07-04',
37
+ :stageName, 'Closed Won'
38
+ ]
39
+
40
+ binding.create :sObject => opportunity
41
+
42
+ == REQUIREMENTS:
43
+
44
+ * Builder gem
45
+ * A SalesForce Enterprise or Developer account
46
+
47
+ == INSTALL:
48
+
49
+ * sudo gem install aq1018-rforce
data/Rakefile ADDED
@@ -0,0 +1,56 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gem|
7
+ gem.name = "aq1018-rforce"
8
+ gem.summary = %Q{A simple, usable binding to the SalesForce API.}
9
+ gem.description = %Q{Rather than enforcing adherence to the sforce.com schema, RForce assumes you are familiar with the API. Ruby method names become SOAP method names. Nested Ruby hashes become nested XML elements.}
10
+ gem.email = "aq1018@gmail.com"
11
+ gem.homepage = "http://github.com/aq1018/rforce"
12
+ gem.authors = ["Ian Dees", "Logan (henriquez)", "Aaron Qian", "Moritz Heidkamp"]
13
+ gem.add_dependency "builder", ">= 2.0.0"
14
+ gem.add_dependency "nokogiri", "~> 1.4.4"
15
+ gem.add_dependency 'oauth'
16
+ gem.add_development_dependency "rspec", ">= 1.3"
17
+ # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
18
+ end
19
+ Jeweler::GemcutterTasks.new
20
+ rescue LoadError
21
+ puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
22
+ end
23
+
24
+ require 'rake/testtask'
25
+ Rake::TestTask.new(:test) do |test|
26
+ test.libs << 'lib' << 'test'
27
+ test.pattern = 'test/**/test_*.rb'
28
+ test.verbose = true
29
+ end
30
+
31
+ begin
32
+ require 'rcov/rcovtask'
33
+ Rcov::RcovTask.new do |test|
34
+ test.libs << 'test'
35
+ test.pattern = 'test/**/test_*.rb'
36
+ test.verbose = true
37
+ end
38
+ rescue LoadError
39
+ task :rcov do
40
+ abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
41
+ end
42
+ end
43
+
44
+ task :test => :check_dependencies
45
+
46
+ task :default => :test
47
+
48
+ require 'rake/rdoctask'
49
+ Rake::RDocTask.new do |rdoc|
50
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
51
+
52
+ rdoc.rdoc_dir = 'rdoc'
53
+ rdoc.title = "rforce #{version}"
54
+ rdoc.rdoc_files.include('README*')
55
+ rdoc.rdoc_files.include('lib/**/*.rb')
56
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.5.1
@@ -0,0 +1,101 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{aq1018-rforce}
8
+ s.version = "0.5.1"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Ian Dees", "Logan (henriquez)", "Aaron Qian", "Moritz Heidkamp"]
12
+ s.date = %q{2010-12-02}
13
+ s.description = %q{Rather than enforcing adherence to the sforce.com schema, RForce assumes you are familiar with the API. Ruby method names become SOAP method names. Nested Ruby hashes become nested XML elements.}
14
+ s.email = %q{aq1018@gmail.com}
15
+ s.extra_rdoc_files = [
16
+ "LICENSE",
17
+ "README.rdoc"
18
+ ]
19
+ s.files = [
20
+ ".gitignore",
21
+ "History.txt",
22
+ "LICENSE",
23
+ "README.rdoc",
24
+ "Rakefile",
25
+ "VERSION",
26
+ "aq1018-rforce.gemspec",
27
+ "bugs/issue-09d998dc3f9d6e8928598fd5d9c6627102dedd65.yaml",
28
+ "bugs/issue-1b668248120eb4fd055f0ea6b75ff807f6955936.yaml",
29
+ "bugs/issue-3ef7a7c5c7e38fb76e1f53e1b67f45559e21b104.yaml",
30
+ "bugs/issue-a7a87cb98d29943a49d1608adb68475838ad2e65.yaml",
31
+ "bugs/issue-c92d34e10038ba6b9acfd7e3dfb2b154e463baba.yaml",
32
+ "bugs/project.yaml",
33
+ "lib/rforce.rb",
34
+ "lib/rforce/binding.rb",
35
+ "lib/rforce/method_keys.rb",
36
+ "lib/rforce/soap_pullable.rb",
37
+ "lib/rforce/soap_response.rb",
38
+ "lib/rforce/soap_response_expat.rb",
39
+ "lib/rforce/soap_response_hpricot.rb",
40
+ "lib/rforce/soap_response_nokogiri.rb",
41
+ "lib/rforce/soap_response_rexml.rb",
42
+ "lib/rforce/version.rb",
43
+ "spec/rforce_spec.rb",
44
+ "spec/soap-response.xml",
45
+ "spec/spec.opts",
46
+ "spec/spec_helper.rb",
47
+ "tasks/timing.rake",
48
+ "test/oauth_tests.rb",
49
+ "wsdl/README.html",
50
+ "wsdl/README.txt",
51
+ "wsdl/ca.pem",
52
+ "wsdl/default.rb",
53
+ "wsdl/defaultDriver.rb",
54
+ "wsdl/orderedhash.rb",
55
+ "wsdl/partner.wsdl.xml",
56
+ "wsdl/partner.wsdl.xml.old",
57
+ "wsdl/sample/create.rb",
58
+ "wsdl/sample/describeGlobal.rb",
59
+ "wsdl/sample/describeSObjects.rb",
60
+ "wsdl/sample/getServerTimestamp.rb",
61
+ "wsdl/sample/query.rb",
62
+ "wsdl/sample/queryMore.rb",
63
+ "wsdl/sample/retrieve.rb",
64
+ "wsdl/sforceDriver.rb",
65
+ "wsdl/soap/property",
66
+ "wsdl/wsdl.rb"
67
+ ]
68
+ s.homepage = %q{http://github.com/aq1018/rforce}
69
+ s.rdoc_options = ["--charset=UTF-8"]
70
+ s.require_paths = ["lib"]
71
+ s.rubygems_version = %q{1.3.7}
72
+ s.summary = %q{A simple, usable binding to the SalesForce API.}
73
+ s.test_files = [
74
+ "spec/rforce_spec.rb",
75
+ "spec/spec_helper.rb",
76
+ "test/oauth_tests.rb"
77
+ ]
78
+
79
+ if s.respond_to? :specification_version then
80
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
81
+ s.specification_version = 3
82
+
83
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
84
+ s.add_runtime_dependency(%q<builder>, [">= 2.0.0"])
85
+ s.add_runtime_dependency(%q<nokogiri>, ["~> 1.4.4"])
86
+ s.add_runtime_dependency(%q<oauth>, [">= 0"])
87
+ s.add_development_dependency(%q<rspec>, [">= 1.3"])
88
+ else
89
+ s.add_dependency(%q<builder>, [">= 2.0.0"])
90
+ s.add_dependency(%q<nokogiri>, ["~> 1.4.4"])
91
+ s.add_dependency(%q<oauth>, [">= 0"])
92
+ s.add_dependency(%q<rspec>, [">= 1.3"])
93
+ end
94
+ else
95
+ s.add_dependency(%q<builder>, [">= 2.0.0"])
96
+ s.add_dependency(%q<nokogiri>, ["~> 1.4.4"])
97
+ s.add_dependency(%q<oauth>, [">= 0"])
98
+ s.add_dependency(%q<rspec>, [">= 1.3"])
99
+ end
100
+ end
101
+
@@ -0,0 +1,18 @@
1
+ --- !ditz.rubyforge.org,2008-03-06/issue
2
+ title: Investigate libxml
3
+ desc: The libxml-ruby project just released an updated gem, and it's reputed to be fast and stable. We should investigate it as an alternative parser.
4
+ type: :feature
5
+ component: rforce
6
+ release:
7
+ reporter: Luigi Montanez <luigi.montanez@gmail.com>
8
+ status: :unstarted
9
+ disposition:
10
+ creation_time: 2008-07-23 17:15:33.479204 Z
11
+ references: []
12
+
13
+ id: 09d998dc3f9d6e8928598fd5d9c6627102dedd65
14
+ log_events:
15
+ - - 2008-07-23 17:15:36.027132 Z
16
+ - Ian Dees <undees@gmail.com>
17
+ - created
18
+ - ""
@@ -0,0 +1,22 @@
1
+ --- !ditz.rubyforge.org,2008-03-06/issue
2
+ title: Ruby 1.9 compatibility
3
+ desc: Syntax, specs, and functional.
4
+ type: :task
5
+ component: rforce
6
+ release: "0.3"
7
+ reporter: Ian Dees <undees@gmail.com>
8
+ status: :closed
9
+ disposition: :fixed
10
+ creation_time: 2009-04-16 06:27:47.790789 Z
11
+ references: []
12
+
13
+ id: 1b668248120eb4fd055f0ea6b75ff807f6955936
14
+ log_events:
15
+ - - 2009-04-16 06:27:51.734012 Z
16
+ - Ian Dees <undees@gmail.com>
17
+ - created
18
+ - ""
19
+ - - 2009-04-16 19:27:46.187665 Z
20
+ - Ian Dees <undees@gmail.com>
21
+ - closed with disposition fixed
22
+ - Support REXML and Hpricot on 1.9, degrade gracefully.
@@ -0,0 +1,18 @@
1
+ --- !ditz.rubyforge.org,2008-03-06/issue
2
+ title: Do something with expand()
3
+ desc: expand() was just dumped into the RForce namespace as a minimal step in the direction of testability. There's probably a much better home for it.
4
+ type: :task
5
+ component: rforce
6
+ release:
7
+ reporter: Ian Dees <undees@gmail.com>
8
+ status: :unstarted
9
+ disposition:
10
+ creation_time: 2008-07-23 17:16:45.714702 Z
11
+ references: []
12
+
13
+ id: 3ef7a7c5c7e38fb76e1f53e1b67f45559e21b104
14
+ log_events:
15
+ - - 2008-07-23 17:16:47.083713 Z
16
+ - Ian Dees <undees@gmail.com>
17
+ - created
18
+ - ""
@@ -0,0 +1,22 @@
1
+ --- !ditz.rubyforge.org,2008-03-06/issue
2
+ title: Binding#call_remote should use parse()
3
+ desc: Search for uses of the old API (SoapResponse#new) and replace with the new API (SoapResponse#parse).
4
+ type: :bugfix
5
+ component: rforce
6
+ release: "0.3"
7
+ reporter: Ian Dees <undees@gmail.com>
8
+ status: :closed
9
+ disposition: :fixed
10
+ creation_time: 2008-07-28 05:37:21.978938 Z
11
+ references: []
12
+
13
+ id: a7a87cb98d29943a49d1608adb68475838ad2e65
14
+ log_events:
15
+ - - 2008-07-28 05:37:24.755692 Z
16
+ - Ian Dees <undees@gmail.com>
17
+ - created
18
+ - ""
19
+ - - 2008-07-28 05:39:29.817686 Z
20
+ - Ian Dees <undees@gmail.com>
21
+ - closed issue with disposition fixed
22
+ - Done.
@@ -0,0 +1,29 @@
1
+ --- !ditz.rubyforge.org,2008-03-06/issue
2
+ title: Select XML parser at runtime
3
+ desc: |-
4
+ XML parsing is done by three different classes: SoapResponse, SoapResponseHpricot, and SoapResponseExpat. The Binding class, in a holdover from the old days, is hard-coded to use SoapResponse.
5
+
6
+ At the very least, we should scan the installed libraries / gems and choose the fastest one available. We might also allow Binding's initializer to pass in a specific parser.
7
+ type: :task
8
+ component: rforce
9
+ release: "0.3"
10
+ reporter: Ian Dees <undees@gmail.com>
11
+ status: :closed
12
+ disposition: :fixed
13
+ creation_time: 2008-07-23 17:10:22.283059 Z
14
+ references: []
15
+
16
+ id: c92d34e10038ba6b9acfd7e3dfb2b154e463baba
17
+ log_events:
18
+ - - 2008-07-23 17:10:29.352269 Z
19
+ - Ian Dees <undees@gmail.com>
20
+ - created
21
+ - ""
22
+ - - 2008-07-28 05:37:48.378891 Z
23
+ - Ian Dees <undees@gmail.com>
24
+ - assigned to release 0.3 from unassigned
25
+ - ""
26
+ - - 2008-07-28 05:39:05.294916 Z
27
+ - Ian Dees <undees@gmail.com>
28
+ - closed issue with disposition fixed
29
+ - Used the simple fix of seeing which constants are defined and assigning SoapResponse based on that.
data/bugs/project.yaml ADDED
@@ -0,0 +1,16 @@
1
+ --- !ditz.rubyforge.org,2008-03-06/project
2
+ name: rforce
3
+ version: "0.3"
4
+ components:
5
+ - !ditz.rubyforge.org,2008-03-06/component
6
+ name: rforce
7
+ releases:
8
+ - !ditz.rubyforge.org,2008-03-06/release
9
+ name: "0.3"
10
+ status: :unreleased
11
+ release_time:
12
+ log_events:
13
+ - - 2008-07-28 05:35:54.153742 Z
14
+ - Ian Dees <undees@gmail.com>
15
+ - created
16
+ - Will be ready for ActiveSalesforce.
data/lib/rforce.rb ADDED
@@ -0,0 +1,88 @@
1
+ =begin
2
+ Copyright (c) 2005-2010 Ian Dees and contributors
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ of this software and associated documentation files (the "Software"), to deal
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is
9
+ furnished to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in
12
+ all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ SOFTWARE.
21
+ =end
22
+
23
+ # RForce is a simple Ruby binding to the SalesForce CRM system.
24
+ # Rather than enforcing adherence to the sforce.com schema,
25
+ # RForce assumes you are familiar with the API. Ruby method names
26
+ # become SOAP method names. Nested Ruby hashes become nested
27
+ # XML elements.
28
+ #
29
+ # Example:
30
+ #
31
+ # binding = RForce::Binding.new 'https://www.salesforce.com/services/Soap/u/10.0'
32
+ # binding.login 'username', 'password'
33
+ # answer = binding.search(
34
+ # :searchString =>
35
+ # 'find {Some Account Name} in name fields returning account(id)')
36
+ # account_id = answer.searchResponse.result.searchRecords.record.Id
37
+ #
38
+ # opportunity = {
39
+ # :accountId => account_id,
40
+ # :amount => "10.00",
41
+ # :name => "New sale",
42
+ # :closeDate => "2005-09-01",
43
+ # :stageName => "Closed Won"
44
+ # }
45
+ #
46
+ # binding.create 'sObject {"xsi:type" => "Opportunity"}' => opportunity
47
+ #
48
+
49
+ require 'rforce/binding'
50
+ require 'rforce/soap_response'
51
+
52
+
53
+ module RForce
54
+ # Expand Ruby data structures into XML.
55
+ def expand(builder, args, xmlns = nil)
56
+ # Nest arrays: [:a, 1, :b, 2] => [[:a, 1], [:b, 2]]
57
+ if (args.class == Array)
58
+ args.each_index{|i| args[i, 2] = [args[i, 2]]}
59
+ end
60
+
61
+ args.each do |key, value|
62
+ attributes = xmlns ? {:xmlns => xmlns} : {}
63
+
64
+ # If the XML tag requires attributes,
65
+ # the tag name will contain a space
66
+ # followed by a string representation
67
+ # of a hash of attributes.
68
+ #
69
+ # e.g. 'sObject {"xsi:type" => "Opportunity"}'
70
+ # becomes <sObject xsi:type="Opportunity>...</sObject>
71
+ if key.is_a? String
72
+ key, modifier = key.split(' ', 2)
73
+
74
+ attributes.merge!(eval(modifier)) if modifier
75
+ end
76
+
77
+ # Create an XML element and fill it with this
78
+ # value's sub-items.
79
+ case value
80
+ when Hash, Array then
81
+ builder.tag!(key, attributes) do expand builder, value; end
82
+
83
+ when String then
84
+ builder.tag!(key, attributes) { builder.text! value }
85
+ end
86
+ end
87
+ end
88
+ end