salesforce_flo 0.0.2 → 0.0.3

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: f213441184760d6c7ae9ea601e3667da792b1450
4
- data.tar.gz: 9bb28c5c280cb100e4afce9f7363932d2a1c3e61
3
+ metadata.gz: 40f64c8308126581e55b62be28f827e031cdc2c7
4
+ data.tar.gz: b679a5e2c6fd4c52b98843706a3661e9073583a7
5
5
  SHA512:
6
- metadata.gz: c44d4ef7181a631a9e591ebeee8ee439a0cdb5ce2d16ddf6ec68e5a888f7dda50b231c0d48b3105c7e7dd44d90a27047c0f50365611fa997d5e6651742697dad
7
- data.tar.gz: 7a7a0cbca2fb7f7c7b2edc9593046be30202ffe9ce6b90308a211cee2861a96260d44d355871f38e4c35f88a5f957352684539621d7751de99ad7efec3438db5
6
+ metadata.gz: 466e589eb863a98eaa92502da9dd5e70152fe5d50f50e3b6d72409bf007e874822618e5f5e6e413fd9ec476ec92f2e965b50591207af831f22f13e4209eabaa6
7
+ data.tar.gz: 85ea278979344ec97f67887e6e124e979eb11f02dca7e8805de8ba469ab219bd6ecd672a6e1c867e81c30947f63786190182b7dd9e019a8ee9c26d65ce42320f
@@ -13,7 +13,7 @@ module SalesforceFlo
13
13
  class OauthWrapper
14
14
 
15
15
  OAUTH_ENDPOINT = '/services/oauth2/authorize'
16
- AUTH_HOST = 'https://login.salesforce.com'
16
+ DEFAULT_AUTH_HOST = 'https://login.salesforce.com'
17
17
  DEFAULT_CLIENT_ID = '3MVG9CEn_O3jvv0zPd34OzgiH037XR5Deez3GW8PpsMdzoxecdKUW1s.8oYU9GoLS2Tykr4qTrCizaQBjRXNT'
18
18
  DEFAULT_REDIRECT_HOSTNAME = 'localhost'
19
19
  DEFAULT_LISTEN_PORT = '3835'
@@ -26,15 +26,18 @@ module SalesforceFlo
26
26
  # that the user will be redirected to at the end of the Oauth authorization flow. This MUST match the
27
27
  # redirect URL specified in the connected app settings.
28
28
  # @option opts [String] :port (3835) The port that the user will be redirected to at the end of the Oauth
29
+ # @option opts [String] :auth_host (https://login.salesforce.com) The hostname where the user will be directed for
30
+ # authentication. This is useful if your org utilizes a custom domain.
29
31
  # flow. This will be appended to the redirect_hostname
30
32
  # @option opts [#call] :client An object that produces a client when called with initialization options
31
33
  # @raise [ArgumentError] If client object does not respond_to?(:call)
32
34
  #
33
35
  def initialize(opts={})
34
- @client_id = opts[:client_id] || DEFAULT_CLIENT_ID
35
- @redirect_hostname = opts[:redirect_hostname] || DEFAULT_REDIRECT_HOSTNAME
36
- @port = opts[:port] || DEFAULT_LISTEN_PORT
37
- @client = opts[:client] || -> (options) { Restforce.new(options) }
36
+ @client_id = opts.fetch(:client_id, DEFAULT_CLIENT_ID)
37
+ @redirect_hostname = opts.fetch(:redirect_hostname, DEFAULT_REDIRECT_HOSTNAME)
38
+ @port = opts.fetch(:port, DEFAULT_LISTEN_PORT)
39
+ @auth_host = opts.fetch(:auth_host, DEFAULT_AUTH_HOST)
40
+ @client = opts.fetch(:client, -> (options) { Restforce.new(options) })
38
41
 
39
42
  raise ArgumentError.new(':client must respond to #call, try a lambda') unless @client.respond_to?(:call)
40
43
  end
@@ -62,7 +65,7 @@ module SalesforceFlo
62
65
 
63
66
  trap "INT" do server.shutdown end
64
67
 
65
- Launchy.open("#{AUTH_HOST}#{OAUTH_ENDPOINT}?#{oauth_query_string}")
68
+ Launchy.open("#{@auth_host}#{OAUTH_ENDPOINT}?#{oauth_query_string}")
66
69
  server.start
67
70
 
68
71
  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}
@@ -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.2"
7
+ VERSION = "0.0.3"
8
8
  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.2
4
+ version: 0.0.3
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-09-21 00:00:00.000000000 Z
11
+ date: 2017-09-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler