rforce 0.6 → 0.7
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.
- data/History.txt +10 -0
- data/README.txt +28 -5
- data/Rakefile +6 -4
- data/lib/rforce.rb +1 -1
- data/lib/rforce/binding.rb +7 -4
- data/lib/rforce/version.rb +1 -1
- data/spec/rforce_spec.rb +3 -3
- metadata +28 -13
data/History.txt
CHANGED
data/README.txt
CHANGED
@@ -7,20 +7,41 @@
|
|
7
7
|
|
8
8
|
== DESCRIPTION:
|
9
9
|
|
10
|
-
RForce is a simple, usable binding to the
|
10
|
+
RForce is a simple, usable binding to the Salesforce API.
|
11
11
|
|
12
|
-
== FEATURES
|
12
|
+
== FEATURES:
|
13
13
|
|
14
14
|
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.
|
15
15
|
|
16
16
|
== SYNOPSIS:
|
17
17
|
|
18
|
+
=== Logging in with a user name and password
|
19
|
+
|
18
20
|
binding = RForce::Binding.new \
|
19
21
|
'https://www.salesforce.com/services/Soap/u/10.0'
|
20
22
|
|
21
23
|
binding.login \
|
22
24
|
'email', 'password_with_token'
|
23
25
|
|
26
|
+
=== Logging in with OAuth
|
27
|
+
|
28
|
+
oauth = {
|
29
|
+
:consumer_key => '...', # Tokens obtained from Salesforce
|
30
|
+
:consumer_secret => '...',
|
31
|
+
:access_token => '...',
|
32
|
+
:access_secret => '...',
|
33
|
+
:login_url => 'https://login.salesforce.com/services/OAuth/u/20.0'
|
34
|
+
}
|
35
|
+
|
36
|
+
binding = RForce::Binding.new \
|
37
|
+
'https://www.salesforce.com/services/Soap/u/20.0',
|
38
|
+
nil,
|
39
|
+
oauth
|
40
|
+
|
41
|
+
binding.login_with_oauth
|
42
|
+
|
43
|
+
=== Finding a record
|
44
|
+
|
24
45
|
answer = binding.search \
|
25
46
|
:searchString =>
|
26
47
|
'find {McFakerson Co} in name fields returning account(id)'
|
@@ -31,6 +52,8 @@ Rather than enforcing adherence to the sforce.com schema, RForce assumes you are
|
|
31
52
|
account_id = account.Id
|
32
53
|
account_id = account_id.first if account_id.is_a? Array
|
33
54
|
|
55
|
+
=== Creating a record
|
56
|
+
|
34
57
|
opportunity = [
|
35
58
|
:type, 'Opportunity',
|
36
59
|
:accountId, account_id,
|
@@ -44,8 +67,8 @@ Rather than enforcing adherence to the sforce.com schema, RForce assumes you are
|
|
44
67
|
|
45
68
|
== REQUIREMENTS:
|
46
69
|
|
47
|
-
*
|
48
|
-
* A
|
70
|
+
* +builder+ and +oauth+ gems
|
71
|
+
* A Salesforce Enterprise or Developer account
|
49
72
|
|
50
73
|
== INSTALL:
|
51
74
|
|
@@ -53,7 +76,7 @@ Rather than enforcing adherence to the sforce.com schema, RForce assumes you are
|
|
53
76
|
|
54
77
|
== LICENSE:
|
55
78
|
|
56
|
-
Copyright (c) 2005-
|
79
|
+
Copyright (c) 2005-2011 Ian Dees and contributors
|
57
80
|
|
58
81
|
Permission is hereby granted, free of charge, to any person obtaining
|
59
82
|
a copy of this software and associated documentation files (the
|
data/Rakefile
CHANGED
@@ -3,18 +3,20 @@
|
|
3
3
|
$:.unshift './lib'
|
4
4
|
|
5
5
|
require 'rubygems'
|
6
|
-
gem 'hoe', '
|
6
|
+
gem 'hoe', '~> 2.8'
|
7
7
|
require 'hoe'
|
8
|
+
require 'hoe/gemspec2'
|
8
9
|
|
9
|
-
Hoe.plugin :
|
10
|
+
Hoe.plugin :gemspec2
|
10
11
|
|
11
12
|
Hoe.spec 'rforce' do
|
12
13
|
developer('Ian Dees', 'undees@gmail.com')
|
13
|
-
|
14
|
-
self.extra_deps << ['builder', '~>
|
14
|
+
|
15
|
+
self.extra_deps << ['builder', '~> 3.0']
|
15
16
|
self.extra_deps << ['oauth', '~> 0.4']
|
16
17
|
|
17
18
|
self.extra_dev_deps << ['rspec', '~> 1.3']
|
19
|
+
self.extra_dev_deps << ['hoe-gemspec2', '~> 1.1']
|
18
20
|
|
19
21
|
self.rdoc_locations = ['undees@rforce.rubyforge.org:/var/www/gforge-projects/rforce']
|
20
22
|
self.remote_rdoc_dir = ''
|
data/lib/rforce.rb
CHANGED
@@ -20,7 +20,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
20
|
SOFTWARE.
|
21
21
|
=end
|
22
22
|
|
23
|
-
# RForce is a simple Ruby binding to the
|
23
|
+
# RForce is a simple Ruby binding to the Salesforce CRM system.
|
24
24
|
# Rather than enforcing adherence to the sforce.com schema,
|
25
25
|
# RForce assumes you are familiar with the API. Ruby method names
|
26
26
|
# become SOAP method names. Nested Ruby hashes become nested
|
data/lib/rforce/binding.rb
CHANGED
@@ -7,7 +7,7 @@ require 'builder'
|
|
7
7
|
require 'oauth'
|
8
8
|
|
9
9
|
module RForce
|
10
|
-
# Implements the connection to the
|
10
|
+
# Implements the connection to the Salesforce server.
|
11
11
|
class Binding
|
12
12
|
include RForce
|
13
13
|
|
@@ -94,7 +94,7 @@ module RForce
|
|
94
94
|
|
95
95
|
|
96
96
|
# Log in to the server with a user name and password, remembering
|
97
|
-
# the session ID returned to us by
|
97
|
+
# the session ID returned to us by Salesforce.
|
98
98
|
def login(user, password)
|
99
99
|
@user = user
|
100
100
|
@password = password
|
@@ -112,9 +112,12 @@ module RForce
|
|
112
112
|
end
|
113
113
|
|
114
114
|
# Log in to the server with OAuth, remembering
|
115
|
-
# the session ID returned to us by
|
115
|
+
# the session ID returned to us by Salesforce.
|
116
116
|
def login_with_oauth
|
117
|
-
result = @server.post
|
117
|
+
result = @server.post \
|
118
|
+
@oauth[:login_url],
|
119
|
+
'',
|
120
|
+
{'content-type' => 'application/x-www-form-urlencoded'}
|
118
121
|
|
119
122
|
case result
|
120
123
|
when Net::HTTPSuccess
|
data/lib/rforce/version.rb
CHANGED
data/spec/rforce_spec.rb
CHANGED
@@ -8,7 +8,7 @@ describe MethodKeys do
|
|
8
8
|
h.foo.should == :bar
|
9
9
|
h.nonexistent.should be_nil
|
10
10
|
end
|
11
|
-
|
11
|
+
|
12
12
|
it 'provides a Hash-like class' do
|
13
13
|
mh = MethodHash.new
|
14
14
|
mh[:one] = 1
|
@@ -127,7 +127,7 @@ XML
|
|
127
127
|
<foo>
|
128
128
|
<bar>Bin</bar>
|
129
129
|
</foo>""")
|
130
|
-
|
130
|
+
|
131
131
|
SoapResponseNokogiri.new(xml).parse.should == {:foo => {:bar => "Bin"}}
|
132
132
|
end
|
133
133
|
|
@@ -148,7 +148,7 @@ XML
|
|
148
148
|
<soapenv:bar>Bash</bar>
|
149
149
|
</foo>""")
|
150
150
|
|
151
|
-
SoapResponseNokogiri.new(xml).parse.should == {:foo => {:bar => ["Bin", "Bash"]}}
|
151
|
+
SoapResponseNokogiri.new(xml).parse.should == {:foo => {:bar => ["Bin", "Bash"]}}
|
152
152
|
end
|
153
153
|
|
154
154
|
it 'unescapes any HTML contained in text nodes' do
|
metadata
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rforce
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 5
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: "0.
|
8
|
+
- 7
|
9
|
+
version: "0.7"
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Ian Dees
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-
|
17
|
+
date: 2011-02-05 00:00:00 -08:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -25,11 +25,11 @@ dependencies:
|
|
25
25
|
requirements:
|
26
26
|
- - ~>
|
27
27
|
- !ruby/object:Gem::Version
|
28
|
-
hash:
|
28
|
+
hash: 7
|
29
29
|
segments:
|
30
|
-
-
|
30
|
+
- 3
|
31
31
|
- 0
|
32
|
-
version: "
|
32
|
+
version: "3.0"
|
33
33
|
type: :runtime
|
34
34
|
version_requirements: *id001
|
35
35
|
- !ruby/object:Gem::Dependency
|
@@ -63,9 +63,24 @@ dependencies:
|
|
63
63
|
type: :development
|
64
64
|
version_requirements: *id003
|
65
65
|
- !ruby/object:Gem::Dependency
|
66
|
-
name: hoe
|
66
|
+
name: hoe-gemspec2
|
67
67
|
prerelease: false
|
68
68
|
requirement: &id004 !ruby/object:Gem::Requirement
|
69
|
+
none: false
|
70
|
+
requirements:
|
71
|
+
- - ~>
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
hash: 13
|
74
|
+
segments:
|
75
|
+
- 1
|
76
|
+
- 1
|
77
|
+
version: "1.1"
|
78
|
+
type: :development
|
79
|
+
version_requirements: *id004
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
name: hoe
|
82
|
+
prerelease: false
|
83
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
69
84
|
none: false
|
70
85
|
requirements:
|
71
86
|
- - ">="
|
@@ -77,8 +92,8 @@ dependencies:
|
|
77
92
|
- 0
|
78
93
|
version: 2.8.0
|
79
94
|
type: :development
|
80
|
-
version_requirements: *
|
81
|
-
description: RForce is a simple, usable binding to the
|
95
|
+
version_requirements: *id005
|
96
|
+
description: RForce is a simple, usable binding to the Salesforce API.
|
82
97
|
email:
|
83
98
|
- undees@gmail.com
|
84
99
|
executables: []
|
@@ -140,9 +155,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
140
155
|
requirements: []
|
141
156
|
|
142
157
|
rubyforge_project: rforce
|
143
|
-
rubygems_version: 1.
|
158
|
+
rubygems_version: 1.4.1
|
144
159
|
signing_key:
|
145
160
|
specification_version: 3
|
146
|
-
summary: RForce is a simple, usable binding to the
|
161
|
+
summary: RForce is a simple, usable binding to the Salesforce API.
|
147
162
|
test_files: []
|
148
163
|
|