sfdc_proxy 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/sfdc_proxy.rb +35 -0
- metadata +72 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 96e0e12cc61d89f85e97052594c89c2aa1674473
|
4
|
+
data.tar.gz: deb156a19ddf7646282017ad3b7e832ba450c01b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 555c1a6e5744bd02e3387f08c99727c2b2dff251a56990ebb29d2d5bdd69da260f66e082c52188717f69911103be917f875a4619a64dd3d5eb011b483f261802
|
7
|
+
data.tar.gz: 89c2b433ba169d4214493701ecbe0a10a5fa7bcd14d3ebaf68af5f1a25b511ce8585304ca648c24d6ddea6f8b529715703c9406321b76fd858a4526652aa689a
|
data/lib/sfdc_proxy.rb
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'sinatra/base'
|
2
|
+
require 'faraday'
|
3
|
+
require 'json'
|
4
|
+
require 'open-uri'
|
5
|
+
require 'yaml'
|
6
|
+
|
7
|
+
class SalesforceProxy < Sinatra::Base
|
8
|
+
def self.proxy(url, &block)
|
9
|
+
get(url,&block)
|
10
|
+
put(url,&block)
|
11
|
+
delete(url,&block)
|
12
|
+
patch(url,&block)
|
13
|
+
post(url,&block)
|
14
|
+
end
|
15
|
+
|
16
|
+
proxy '/proxy*' do
|
17
|
+
puts request.env.to_yaml
|
18
|
+
body = request.body.read
|
19
|
+
query_string = request.query_string
|
20
|
+
sf_endpoint = request.env['HTTP_X_SALESFORCEPROXY_ENDPOINT']
|
21
|
+
auth_header = request.env['HTTP_AUTHORIZATION']
|
22
|
+
content_type = (sf_endpoint.include?('oauth2') && 'application/x-www-form-urlencoded') || 'application/json'
|
23
|
+
http_method = request.env['REQUEST_METHOD']
|
24
|
+
result = Faraday.send http_method.downcase do |req|
|
25
|
+
req.url "#{sf_endpoint}?#{query_string}"
|
26
|
+
req.headers["Authorization"] = auth_header if auth_header
|
27
|
+
req.headers['Content-Type'] = content_type if content_type
|
28
|
+
req.body = body if body
|
29
|
+
end
|
30
|
+
#puts result.inspect
|
31
|
+
result.body
|
32
|
+
end
|
33
|
+
|
34
|
+
#run! if app_file == $0
|
35
|
+
end
|
metadata
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sfdc_proxy
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Doug Friedman
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-11-25 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: faraday
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: sinatra
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: A simple http proxy to the salesforce apis for use in rack applications
|
42
|
+
email: doug@tryo.io
|
43
|
+
executables: []
|
44
|
+
extensions: []
|
45
|
+
extra_rdoc_files: []
|
46
|
+
files:
|
47
|
+
- lib/sfdc_proxy.rb
|
48
|
+
homepage: http://rubygems.org/gems/sfdc_proxy
|
49
|
+
licenses:
|
50
|
+
- MIT
|
51
|
+
metadata: {}
|
52
|
+
post_install_message:
|
53
|
+
rdoc_options: []
|
54
|
+
require_paths:
|
55
|
+
- lib
|
56
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - '>='
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0'
|
61
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
62
|
+
requirements:
|
63
|
+
- - '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
66
|
+
requirements: []
|
67
|
+
rubyforge_project:
|
68
|
+
rubygems_version: 2.0.3
|
69
|
+
signing_key:
|
70
|
+
specification_version: 4
|
71
|
+
summary: A simple http proxy to the saleforce apis for use in rack applications
|
72
|
+
test_files: []
|