rforce 0.13 → 0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/.gitignore +2 -0
- data/.travis.yml +15 -0
- data/{History.txt → CHANGELOG.txt} +7 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +4 -0
- data/Gemfile.ci +7 -0
- data/README.rdoc +1 -3
- data/Rakefile +5 -32
- data/lib/rforce.rb +1 -1
- data/lib/rforce/version.rb +1 -1
- data/rforce.gemspec +36 -0
- metadata +31 -52
- data/.gemtest +0 -0
- data/Manifest.txt +0 -21
- data/spec/rforce_spec.rb +0 -246
- data/spec/soap-response.xml +0 -5928
- data/spec/spec.opts +0 -1
- data/spec/spec_helper.rb +0 -4
- data/tasks/timing.rake +0 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 291d2e38e8a00e2f65c8fb248790d9e78e94171b21ed1d5ec2a1602010f3c641
|
4
|
+
data.tar.gz: df51a8c4dd21ea812874f3a0389bc65f5f2187419d41658167aea8da66f95f47
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 24d3d40f9bc2f3a13f07976b1b759e9eeeda20f1d29b2b040bdd431317bbb360d05d17c1209e9c3a028b2e9c3e801a9419047a23ac204f9dc160c0f1ca2d2ae8
|
7
|
+
data.tar.gz: 707e19adf5058ac34d3978dfe8891a8172e6c29b395e73eab0d77f7ed751a976363d26ba26df3a529c5d313baa4acc1432f1ea7ab0d34739626d5c72b0d24ccb
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at erin.dees@stitchfix.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/Gemfile.ci
ADDED
data/README.rdoc
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
= rforce
|
2
2
|
|
3
3
|
* http://github.com/undees/rforce
|
4
|
-
* http://bitbucket.org/undees/rforce
|
5
|
-
* http://rdoc.info/github/undees/rforce
|
6
4
|
|
7
5
|
== DESCRIPTION:
|
8
6
|
|
@@ -74,7 +72,7 @@ Rather than enforcing adherence to the sforce.com schema, RForce assumes you are
|
|
74
72
|
|
75
73
|
== LICENSE:
|
76
74
|
|
77
|
-
Copyright (c) 2005-
|
75
|
+
Copyright (c) 2005-2019 Erin Dees and contributors
|
78
76
|
|
79
77
|
Permission is hereby granted, free of charge, to any person obtaining
|
80
78
|
a copy of this software and associated documentation files (the
|
data/Rakefile
CHANGED
@@ -1,35 +1,8 @@
|
|
1
|
-
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
require "rspec/core/rake_task"
|
2
3
|
|
3
|
-
|
4
|
+
RSpec::Core::RakeTask.new(:spec)
|
4
5
|
|
5
|
-
|
6
|
-
require 'hoe/gemspec2'
|
6
|
+
task :default => :spec
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
Hoe.spec 'rforce' do
|
11
|
-
is_jruby = (RUBY_PLATFORM == 'java')
|
12
|
-
is_ruby18 = (RUBY_VERSION =~ /^1.8/)
|
13
|
-
|
14
|
-
developer('Ian Dees', 'undees@gmail.com')
|
15
|
-
license('MIT')
|
16
|
-
|
17
|
-
self.extra_deps << ['builder', '~> 3.0']
|
18
|
-
self.extra_deps << ['oauth', '~> 0.4']
|
19
|
-
|
20
|
-
self.extra_dev_deps << ['rspec', '~> 2.8']
|
21
|
-
self.extra_dev_deps << ['hoe-gemspec2', '~> 1.1']
|
22
|
-
self.extra_dev_deps << ['nokogiri', '~> 1.5'] unless is_ruby18
|
23
|
-
self.extra_dev_deps << ['xmlparser', '~> 0.7'] unless is_jruby
|
24
|
-
|
25
|
-
self.rdoc_locations = ['undees@rforce.rubyforge.org:/var/www/gforge-projects/rforce']
|
26
|
-
self.remote_rdoc_dir = ''
|
27
|
-
|
28
|
-
self.rspec_options = ['-rubygems', '--options', 'spec/spec.opts']
|
29
|
-
end
|
30
|
-
|
31
|
-
task :test => :spec
|
32
|
-
|
33
|
-
Dir['tasks/**/*.rake'].each { |rake| load rake }
|
34
|
-
|
35
|
-
# vim: syntax=Ruby
|
8
|
+
Dir['lib/tasks/**/*.rake'].each { |rake| load rake }
|
data/lib/rforce.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
=begin
|
2
|
-
Copyright (c) 2005-
|
2
|
+
Copyright (c) 2005-2019 Erin Dees and contributors
|
3
3
|
|
4
4
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
5
|
of this software and associated documentation files (the "Software"), to deal
|
data/lib/rforce/version.rb
CHANGED
data/rforce.gemspec
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
lib = File.expand_path("lib", __dir__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require "rforce/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "rforce"
|
7
|
+
spec.version = RForce::VERSION
|
8
|
+
spec.authors = ["Erin Dees"]
|
9
|
+
spec.email = ["undees@gmail.com"]
|
10
|
+
|
11
|
+
spec.summary = %q{A simple, usable binding to the Salesforce API.}
|
12
|
+
spec.homepage = "https://github.com/undees/rforce"
|
13
|
+
spec.license = "MIT"
|
14
|
+
|
15
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
16
|
+
spec.metadata["source_code_uri"] = "https://github.com/undees/rforce"
|
17
|
+
spec.metadata["changelog_uri"] = "https://github.com/undees/rforce/"
|
18
|
+
|
19
|
+
# Specify which files should be added to the gem when it is released.
|
20
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
21
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
22
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features|lib/tasks)/}) }
|
23
|
+
end
|
24
|
+
spec.require_paths = ["lib"]
|
25
|
+
|
26
|
+
spec.add_runtime_dependency "builder", "~> 3.0"
|
27
|
+
spec.add_runtime_dependency "oauth", "~> 0.4"
|
28
|
+
|
29
|
+
spec.add_development_dependency "bundler", "~> 2.0"
|
30
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
31
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
32
|
+
|
33
|
+
# Optional XML parsing engines
|
34
|
+
spec.add_development_dependency "nokogiri", "~> 1.10.4"
|
35
|
+
spec.add_development_dependency("xmlparser", "~> 0.7") unless RUBY_PLATFORM == 'java'
|
36
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rforce
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.14'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- Erin Dees
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-08-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: builder
|
@@ -39,61 +39,61 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0.4'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '2.0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '2.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '10.0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '10.0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: rspec
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
75
|
+
version: '3.0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
82
|
+
version: '3.0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: nokogiri
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
89
|
+
version: 1.10.4
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
96
|
+
version: 1.10.4
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: xmlparser
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -108,36 +108,19 @@ dependencies:
|
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0.7'
|
111
|
-
|
112
|
-
name: hoe
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - "~>"
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: '3.12'
|
118
|
-
type: :development
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - "~>"
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: '3.12'
|
125
|
-
description: |-
|
126
|
-
RForce is a simple, usable binding to the Salesforce API.
|
127
|
-
|
128
|
-
{<img src="https://travis-ci.org/undees/rforce.png" />}[https://travis-ci.org/undees/rforce]
|
111
|
+
description:
|
129
112
|
email:
|
130
113
|
- undees@gmail.com
|
131
114
|
executables: []
|
132
115
|
extensions: []
|
133
|
-
extra_rdoc_files:
|
134
|
-
- History.txt
|
135
|
-
- Manifest.txt
|
136
|
-
- README.rdoc
|
116
|
+
extra_rdoc_files: []
|
137
117
|
files:
|
138
|
-
- ".
|
139
|
-
-
|
140
|
-
-
|
118
|
+
- ".gitignore"
|
119
|
+
- ".travis.yml"
|
120
|
+
- CHANGELOG.txt
|
121
|
+
- CODE_OF_CONDUCT.md
|
122
|
+
- Gemfile
|
123
|
+
- Gemfile.ci
|
141
124
|
- README.rdoc
|
142
125
|
- Rakefile
|
143
126
|
- examples/oauth_setup.rb
|
@@ -152,19 +135,16 @@ files:
|
|
152
135
|
- lib/rforce/soap_response_nokogiri.rb
|
153
136
|
- lib/rforce/soap_response_rexml.rb
|
154
137
|
- lib/rforce/version.rb
|
155
|
-
-
|
156
|
-
|
157
|
-
- spec/spec.opts
|
158
|
-
- spec/spec_helper.rb
|
159
|
-
- tasks/timing.rake
|
160
|
-
homepage: http://github.com/undees/rforce
|
138
|
+
- rforce.gemspec
|
139
|
+
homepage: https://github.com/undees/rforce
|
161
140
|
licenses:
|
162
141
|
- MIT
|
163
|
-
metadata:
|
142
|
+
metadata:
|
143
|
+
homepage_uri: https://github.com/undees/rforce
|
144
|
+
source_code_uri: https://github.com/undees/rforce
|
145
|
+
changelog_uri: https://github.com/undees/rforce/
|
164
146
|
post_install_message:
|
165
|
-
rdoc_options:
|
166
|
-
- "--main"
|
167
|
-
- README.rdoc
|
147
|
+
rdoc_options: []
|
168
148
|
require_paths:
|
169
149
|
- lib
|
170
150
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -178,9 +158,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
178
158
|
- !ruby/object:Gem::Version
|
179
159
|
version: '0'
|
180
160
|
requirements: []
|
181
|
-
|
182
|
-
rubygems_version: 2.4.5
|
161
|
+
rubygems_version: 3.0.3
|
183
162
|
signing_key:
|
184
163
|
specification_version: 4
|
185
|
-
summary:
|
164
|
+
summary: A simple, usable binding to the Salesforce API.
|
186
165
|
test_files: []
|
data/.gemtest
DELETED
File without changes
|
data/Manifest.txt
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
History.txt
|
2
|
-
Manifest.txt
|
3
|
-
README.rdoc
|
4
|
-
Rakefile
|
5
|
-
examples/oauth_setup.rb
|
6
|
-
examples/oauth_use.rb
|
7
|
-
examples/simple.rb
|
8
|
-
lib/rforce.rb
|
9
|
-
lib/rforce/binding.rb
|
10
|
-
lib/rforce/method_keys.rb
|
11
|
-
lib/rforce/soap_pullable.rb
|
12
|
-
lib/rforce/soap_response.rb
|
13
|
-
lib/rforce/soap_response_expat.rb
|
14
|
-
lib/rforce/soap_response_nokogiri.rb
|
15
|
-
lib/rforce/soap_response_rexml.rb
|
16
|
-
lib/rforce/version.rb
|
17
|
-
spec/rforce_spec.rb
|
18
|
-
spec/soap-response.xml
|
19
|
-
spec/spec.opts
|
20
|
-
spec/spec_helper.rb
|
21
|
-
tasks/timing.rake
|
data/spec/rforce_spec.rb
DELETED
@@ -1,246 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe MethodKeys do
|
4
|
-
it 'lets you access hash keys with methods' do
|
5
|
-
h = {:foo => :bar}
|
6
|
-
class << h; include MethodKeys; end
|
7
|
-
|
8
|
-
h.foo.should == :bar
|
9
|
-
h.nonexistent.should be_nil
|
10
|
-
|
11
|
-
[:foo, :nonexistent].each do |method|
|
12
|
-
h.respond_to?(method).should be true
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
it 'provides a Hash-like class' do
|
17
|
-
mh = MethodHash.new
|
18
|
-
mh[:one] = 1
|
19
|
-
mh[:ten] = 10
|
20
|
-
|
21
|
-
mh.one.should == 1
|
22
|
-
mh.ten.should == 10
|
23
|
-
mh.nothing.should be_nil
|
24
|
-
|
25
|
-
[:one, :ten, :nothing].each do |method|
|
26
|
-
mh.respond_to?(method).should be true
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
describe 'expand' do
|
32
|
-
it 'turns Ruby into XML' do
|
33
|
-
xmlns = 'urn:partner.soap.sforce.com'
|
34
|
-
|
35
|
-
expanded = ''
|
36
|
-
builder = Builder::XmlMarkup.new(:target => expanded)
|
37
|
-
|
38
|
-
data =
|
39
|
-
['partner:create',
|
40
|
-
['partner:sObjects',
|
41
|
-
['spartner:type', 'Contact',
|
42
|
-
'AccountId', '01234567890ABCD',
|
43
|
-
'FirstName', 'Jane',
|
44
|
-
'LastName', 'Doe'],
|
45
|
-
'partner:sObjects',
|
46
|
-
['spartner:type', 'Account',
|
47
|
-
'Name', 'Acme Rockets, Inc.']]]
|
48
|
-
|
49
|
-
expand(builder, data)
|
50
|
-
|
51
|
-
expanded.should == CreateXml
|
52
|
-
end
|
53
|
-
|
54
|
-
it 'handles duplicate objects without complaint' do
|
55
|
-
expanded = ''
|
56
|
-
builder = Builder::XmlMarkup.new(:target => expanded)
|
57
|
-
account = [:type, 'Account', :name, 'ALPHA']
|
58
|
-
args = {:create=> [:sObjects, account, :sObjects, account]}
|
59
|
-
urn = 'urn:partner.soap.sforce.com'
|
60
|
-
|
61
|
-
# should not raise
|
62
|
-
expand builder, args, urn
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
describe 'a SoapResponse implementation' do
|
67
|
-
before :all do
|
68
|
-
fname = File.join(File.dirname(__FILE__), 'soap-response.xml')
|
69
|
-
@contents = File.open(fname) {|f| f.read}
|
70
|
-
|
71
|
-
[:rexml, :expat, :nokogiri].each do |processor|
|
72
|
-
name = "SoapResponse#{processor.to_s.capitalize}".to_sym
|
73
|
-
variable = "@#{processor}_recs".to_sym
|
74
|
-
|
75
|
-
results = begin
|
76
|
-
klass = RForce.const_get name
|
77
|
-
klass.new(@contents).parse.queryResponse[:result][:records]
|
78
|
-
rescue NameError
|
79
|
-
nil
|
80
|
-
end
|
81
|
-
|
82
|
-
instance_variable_set(variable, results)
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
it 'turns XML into objects' do
|
87
|
-
@rexml_recs.size.should == 58
|
88
|
-
@rexml_recs.first.keys.size.should == 99
|
89
|
-
end
|
90
|
-
|
91
|
-
# Special-case expat tests for CI
|
92
|
-
it 'returns the same results with expat' do
|
93
|
-
skip 'expat not installed' unless @expat_recs
|
94
|
-
@expat_recs.should == @rexml_recs
|
95
|
-
end
|
96
|
-
|
97
|
-
it 'understands XML entities' do
|
98
|
-
expected = "Bee's knees"
|
99
|
-
@rexml_recs.first.Description.should == expected
|
100
|
-
|
101
|
-
# Special-case expat tests for CI
|
102
|
-
if @expat_recs
|
103
|
-
@expat_recs.first.Description.should == expected
|
104
|
-
end
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
SOAP_WRAPPER = <<-XML
|
109
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
110
|
-
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="urn:partner.soap.sforce.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:sf="urn:sobject.partner.soap.sforce.com">
|
111
|
-
<soapenv:Body>
|
112
|
-
%s
|
113
|
-
</soapenv:Body>
|
114
|
-
</soapenv:Envelope>
|
115
|
-
XML
|
116
|
-
|
117
|
-
shared_examples_for 'a SOAP response' do
|
118
|
-
def wrap_in_salesforce_envelope(xml)
|
119
|
-
SOAP_WRAPPER % xml
|
120
|
-
end
|
121
|
-
|
122
|
-
it 'parses nested elements into nested hashes' do
|
123
|
-
xml = wrap_in_salesforce_envelope("""
|
124
|
-
<foo>
|
125
|
-
<bar>Bin</bar>
|
126
|
-
</foo>""")
|
127
|
-
|
128
|
-
klass.new(xml).parse.should == {:foo => {:bar => "Bin"}}
|
129
|
-
end
|
130
|
-
|
131
|
-
it 'parses repeated elements into arrays' do
|
132
|
-
xml = wrap_in_salesforce_envelope("""
|
133
|
-
<foo>
|
134
|
-
<bar>Bin</bar>
|
135
|
-
<bar>Bash</bar>
|
136
|
-
</foo>""")
|
137
|
-
|
138
|
-
klass.new(xml).parse.should == {:foo => {:bar => ["Bin", "Bash"]}}
|
139
|
-
end
|
140
|
-
|
141
|
-
it 'parses records with single record as an array' do
|
142
|
-
xml = wrap_in_salesforce_envelope("""
|
143
|
-
<records>
|
144
|
-
<sf:type>Contact</sf:type>
|
145
|
-
</records>""")
|
146
|
-
|
147
|
-
klass.new(xml).parse.should == {:records => [{:type => "Contact"}]}
|
148
|
-
end
|
149
|
-
|
150
|
-
it 'parses records with multiple records as an array' do
|
151
|
-
xml = wrap_in_salesforce_envelope("""
|
152
|
-
<records>
|
153
|
-
<sf:type>Contact</sf:type>
|
154
|
-
</records>
|
155
|
-
<records>
|
156
|
-
<sf:type>Contact</sf:type>
|
157
|
-
</records>""")
|
158
|
-
|
159
|
-
klass.new(xml).parse.should == {:records => [{:type => "Contact"}, {:type => "Contact"}]}
|
160
|
-
end
|
161
|
-
|
162
|
-
it 'parses Id array as single string' do
|
163
|
-
xml = wrap_in_salesforce_envelope("""
|
164
|
-
<foo>
|
165
|
-
<sf:Id>some_id</sf:Id>
|
166
|
-
<sf:Id>some_id</sf:Id>
|
167
|
-
</foo>""")
|
168
|
-
|
169
|
-
klass.new(xml).parse.should == {:foo => {:Id => "some_id"}}
|
170
|
-
end
|
171
|
-
|
172
|
-
it 'parses booleans' do
|
173
|
-
xml = wrap_in_salesforce_envelope("""
|
174
|
-
<foo>
|
175
|
-
<size>20</size>
|
176
|
-
<done>true</done>
|
177
|
-
<more>false</more>
|
178
|
-
<string>normal string</string>
|
179
|
-
</foo>""")
|
180
|
-
|
181
|
-
klass.new(xml).parse.should == {:foo => {:size => "20", :done => true, :more => false, :string => "normal string"}}
|
182
|
-
end
|
183
|
-
|
184
|
-
it 'disregards namespacing when determining hash keys' do
|
185
|
-
xml = wrap_in_salesforce_envelope("""
|
186
|
-
<soapenv:foo>
|
187
|
-
<bar>Bin</bar>
|
188
|
-
<soapenv:bar>Bash</soapenv:bar>
|
189
|
-
</soapenv:foo>""")
|
190
|
-
|
191
|
-
klass.new(xml).parse.should == {:foo => {:bar => ["Bin", "Bash"]}}
|
192
|
-
end
|
193
|
-
|
194
|
-
it 'unescapes any HTML contained in text nodes' do
|
195
|
-
xml = wrap_in_salesforce_envelope("""
|
196
|
-
<foo>
|
197
|
-
<bar>Bin</bar>
|
198
|
-
<bar><tag attr="Bee's knees & toes"></bar>
|
199
|
-
</foo>""")
|
200
|
-
|
201
|
-
klass.new(xml).parse()[:foo][:bar].last.should == %q(<tag attr="Bee's knees & toes">)
|
202
|
-
end
|
203
|
-
|
204
|
-
it 'returns an object that can be navigated via methods in addition to keys' do
|
205
|
-
xml = wrap_in_salesforce_envelope("<foo><bar><bin>bash</bin></bar></foo>")
|
206
|
-
klass.new(xml).parse().foo.bar.bin.should == "bash"
|
207
|
-
end
|
208
|
-
end
|
209
|
-
|
210
|
-
if RForce.const_defined? :SoapResponseNokogiri
|
211
|
-
describe 'SoapResponseNokogiri' do
|
212
|
-
it_behaves_like 'a SOAP response' do
|
213
|
-
let(:klass) { SoapResponseNokogiri }
|
214
|
-
end
|
215
|
-
end
|
216
|
-
end
|
217
|
-
|
218
|
-
# Special-case expat tests for CI
|
219
|
-
if RForce.const_defined? :SoapResponseExpat
|
220
|
-
describe 'SoapResponseExpat' do
|
221
|
-
it_behaves_like 'a SOAP response' do
|
222
|
-
let(:klass) { SoapResponseExpat }
|
223
|
-
end
|
224
|
-
end
|
225
|
-
end
|
226
|
-
|
227
|
-
describe 'SoapResponseRexml' do
|
228
|
-
it_behaves_like 'a SOAP response' do
|
229
|
-
let(:klass) { SoapResponseRexml }
|
230
|
-
end
|
231
|
-
end
|
232
|
-
|
233
|
-
CreateXml = <<HERE.gsub(/\n\s*/, '')
|
234
|
-
<partner:create>
|
235
|
-
<partner:sObjects>
|
236
|
-
<spartner:type>Contact</spartner:type>
|
237
|
-
<AccountId>01234567890ABCD</AccountId>
|
238
|
-
<FirstName>Jane</FirstName>
|
239
|
-
<LastName>Doe</LastName>
|
240
|
-
</partner:sObjects>
|
241
|
-
<partner:sObjects>
|
242
|
-
<spartner:type>Account</spartner:type>
|
243
|
-
<Name>Acme Rockets, Inc.</Name>
|
244
|
-
</partner:sObjects>
|
245
|
-
</partner:create>
|
246
|
-
HERE
|