restforce 1.1.0 → 1.2.0
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.
Potentially problematic release.
This version of restforce might be problematic. Click here for more details.
- data/README.md +13 -0
- data/lib/restforce/client.rb +3 -1
- data/lib/restforce/client/connection.rb +3 -1
- data/lib/restforce/config.rb +6 -0
- data/lib/restforce/version.rb +1 -1
- data/spec/lib/config_spec.rb +7 -2
- metadata +4 -4
data/README.md
CHANGED
@@ -96,6 +96,19 @@ export SALESFORCE_CLIENT_SECRET="client secret"
|
|
96
96
|
```ruby
|
97
97
|
client = Restforce.new
|
98
98
|
```
|
99
|
+
### Proxy Support
|
100
|
+
|
101
|
+
You can specify a http proxy using the :proxy_uri option, as follows:
|
102
|
+
|
103
|
+
```ruby
|
104
|
+
client = Restforce.new :username => 'foo',
|
105
|
+
:password => 'bar',
|
106
|
+
:security_token => 'security token'
|
107
|
+
:client_id => 'client_id',
|
108
|
+
:client_secret => 'client_secret',
|
109
|
+
:proxy_uri => 'http://proxy.example.com:123'
|
110
|
+
```
|
111
|
+
This paramter also will accept 'http://user@password:proxy.example.com:123' or using the environemnt variable PROXY_URI.
|
99
112
|
|
100
113
|
#### Sandbox Orgs
|
101
114
|
|
data/lib/restforce/client.rb
CHANGED
@@ -18,7 +18,7 @@ module Restforce
|
|
18
18
|
|
19
19
|
OPTIONS = [:username, :password, :security_token, :client_id, :client_secret, :host, :compress,
|
20
20
|
:api_version, :oauth_token, :refresh_token, :instance_url, :cache, :authentication_retries,
|
21
|
-
:timeout]
|
21
|
+
:timeout, :proxy_uri]
|
22
22
|
|
23
23
|
# Public: Creates a new client instance
|
24
24
|
#
|
@@ -52,6 +52,8 @@ module Restforce
|
|
52
52
|
# :compress - Set to true to have Salesforce compress the response (default: false).
|
53
53
|
# :timeout - Faraday connection request read/open timeout. (default: nil).
|
54
54
|
#
|
55
|
+
# :proxy_uri - Proxy URI: 'http://proxy.example.com:port' or 'http://user@pass:proxy.example.com:port'
|
56
|
+
#
|
55
57
|
# Examples
|
56
58
|
#
|
57
59
|
# # Initialize a new client using password authentication:
|
@@ -57,7 +57,9 @@ module Restforce
|
|
57
57
|
def connection_options
|
58
58
|
{ :request => {
|
59
59
|
:timeout => @options[:timeout],
|
60
|
-
:open_timeout => @options[:timeout] }
|
60
|
+
:open_timeout => @options[:timeout] },
|
61
|
+
:proxy => @options[:proxy_uri]
|
62
|
+
}
|
61
63
|
end
|
62
64
|
|
63
65
|
# Internal: Returns true if the middlware stack includes the
|
data/lib/restforce/config.rb
CHANGED
@@ -72,6 +72,8 @@ module Restforce
|
|
72
72
|
# Faraday adapter to use. Defaults to Faraday.default_adapter.
|
73
73
|
attr_accessor :adapter
|
74
74
|
|
75
|
+
attr_accessor :proxy_uri
|
76
|
+
|
75
77
|
def api_version
|
76
78
|
@api_version ||= '26.0'
|
77
79
|
end
|
@@ -96,6 +98,10 @@ module Restforce
|
|
96
98
|
@client_secret ||= ENV['SALESFORCE_CLIENT_SECRET']
|
97
99
|
end
|
98
100
|
|
101
|
+
def proxy_uri
|
102
|
+
@proxy_uri ||= ENV['PROXY_URI']
|
103
|
+
end
|
104
|
+
|
99
105
|
def host
|
100
106
|
@host ||= 'login.salesforce.com'
|
101
107
|
end
|
data/lib/restforce/version.rb
CHANGED
data/spec/lib/config_spec.rb
CHANGED
@@ -24,7 +24,8 @@ describe Restforce do
|
|
24
24
|
its(:authentication_retries) { should eq 3 }
|
25
25
|
its(:adapter) { should eq Faraday.default_adapter }
|
26
26
|
[:username, :password, :security_token, :client_id, :client_secret,
|
27
|
-
:oauth_token, :refresh_token, :instance_url, :compress, :timeout
|
27
|
+
:oauth_token, :refresh_token, :instance_url, :compress, :timeout,
|
28
|
+
:proxy_uri].each do |attr|
|
28
29
|
its(attr) { should be_nil }
|
29
30
|
end
|
30
31
|
end
|
@@ -36,6 +37,7 @@ describe Restforce do
|
|
36
37
|
ENV['SALESFORCE_SECURITY_TOKEN'] = 'foobar'
|
37
38
|
ENV['SALESFORCE_CLIENT_ID'] = 'client id'
|
38
39
|
ENV['SALESFORCE_CLIENT_SECRET'] = 'client secret'
|
40
|
+
ENV['PROXY_URI'] = 'proxy'
|
39
41
|
end
|
40
42
|
|
41
43
|
after do
|
@@ -44,6 +46,7 @@ describe Restforce do
|
|
44
46
|
ENV.delete('SALESFORCE_SECURITY_TOKEN')
|
45
47
|
ENV.delete('SALESFORCE_CLIENT_ID')
|
46
48
|
ENV.delete('SALESFORCE_CLIENT_SECRET')
|
49
|
+
ENV.delete('PROXY_URI')
|
47
50
|
end
|
48
51
|
|
49
52
|
its(:username) { should eq 'foo' }
|
@@ -51,12 +54,14 @@ describe Restforce do
|
|
51
54
|
its(:security_token) { should eq 'foobar' }
|
52
55
|
its(:client_id) { should eq 'client id' }
|
53
56
|
its(:client_secret) { should eq 'client secret' }
|
57
|
+
its(:proxy_uri) { should eq 'proxy' }
|
54
58
|
end
|
55
59
|
end
|
56
60
|
|
57
61
|
describe '#configure' do
|
58
62
|
[:username, :password, :security_token, :client_id, :client_secret, :compress, :timeout,
|
59
|
-
:oauth_token, :refresh_token, :instance_url, :api_version, :host, :authentication_retries
|
63
|
+
:oauth_token, :refresh_token, :instance_url, :api_version, :host, :authentication_retries,
|
64
|
+
:proxy_uri].each do |attr|
|
60
65
|
it "allows #{attr} to be set" do
|
61
66
|
Restforce.configure do |config|
|
62
67
|
config.send("#{attr}=", 'foobar')
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: restforce
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-03-
|
12
|
+
date: 2013-03-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: faraday
|
@@ -252,7 +252,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
252
252
|
version: '0'
|
253
253
|
segments:
|
254
254
|
- 0
|
255
|
-
hash:
|
255
|
+
hash: 1651043006991876016
|
256
256
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
257
257
|
none: false
|
258
258
|
requirements:
|
@@ -261,7 +261,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
261
261
|
version: '0'
|
262
262
|
segments:
|
263
263
|
- 0
|
264
|
-
hash:
|
264
|
+
hash: 1651043006991876016
|
265
265
|
requirements: []
|
266
266
|
rubyforge_project:
|
267
267
|
rubygems_version: 1.8.23
|