sfdc_proxy 0.0.3 → 0.0.4
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 +4 -4
- data/lib/sfdc_proxy.rb +3 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d30960bc983fa82486b66c22ab213982e3fb13eb
|
|
4
|
+
data.tar.gz: a3f93c4f8424de17b5f5457f28cf652aa656a795
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fb4afc4bc444f157672e3ec4cd4a768d283af3fd83a80a76dde4ed1e6e1645ca7f16c7391df0490e30041559cde6c929931d90f55abe76982012e7134fdccb9b
|
|
7
|
+
data.tar.gz: bc20fdb04a57c221fea3dd48f3e7b1ae86223db3270926d710030c11a800504ac41bf671656d8303619c79f4713a0a61e5840bf16d07d7ec66741bab3ff85412
|
data/lib/sfdc_proxy.rb
CHANGED
|
@@ -16,13 +16,15 @@ class SalesforceProxy < Sinatra::Base
|
|
|
16
16
|
proxy '/*' do
|
|
17
17
|
#puts request.env.to_yaml
|
|
18
18
|
body = request.body.read
|
|
19
|
+
path = request.env['PATH_INFO'].gsub '/proxy', ''
|
|
19
20
|
query_string = request.query_string
|
|
20
21
|
sf_endpoint = request.env['HTTP_X_SALESFORCEPROXY_ENDPOINT'] || 'http://login.salesforce.com/services/oauth2/token'
|
|
21
22
|
auth_header = request.env['HTTP_AUTHORIZATION']
|
|
22
23
|
content_type = (sf_endpoint.include?('oauth2') && 'application/x-www-form-urlencoded') || 'application/json'
|
|
23
24
|
http_method = request.env['REQUEST_METHOD']
|
|
25
|
+
endpoint = "#{sf_endpoint}#{path}#{query_string}"
|
|
24
26
|
result = Faraday.send http_method.downcase do |req|
|
|
25
|
-
req.url
|
|
27
|
+
req.url endpoint
|
|
26
28
|
req.headers["Authorization"] = auth_header if auth_header
|
|
27
29
|
req.headers['Content-Type'] = content_type if content_type
|
|
28
30
|
req.body = body if body
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: sfdc_proxy
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Doug Friedman
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2013-11-
|
|
11
|
+
date: 2013-11-30 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: faraday
|