salesforce_flo 0.0.1 → 0.0.2
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/README.md +1 -1
- data/lib/flo/provider/salesforce_flo.rb +2 -2
- data/lib/salesforce_flo/authentication/oauth_wrapper.rb +8 -6
- data/lib/salesforce_flo/version.rb +1 -1
- data/salesforce_flo.gemspec +1 -0
- metadata +16 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f213441184760d6c7ae9ea601e3667da792b1450
|
|
4
|
+
data.tar.gz: 9bb28c5c280cb100e4afce9f7363932d2a1c3e61
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c44d4ef7181a631a9e591ebeee8ee439a0cdb5ce2d16ddf6ec68e5a888f7dda50b231c0d48b3105c7e7dd44d90a27047c0f50365611fa997d5e6651742697dad
|
|
7
|
+
data.tar.gz: 7a7a0cbca2fb7f7c7b2edc9593046be30202ffe9ce6b90308a211cee2861a96260d44d355871f38e4c35f88a5f957352684539621d7751de99ad7efec3438db5
|
data/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# SalesforceFlo
|
|
2
|
-
[](https://badge.fury.io/rb/salesforce_flo) [](https://badge.fury.io/rb/salesforce_flo) [](https://codeclimate.com/github/salesforce/salesforce_flo) [](https://semaphoreci.com/justinpowers/salesforce_flo)
|
|
3
3
|
|
|
4
4
|
SalesforceFlo is a Salesforce plugin for the Flo workflow automation library. If you aren't familiar with Flo, then please start [here](https://github.com/salesforce/flo)
|
|
5
5
|
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
# Licensed under the BSD 3-Clause license.
|
|
4
4
|
# For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
5
5
|
|
|
6
|
-
require '
|
|
6
|
+
require 'flo/provider/base'
|
|
7
7
|
|
|
8
8
|
module Flo
|
|
9
9
|
module Provider
|
|
10
|
-
class SalesforceFlo
|
|
10
|
+
class SalesforceFlo < Flo::Provider::Base
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
# Creates a new SalesforceFlo Provider instance
|
|
@@ -12,7 +12,8 @@ module SalesforceFlo
|
|
|
12
12
|
module Authentication
|
|
13
13
|
class OauthWrapper
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
OAUTH_ENDPOINT = '/services/oauth2/authorize'
|
|
16
|
+
AUTH_HOST = 'https://login.salesforce.com'
|
|
16
17
|
DEFAULT_CLIENT_ID = '3MVG9CEn_O3jvv0zPd34OzgiH037XR5Deez3GW8PpsMdzoxecdKUW1s.8oYU9GoLS2Tykr4qTrCizaQBjRXNT'
|
|
17
18
|
DEFAULT_REDIRECT_HOSTNAME = 'localhost'
|
|
18
19
|
DEFAULT_LISTEN_PORT = '3835'
|
|
@@ -34,6 +35,7 @@ module SalesforceFlo
|
|
|
34
35
|
@redirect_hostname = opts[:redirect_hostname] || DEFAULT_REDIRECT_HOSTNAME
|
|
35
36
|
@port = opts[:port] || DEFAULT_LISTEN_PORT
|
|
36
37
|
@client = opts[:client] || -> (options) { Restforce.new(options) }
|
|
38
|
+
|
|
37
39
|
raise ArgumentError.new(':client must respond to #call, try a lambda') unless @client.respond_to?(:call)
|
|
38
40
|
end
|
|
39
41
|
|
|
@@ -44,7 +46,7 @@ module SalesforceFlo
|
|
|
44
46
|
# from the salesforce that includes the access token
|
|
45
47
|
# @return The result of invoking #call on the client object
|
|
46
48
|
def call(opts={})
|
|
47
|
-
server = WEBrick::HTTPServer.new
|
|
49
|
+
server = WEBrick::HTTPServer.new(Port: @port)
|
|
48
50
|
auth_details = {}
|
|
49
51
|
|
|
50
52
|
server.mount_proc('/') do |req, res|
|
|
@@ -60,11 +62,11 @@ module SalesforceFlo
|
|
|
60
62
|
|
|
61
63
|
trap "INT" do server.shutdown end
|
|
62
64
|
|
|
63
|
-
Launchy.open("#{
|
|
65
|
+
Launchy.open("#{AUTH_HOST}#{OAUTH_ENDPOINT}?#{oauth_query_string}")
|
|
64
66
|
server.start
|
|
65
67
|
|
|
66
|
-
merged_options = opts.merge(auth_details).merge(client_id: @client_id, api_version: '
|
|
67
|
-
|
|
68
|
+
merged_options = opts.merge(auth_details).merge(client_id: @client_id, api_version: '39.0').inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
|
|
69
|
+
merged_options[:oauth_token] = merged_options[:access_token] if merged_options[:access_token]
|
|
68
70
|
@client.call(merged_options)
|
|
69
71
|
end
|
|
70
72
|
|
|
@@ -102,7 +104,7 @@ module SalesforceFlo
|
|
|
102
104
|
|
|
103
105
|
function sendHashParams() {
|
|
104
106
|
xhr = new XMLHttpRequest();
|
|
105
|
-
var url = "http://localhost
|
|
107
|
+
var url = "http://localhost:#{@port}/send_token";
|
|
106
108
|
xhr.open("POST", url, true);
|
|
107
109
|
xhr.setRequestHeader("Content-type", "application/json");
|
|
108
110
|
var data = JSON.stringify(getHashParams());
|
data/salesforce_flo.gemspec
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: salesforce_flo
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Justin Powers
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2017-
|
|
11
|
+
date: 2017-09-21 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -94,6 +94,20 @@ dependencies:
|
|
|
94
94
|
- - ">="
|
|
95
95
|
- !ruby/object:Gem::Version
|
|
96
96
|
version: '0'
|
|
97
|
+
- !ruby/object:Gem::Dependency
|
|
98
|
+
name: flo
|
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
|
100
|
+
requirements:
|
|
101
|
+
- - ">="
|
|
102
|
+
- !ruby/object:Gem::Version
|
|
103
|
+
version: 0.0.3
|
|
104
|
+
type: :runtime
|
|
105
|
+
prerelease: false
|
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
107
|
+
requirements:
|
|
108
|
+
- - ">="
|
|
109
|
+
- !ruby/object:Gem::Version
|
|
110
|
+
version: 0.0.3
|
|
97
111
|
description:
|
|
98
112
|
email:
|
|
99
113
|
- justin.powers@salesforce.com
|