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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d8f1c9187f49decf64aad3602dbc666dcb779efa
4
- data.tar.gz: 6d03df17236eda0d75991259868a9b9ddb40a895
3
+ metadata.gz: f213441184760d6c7ae9ea601e3667da792b1450
4
+ data.tar.gz: 9bb28c5c280cb100e4afce9f7363932d2a1c3e61
5
5
  SHA512:
6
- metadata.gz: 1e0bae2a9bc59b73225660edb54d2256b5948eca1809c1224aa46ab5bdef40d401238b92696a8fd90fb69617d24e78273c441413700d81a6cd1ea89b1c310769
7
- data.tar.gz: d14d35b63e01e18da55d39028ec6794e449163ae5a2a7e0b9ff8fbc165a7f8246d88dcf82ac5b9e77200224d92dd8d9e11e6947938c5f228d6e7c4d842ef1d78
6
+ metadata.gz: c44d4ef7181a631a9e591ebeee8ee439a0cdb5ce2d16ddf6ec68e5a888f7dda50b231c0d48b3105c7e7dd44d90a27047c0f50365611fa997d5e6651742697dad
7
+ data.tar.gz: 7a7a0cbca2fb7f7c7b2edc9593046be30202ffe9ce6b90308a211cee2861a96260d44d355871f38e4c35f88a5f957352684539621d7751de99ad7efec3438db5
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # SalesforceFlo
2
- [![Gem Version](https://badge.fury.io/rb/salesforce_flo.svg)](https://badge.fury.io/rb/salesforce_flo) [![Code Climate](https://codeclimate.com/github/codeclimate/codeclimate/badges/gpa.svg)](https://codeclimate.com/github/codeclimate/codeclimate) [![Build Status](https://semaphoreci.com/api/v1/justinpowers/salesforce_flo/branches/master/shields_badge.svg)](https://semaphoreci.com/justinpowers/salesforce_flo)
2
+ [![Gem Version](https://badge.fury.io/rb/salesforce_flo.svg)](https://badge.fury.io/rb/salesforce_flo) [![Code Climate](https://codeclimate.com/github/salesforce/salesforce_flo/badges/gpa.svg)](https://codeclimate.com/github/salesforce/salesforce_flo) [![Build Status](https://semaphoreci.com/api/v1/justinpowers/salesforce_flo/branches/master/shields_badge.svg)](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 'pry'
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
- SFDC_URI = 'https://login.salesforce.com/services/oauth2/authorize'
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 :Port => @redirect_hostname
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("#{SFDC_URI}?#{oauth_query_string}")
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: '38.0').inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
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:8000/send_token";
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());
@@ -4,5 +4,5 @@
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
6
  module SalesforceFlo
7
- VERSION = "0.0.1"
7
+ VERSION = "0.0.2"
8
8
  end
@@ -28,4 +28,5 @@ Gem::Specification.new do |spec|
28
28
 
29
29
  spec.add_dependency 'restforce'
30
30
  spec.add_dependency 'launchy'
31
+ spec.add_dependency 'flo', '>= 0.0.3'
31
32
  end
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.1
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-05-24 00:00:00.000000000 Z
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