omniauth-bookingsync 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec +1 -1
- data/.travis.yml +11 -6
- data/Appraisals +7 -0
- data/CHANGELOG.md +10 -0
- data/Gemfile.lock +30 -23
- data/README.md +3 -2
- data/example/Gemfile +2 -0
- data/example/Gemfile.lock +13 -12
- data/lib/omniauth-bookingsync.rb +1 -0
- data/lib/omniauth/bookingsync/identifier.rb +20 -0
- data/lib/omniauth/bookingsync/version.rb +1 -1
- data/lib/omniauth/strategies/bookingsync.rb +14 -2
- data/omniauth-bookingsync.gemspec +5 -6
- data/spec/omniauth/bookingsync/identifier_spec.rb +39 -0
- data/spec/omniauth/strategies/bookingsync_spec.rb +85 -25
- data/spec/spec_helper.rb +2 -0
- data/spec/support/shared_examples.rb +12 -12
- metadata +27 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 96471ecd45f00803267b9e01d06f950b00f9284d
|
4
|
+
data.tar.gz: cb7ea15ba8ee59443dbe1163f27ae5942dad07dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5845860e19f5bc0d8bd3d2952d0e7f0e1cf896de35ca33b381c86a4c3a52c92990699cd6a74923569ed69e5092d81b8be55d5d0a0ecc3afa72a8c3f089c3cbfa
|
7
|
+
data.tar.gz: 6a6f5109ce17516e0545b4bfa8a5ac8ce3346653c3030dddb159f3a7b2cf93731e8d43e39de469d53f7f891f6f0331371914630bd10c42c4e69caea0d24bf168
|
data/.rspec
CHANGED
@@ -1 +1 @@
|
|
1
|
-
--
|
1
|
+
--color
|
data/.travis.yml
CHANGED
@@ -1,10 +1,15 @@
|
|
1
|
-
sudo:
|
2
|
-
|
1
|
+
sudo: required
|
2
|
+
dist: trusty
|
3
3
|
before_install:
|
4
4
|
- gem install bundler
|
5
|
-
-
|
5
|
+
- bundle install --jobs=3 --retry=3
|
6
|
+
- bundle binstub rake
|
6
7
|
rvm:
|
7
|
-
- 2.2.
|
8
|
-
- 2.3.
|
8
|
+
- 2.2.6
|
9
|
+
- 2.3.3
|
10
|
+
- 2.4.0
|
9
11
|
- ruby-head
|
10
|
-
- jruby
|
12
|
+
- jruby
|
13
|
+
gemfile:
|
14
|
+
- gemfiles/omniauth-oauth2-1.3.gemfile
|
15
|
+
- gemfiles/omniauth-oauth2-1.4.gemfile
|
data/Appraisals
ADDED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,15 @@
|
|
1
1
|
#master
|
2
2
|
|
3
|
+
# 0.5.0 - 2017-04-22
|
4
|
+
|
5
|
+
* Add support for omniauth-oauth2 1.4
|
6
|
+
* Update gems dependencies
|
7
|
+
* Add Ruby 2.4 to Travis
|
8
|
+
* Add account auto-selection during the authorization process
|
9
|
+
|
10
|
+
# 0.4.0
|
11
|
+
|
12
|
+
* Update Readme
|
3
13
|
* bump oauth2 to 1.2
|
4
14
|
* add Ruby 2.3.1 to travis, drop Ruby 2.0 and 2.1 (end of maintenance)
|
5
15
|
* Update example application to work over SSL
|
data/Gemfile.lock
CHANGED
@@ -1,46 +1,51 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
omniauth-bookingsync (0.
|
5
|
-
oauth2 (~> 1.
|
6
|
-
omniauth (~> 1.
|
7
|
-
omniauth-oauth2 (
|
4
|
+
omniauth-bookingsync (0.5.0)
|
5
|
+
oauth2 (~> 1.3.0)
|
6
|
+
omniauth (~> 1.6)
|
7
|
+
omniauth-oauth2 (<= 1.4)
|
8
8
|
|
9
9
|
GEM
|
10
10
|
remote: https://rubygems.org/
|
11
11
|
specs:
|
12
|
+
appraisal (2.2.0)
|
13
|
+
bundler
|
14
|
+
rake
|
15
|
+
thor (>= 0.14.0)
|
12
16
|
ast (2.3.0)
|
13
|
-
diff-lcs (1.
|
14
|
-
faraday (0.
|
17
|
+
diff-lcs (1.3)
|
18
|
+
faraday (0.11.0)
|
15
19
|
multipart-post (>= 1.2, < 3)
|
16
|
-
hashie (3.
|
17
|
-
jwt (1.5.
|
20
|
+
hashie (3.5.5)
|
21
|
+
jwt (1.5.6)
|
18
22
|
multi_json (1.12.1)
|
19
|
-
multi_xml (0.
|
23
|
+
multi_xml (0.6.0)
|
20
24
|
multipart-post (2.0.0)
|
21
|
-
oauth2 (1.
|
22
|
-
faraday (>= 0.8, < 0.
|
25
|
+
oauth2 (1.3.1)
|
26
|
+
faraday (>= 0.8, < 0.12)
|
23
27
|
jwt (~> 1.0)
|
24
28
|
multi_json (~> 1.3)
|
25
29
|
multi_xml (~> 0.5)
|
26
30
|
rack (>= 1.2, < 3)
|
27
|
-
omniauth (1.
|
28
|
-
hashie (>=
|
29
|
-
rack (>= 1.
|
30
|
-
omniauth-oauth2 (1.
|
31
|
+
omniauth (1.6.1)
|
32
|
+
hashie (>= 3.4.6, < 3.6.0)
|
33
|
+
rack (>= 1.6.2, < 3)
|
34
|
+
omniauth-oauth2 (1.4.0)
|
31
35
|
oauth2 (~> 1.0)
|
32
36
|
omniauth (~> 1.2)
|
33
|
-
parser (2.
|
37
|
+
parser (2.4.0.0)
|
34
38
|
ast (~> 2.2)
|
35
39
|
powerpack (0.1.1)
|
36
40
|
rack (2.0.1)
|
37
|
-
rainbow (2.
|
38
|
-
|
41
|
+
rainbow (2.2.2)
|
42
|
+
rake
|
43
|
+
rake (12.0.0)
|
39
44
|
rspec (3.5.0)
|
40
45
|
rspec-core (~> 3.5.0)
|
41
46
|
rspec-expectations (~> 3.5.0)
|
42
47
|
rspec-mocks (~> 3.5.0)
|
43
|
-
rspec-core (3.5.
|
48
|
+
rspec-core (3.5.4)
|
44
49
|
rspec-support (~> 3.5.0)
|
45
50
|
rspec-expectations (3.5.0)
|
46
51
|
diff-lcs (>= 1.2.0, < 2.0)
|
@@ -49,23 +54,25 @@ GEM
|
|
49
54
|
diff-lcs (>= 1.2.0, < 2.0)
|
50
55
|
rspec-support (~> 3.5.0)
|
51
56
|
rspec-support (3.5.0)
|
52
|
-
rubocop (0.
|
53
|
-
parser (>= 2.3.
|
57
|
+
rubocop (0.48.1)
|
58
|
+
parser (>= 2.3.3.1, < 3.0)
|
54
59
|
powerpack (~> 0.1)
|
55
60
|
rainbow (>= 1.99.1, < 3.0)
|
56
61
|
ruby-progressbar (~> 1.7)
|
57
62
|
unicode-display_width (~> 1.0, >= 1.0.1)
|
58
63
|
ruby-progressbar (1.8.1)
|
59
|
-
|
64
|
+
thor (0.19.4)
|
65
|
+
unicode-display_width (1.2.1)
|
60
66
|
|
61
67
|
PLATFORMS
|
62
68
|
ruby
|
63
69
|
|
64
70
|
DEPENDENCIES
|
71
|
+
appraisal
|
65
72
|
omniauth-bookingsync!
|
66
73
|
rake
|
67
74
|
rspec
|
68
75
|
rubocop
|
69
76
|
|
70
77
|
BUNDLED WITH
|
71
|
-
1.
|
78
|
+
1.14.6
|
data/README.md
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
[![Build
|
1
|
+
[![CI Build
|
2
|
+
Status](https://secure.travis-ci.org/BookingSync/omniauth-bookingsync.png)](http://travis-ci.org/BookingSync/omniauth-bookingsync)
|
2
3
|
|
3
4
|
# OmniAuth BookingSync
|
4
5
|
|
@@ -36,7 +37,7 @@ this will skip the account selection process and show the accept/deny page.
|
|
36
37
|
|
37
38
|
## Supported Rubies
|
38
39
|
|
39
|
-
OmniAuth BookingSync is tested under 2.2, 2.3, Ruby-head, JRuby.
|
40
|
+
OmniAuth BookingSync is tested under 2.2, 2.3, 2.4, Ruby-head, JRuby.
|
40
41
|
|
41
42
|
[![CI Build
|
42
43
|
Status](https://secure.travis-ci.org/BookingSync/omniauth-bookingsync.png)](http://travis-ci.org/BookingSync/omniauth-bookingsync)
|
data/example/Gemfile
CHANGED
data/example/Gemfile.lock
CHANGED
@@ -1,24 +1,25 @@
|
|
1
1
|
GEM
|
2
|
+
remote: https://rubygems.org/
|
2
3
|
specs:
|
3
4
|
faraday (0.9.2)
|
4
5
|
multipart-post (>= 1.2, < 3)
|
5
|
-
hashie (3.
|
6
|
+
hashie (3.5.5)
|
6
7
|
json (1.8.3)
|
7
|
-
jwt (1.5.
|
8
|
-
multi_json (1.
|
9
|
-
multi_xml (0.
|
8
|
+
jwt (1.5.6)
|
9
|
+
multi_json (1.12.1)
|
10
|
+
multi_xml (0.6.0)
|
10
11
|
multipart-post (2.0.0)
|
11
|
-
oauth2 (1.
|
12
|
+
oauth2 (1.2.0)
|
12
13
|
faraday (>= 0.8, < 0.10)
|
13
14
|
jwt (~> 1.0)
|
14
15
|
multi_json (~> 1.3)
|
15
16
|
multi_xml (~> 0.5)
|
16
|
-
rack (
|
17
|
-
omniauth (1.
|
18
|
-
hashie (>=
|
19
|
-
rack (>= 1.
|
20
|
-
omniauth-bookingsync (0.
|
21
|
-
oauth2 (
|
17
|
+
rack (>= 1.2, < 3)
|
18
|
+
omniauth (1.6.1)
|
19
|
+
hashie (>= 3.4.6, < 3.6.0)
|
20
|
+
rack (>= 1.6.2, < 3)
|
21
|
+
omniauth-bookingsync (0.4.0)
|
22
|
+
oauth2 (~> 1.2.0)
|
22
23
|
omniauth (~> 1.1)
|
23
24
|
omniauth-oauth2 (< 1.4)
|
24
25
|
omniauth-oauth2 (1.3.1)
|
@@ -42,4 +43,4 @@ DEPENDENCIES
|
|
42
43
|
sinatra
|
43
44
|
|
44
45
|
BUNDLED WITH
|
45
|
-
1.
|
46
|
+
1.14.6
|
data/lib/omniauth-bookingsync.rb
CHANGED
@@ -0,0 +1,20 @@
|
|
1
|
+
module OmniAuth
|
2
|
+
module BookingSync
|
3
|
+
class Identifier
|
4
|
+
attr_reader :identifier
|
5
|
+
|
6
|
+
def initialize(identifier)
|
7
|
+
@identifier = identifier
|
8
|
+
end
|
9
|
+
|
10
|
+
def value
|
11
|
+
casted_value = identifier.to_i
|
12
|
+
casted_value > 0 ? casted_value : nil
|
13
|
+
end
|
14
|
+
|
15
|
+
def valid?
|
16
|
+
value != nil
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -21,11 +21,23 @@ module OmniAuth
|
|
21
21
|
|
22
22
|
def authorize_params
|
23
23
|
super.tap do |params|
|
24
|
-
|
25
|
-
|
24
|
+
bookingsync_account_id = OmniAuth::BookingSync::Identifier.new(
|
25
|
+
request.params["_bookingsync_account_id"])
|
26
|
+
account_id = OmniAuth::BookingSync::Identifier.new(request.params["account_id"])
|
27
|
+
|
28
|
+
if bookingsync_account_id.valid?
|
29
|
+
params[:account_id] = bookingsync_account_id.value
|
30
|
+
elsif account_id.valid?
|
31
|
+
params[:account_id] = account_id.value
|
26
32
|
end
|
27
33
|
end
|
28
34
|
end
|
35
|
+
|
36
|
+
# Fixes regression in omniauth-oauth2 v1.4.0 by
|
37
|
+
# https://github.com/intridea/omniauth-oauth2/commit/85fdbe117c2a4400d001a6368cc359d88f40abc7
|
38
|
+
def callback_url
|
39
|
+
options[:redirect_uri] || (full_host + script_name + callback_path)
|
40
|
+
end
|
29
41
|
end
|
30
42
|
end
|
31
43
|
end
|
@@ -11,18 +11,17 @@ Gem::Specification.new do |gem|
|
|
11
11
|
gem.summary = "An OmniAuth 1.0 strategy for BookingSync OAuth2 identification."
|
12
12
|
gem.description = "An OmniAuth 1.0 strategy for BookingSync OAuth2 identification."
|
13
13
|
|
14
|
-
gem.executables = `git ls-files --
|
14
|
+
gem.executables = `git ls-files -- exe/*`.split("\n").map { |f| File.basename(f) }
|
15
15
|
gem.files = `git ls-files`.split("\n")
|
16
16
|
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
17
17
|
gem.require_paths = ["lib"]
|
18
18
|
|
19
|
-
gem.add_dependency "omniauth", "~> 1.
|
20
|
-
|
21
|
-
|
22
|
-
gem.add_dependency "omniauth-oauth2", "< 1.4"
|
23
|
-
gem.add_dependency "oauth2", "~> 1.2.0"
|
19
|
+
gem.add_dependency "omniauth", "~> 1.6"
|
20
|
+
gem.add_dependency "omniauth-oauth2", "<= 1.4"
|
21
|
+
gem.add_dependency "oauth2", "~> 1.3.0"
|
24
22
|
|
25
23
|
gem.add_development_dependency "rspec"
|
26
24
|
gem.add_development_dependency "rake"
|
27
25
|
gem.add_development_dependency "rubocop"
|
26
|
+
gem.add_development_dependency "appraisal"
|
28
27
|
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe OmniAuth::BookingSync::Identifier do
|
4
|
+
describe "#value" do
|
5
|
+
it "returns a number" do
|
6
|
+
expect(OmniAuth::BookingSync::Identifier.new("1").value).to eq 1
|
7
|
+
end
|
8
|
+
|
9
|
+
it "returns nil if blank" do
|
10
|
+
expect(OmniAuth::BookingSync::Identifier.new("").value).to be_nil
|
11
|
+
end
|
12
|
+
|
13
|
+
it "returns nil if non numeric characters given" do
|
14
|
+
expect(OmniAuth::BookingSync::Identifier.new("a").value).to be_nil
|
15
|
+
end
|
16
|
+
|
17
|
+
it "returns nil if negative number" do
|
18
|
+
expect(OmniAuth::BookingSync::Identifier.new("-1").value).to be_nil
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
describe "#valid?" do
|
23
|
+
it "returns true if a number" do
|
24
|
+
expect(OmniAuth::BookingSync::Identifier.new("1")).to be_valid
|
25
|
+
end
|
26
|
+
|
27
|
+
it "returns false if blank" do
|
28
|
+
expect(OmniAuth::BookingSync::Identifier.new("")).not_to be_valid
|
29
|
+
end
|
30
|
+
|
31
|
+
it "returns false if non numeric characters given" do
|
32
|
+
expect(OmniAuth::BookingSync::Identifier.new("a")).not_to be_valid
|
33
|
+
end
|
34
|
+
|
35
|
+
it "returns false if negative number" do
|
36
|
+
expect(OmniAuth::BookingSync::Identifier.new("-1")).not_to be_valid
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -1,15 +1,18 @@
|
|
1
1
|
require "spec_helper"
|
2
|
-
require "omniauth-bookingsync"
|
3
2
|
|
4
3
|
describe OmniAuth::Strategies::BookingSync do
|
5
4
|
before do
|
6
5
|
OmniAuth.config.test_mode = true
|
7
6
|
end
|
8
7
|
|
8
|
+
after do
|
9
|
+
OmniAuth.config.test_mode = false
|
10
|
+
end
|
11
|
+
|
9
12
|
let(:request) { double("Request", params: {}, cookies: {}, env: {}) }
|
10
13
|
let(:options) { {} }
|
11
14
|
|
12
|
-
|
15
|
+
let(:strategy) do
|
13
16
|
OmniAuth::Strategies::BookingSync.new(nil, options).tap do |strategy|
|
14
17
|
allow(strategy).to receive(:request) { request }
|
15
18
|
end
|
@@ -17,64 +20,121 @@ describe OmniAuth::Strategies::BookingSync do
|
|
17
20
|
|
18
21
|
it_should_behave_like "an oauth2 strategy"
|
19
22
|
|
20
|
-
describe
|
21
|
-
it "
|
22
|
-
expect(
|
23
|
+
describe "#client" do
|
24
|
+
it "returns the correct site" do
|
25
|
+
expect(strategy.client.site).to eq "https://www.bookingsync.com/"
|
23
26
|
end
|
24
27
|
|
25
|
-
it "
|
26
|
-
expect(
|
28
|
+
it "returns the correct authorization url" do
|
29
|
+
expect(strategy.client.options[:authorize_url]).to eq "/oauth/authorize"
|
27
30
|
end
|
28
31
|
|
29
|
-
it "
|
30
|
-
expect(
|
32
|
+
it "returns the correct token url" do
|
33
|
+
expect(strategy.client.options[:token_url]).to eq "/oauth/token"
|
31
34
|
end
|
32
35
|
end
|
33
36
|
|
34
|
-
describe
|
35
|
-
it "
|
36
|
-
expect(
|
37
|
+
describe "#callback_path" do
|
38
|
+
it "returns the correct callback path" do
|
39
|
+
expect(strategy.callback_path).to eq("/auth/bookingsync/callback")
|
37
40
|
end
|
38
41
|
end
|
39
42
|
|
40
|
-
describe
|
43
|
+
describe "#authorize_params" do
|
41
44
|
it "passes account_id from request params" do
|
42
45
|
request.params["account_id"] = "123"
|
43
|
-
expect(
|
46
|
+
expect(strategy.authorize_params[:account_id]).to eq 123
|
47
|
+
end
|
48
|
+
|
49
|
+
it "passes _bookingsync_account_id from request params" do
|
50
|
+
request.params["_bookingsync_account_id"] = "123"
|
51
|
+
expect(strategy.authorize_params[:account_id]).to eq 123
|
52
|
+
end
|
53
|
+
|
54
|
+
it "passes _bookingsync_account_id and account_id from request params, " +
|
55
|
+
"it use _bookingsync_account_id" do
|
56
|
+
request.params["_bookingsync_account_id"] = "123"
|
57
|
+
request.params["account_id"] = "456"
|
58
|
+
expect(strategy.authorize_params[:account_id]).to eq 123
|
59
|
+
end
|
60
|
+
|
61
|
+
it "ignores blank params" do
|
62
|
+
request.params["_bookingsync_account_id"] = ""
|
63
|
+
request.params["account_id"] = "456"
|
64
|
+
expect(strategy.authorize_params[:account_id]).to eq 456
|
65
|
+
end
|
66
|
+
|
67
|
+
it "ignores non numeric params" do
|
68
|
+
request.params["_bookingsync_account_id"] = "a"
|
69
|
+
request.params["account_id"] = "b"
|
70
|
+
expect(strategy.authorize_params[:account_id]).to be_nil
|
44
71
|
end
|
45
72
|
end
|
46
73
|
|
47
|
-
describe
|
74
|
+
describe "#raw_info" do
|
48
75
|
let(:body) { '{"accounts": [{"id": 1}]}' }
|
49
76
|
let(:response) { double("response", headers: headers, status: 200, body: body) }
|
50
77
|
|
51
78
|
before do
|
52
|
-
allow(
|
53
|
-
expect(
|
79
|
+
allow(strategy).to receive(:access_token).and_return(double)
|
80
|
+
expect(strategy.access_token).to receive(:get).with("/api/v3/accounts")
|
54
81
|
.and_return(OAuth2::Response.new(response))
|
55
82
|
end
|
56
83
|
|
57
84
|
context "when Content-Type not supported" do
|
58
85
|
let(:headers) { { "Content-Type" => "application/foo-bar" } }
|
59
86
|
|
60
|
-
it "
|
61
|
-
expect {
|
87
|
+
it "raises a NoMethodError error" do
|
88
|
+
expect { strategy.raw_info }.to raise_error(NoMethodError)
|
62
89
|
end
|
63
90
|
end
|
64
91
|
|
65
|
-
context "when Content-Type
|
92
|
+
context "when using JSONAPI Content-Type" do
|
66
93
|
let(:headers) { { "Content-Type" => "application/vnd.api+json" } }
|
67
94
|
|
68
|
-
it "
|
69
|
-
expect(
|
95
|
+
it "returns account info from api v3" do
|
96
|
+
expect(strategy.raw_info).to eq({ "id" => 1 })
|
70
97
|
end
|
71
98
|
end
|
72
99
|
|
73
|
-
context "when Content-Type
|
100
|
+
context "when using JSON Content-Type" do
|
74
101
|
let(:headers) { { "Content-Type" => "application/json" } }
|
75
102
|
|
76
|
-
it "
|
77
|
-
expect(
|
103
|
+
it "returns account info from api v3" do
|
104
|
+
expect(strategy.raw_info).to eq({ "id" => 1 })
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
describe "#callback_url" do
|
110
|
+
let(:url_base) { "https://auth.example.com" }
|
111
|
+
|
112
|
+
before do
|
113
|
+
allow(request).to receive(:scheme).and_return("https")
|
114
|
+
allow(request).to receive(:url).and_return("#{url_base}/some/page?foo=bar")
|
115
|
+
|
116
|
+
allow(strategy).to receive(:script_name).and_return("") # as not to depend on Rack env
|
117
|
+
allow(strategy).to receive(:query_string).and_return("?foo=bar")
|
118
|
+
end
|
119
|
+
|
120
|
+
it "returns default callback url (omitting querystring)" do
|
121
|
+
expect(strategy.callback_url).to eq "#{url_base}/auth/bookingsync/callback"
|
122
|
+
end
|
123
|
+
|
124
|
+
context "with custom callback path" do
|
125
|
+
let(:options) { { callback_path: "/auth/bookingsync/done" } }
|
126
|
+
|
127
|
+
it "returns default callback url (omitting querystring)" do
|
128
|
+
expect(strategy.callback_url).to eq "#{url_base}/auth/bookingsync/done"
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
context "with custom callback url" do
|
133
|
+
let(:url) { "https://auth.myapp.com/auth/bookingsync/callback" }
|
134
|
+
let(:options) { { redirect_uri: url } }
|
135
|
+
|
136
|
+
it "returns url from redirect_uri option" do
|
137
|
+
expect(strategy.callback_url).to eq url
|
78
138
|
end
|
79
139
|
end
|
80
140
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,23 +1,23 @@
|
|
1
1
|
shared_examples "an oauth2 strategy" do
|
2
|
-
describe
|
2
|
+
describe "#client" do
|
3
3
|
let(:options) do
|
4
4
|
{ client_options: { "authorize_url" => "https://example.com" } }
|
5
5
|
end
|
6
6
|
|
7
7
|
it "is initialized with symbolized client_options" do
|
8
|
-
expect(
|
8
|
+
expect(strategy.client.options[:authorize_url]).to eq "https://example.com"
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
12
|
-
describe
|
12
|
+
describe "#authorize_params" do
|
13
13
|
context "when passed as authorize_params" do
|
14
14
|
let(:options) do
|
15
15
|
{ authorize_params: { foo: "bar", baz: "zip" } }
|
16
16
|
end
|
17
17
|
|
18
18
|
it "includes any authorize params passed in the :authorize_params option" do
|
19
|
-
expect(
|
20
|
-
expect(
|
19
|
+
expect(strategy.authorize_params["foo"]).to eq("bar")
|
20
|
+
expect(strategy.authorize_params["baz"]).to eq("zip")
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
@@ -27,21 +27,21 @@ shared_examples "an oauth2 strategy" do
|
|
27
27
|
end
|
28
28
|
|
29
29
|
it "includes top-level options that are marked as :authorize_options" do
|
30
|
-
expect(
|
31
|
-
expect(
|
30
|
+
expect(strategy.authorize_params["scope"]).to eq("bar")
|
31
|
+
expect(strategy.authorize_params["foo"]).to eq("baz")
|
32
32
|
end
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
-
describe
|
36
|
+
describe "#token_params" do
|
37
37
|
context "when passed as token_params" do
|
38
38
|
let(:options) do
|
39
39
|
{ token_params: { foo: "bar", baz: "zip" } }
|
40
40
|
end
|
41
41
|
|
42
42
|
it "includes any token params passed in the :token_params option" do
|
43
|
-
expect(
|
44
|
-
expect(
|
43
|
+
expect(strategy.token_params["foo"]).to eq("bar")
|
44
|
+
expect(strategy.token_params["baz"]).to eq("zip")
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
@@ -51,8 +51,8 @@ shared_examples "an oauth2 strategy" do
|
|
51
51
|
end
|
52
52
|
|
53
53
|
it "includes top-level options that are marked as :token_options" do
|
54
|
-
expect(
|
55
|
-
expect(
|
54
|
+
expect(strategy.token_params["scope"]).to eq("bar")
|
55
|
+
expect(strategy.token_params["foo"]).to eq("baz")
|
56
56
|
end
|
57
57
|
end
|
58
58
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-bookingsync
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sebastien Grosjean
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-04-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: omniauth
|
@@ -16,26 +16,26 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1.
|
19
|
+
version: '1.6'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '1.
|
26
|
+
version: '1.6'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: omniauth-oauth2
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - "<="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '1.4'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - "<="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '1.4'
|
41
41
|
- !ruby/object:Gem::Dependency
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 1.
|
47
|
+
version: 1.3.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 1.
|
54
|
+
version: 1.3.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -94,6 +94,20 @@ dependencies:
|
|
94
94
|
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: appraisal
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
97
111
|
description: An OmniAuth 1.0 strategy for BookingSync OAuth2 identification.
|
98
112
|
email:
|
99
113
|
- dev@bookingsync.com
|
@@ -106,6 +120,7 @@ files:
|
|
106
120
|
- ".rubocop.yml"
|
107
121
|
- ".rubocop_todo.yml"
|
108
122
|
- ".travis.yml"
|
123
|
+
- Appraisals
|
109
124
|
- CHANGELOG.md
|
110
125
|
- Gemfile
|
111
126
|
- Gemfile.lock
|
@@ -118,9 +133,11 @@ files:
|
|
118
133
|
- example/bookingsync_oauth_helper.rb
|
119
134
|
- example/config.ru
|
120
135
|
- lib/omniauth-bookingsync.rb
|
136
|
+
- lib/omniauth/bookingsync/identifier.rb
|
121
137
|
- lib/omniauth/bookingsync/version.rb
|
122
138
|
- lib/omniauth/strategies/bookingsync.rb
|
123
139
|
- omniauth-bookingsync.gemspec
|
140
|
+
- spec/omniauth/bookingsync/identifier_spec.rb
|
124
141
|
- spec/omniauth/strategies/bookingsync_spec.rb
|
125
142
|
- spec/spec_helper.rb
|
126
143
|
- spec/support/shared_examples.rb
|
@@ -148,6 +165,8 @@ signing_key:
|
|
148
165
|
specification_version: 4
|
149
166
|
summary: An OmniAuth 1.0 strategy for BookingSync OAuth2 identification.
|
150
167
|
test_files:
|
168
|
+
- spec/omniauth/bookingsync/identifier_spec.rb
|
151
169
|
- spec/omniauth/strategies/bookingsync_spec.rb
|
152
170
|
- spec/spec_helper.rb
|
153
171
|
- spec/support/shared_examples.rb
|
172
|
+
has_rdoc:
|