omniauth-bookingsync 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d4ee1cab6909a9ebc58c93121e5c27ab5f84f3d5
4
- data.tar.gz: c6a108cd9601234fdb3f69427859124a2c6d2dea
3
+ metadata.gz: 06bc914a684fc353f47137ce807aebe7de0f5bda
4
+ data.tar.gz: 50f2cb2dde588c89d804ec924e14bc8f9100350b
5
5
  SHA512:
6
- metadata.gz: fa8a7a5a141e61bfd77f5727b4bf0d983dfda407a20d3f01b63540ebf3a91134fbc0ed49c5216992c730a33cc49d3bf30f60dc811b5767147bfbed369446627d
7
- data.tar.gz: d0b8298e4ce9282c13de9df53f30b597d2f44ae5a178c8f6ade0e76fb74a798de9ee88461e09117db2924ec72b863ee8bbf1c7a7f1f421e1bfc956a3a02c633e
6
+ metadata.gz: 442fc397712efbec922b6ce1fb875955d2c2aad8a9b43324e561152d86589e9e3efd5082c95c53439e27c2bbcecd592388f5ebfa6b87564799d1f731c800084c
7
+ data.tar.gz: 249406a97cda952d19e6b3f3f2b2578936d56cce8187577f14d60b0ba21f85d258325e55eb85ec65138271c8d00de933adf5ae458f3a89311f16da4b7fdb091c
data/Gemfile CHANGED
File without changes
data/README.md CHANGED
@@ -26,6 +26,12 @@ Rails.application.config.middleware.use OmniAuth::Builder do
26
26
  end
27
27
  ```
28
28
 
29
+ ### Authorization for selected account
30
+
31
+ You can pass the `account_id` parameter to the authorization url to request
32
+ authorization for a selected account. For users with multiple accounts,
33
+ this will skip the account selection process and show the accept/deny page.
34
+
29
35
  ## Supported Rubies
30
36
 
31
37
  OmniAuth BookingSync is tested under 1.8.7, 1.9.2, 1.9.3, 2.0.0, Ruby-head, Ruby Enterprise Edition, JRuby (1.8 and 1.9 mode).
data/Rakefile CHANGED
File without changes
data/example/sinatra.rb CHANGED
File without changes
@@ -1,5 +1,5 @@
1
1
  module OmniAuth
2
2
  module BookingSync
3
- VERSION = '0.1.0'
3
+ VERSION = '0.2.0'
4
4
  end
5
5
  end
@@ -20,6 +20,14 @@ module OmniAuth
20
20
  def raw_info
21
21
  @raw_info ||= access_token.get('/api/v3/accounts').parsed['accounts'].first
22
22
  end
23
+
24
+ def authorize_params
25
+ super.tap do |params|
26
+ if request.params["account_id"]
27
+ params[:account_id] = request.params["account_id"]
28
+ end
29
+ end
30
+ end
23
31
  end
24
32
  end
25
33
  end
File without changes
File without changes
@@ -6,8 +6,12 @@ describe OmniAuth::Strategies::BookingSync do
6
6
  OmniAuth.config.test_mode = true
7
7
  end
8
8
 
9
+ let(:request) { double('Request', :params => {}, :cookies => {}, :env => {}) }
10
+
9
11
  subject do
10
- OmniAuth::Strategies::BookingSync.new(nil, @options || {})
12
+ OmniAuth::Strategies::BookingSync.new(nil, @options || {}).tap do |strategy|
13
+ allow(strategy).to receive(:request) { request }
14
+ end
11
15
  end
12
16
 
13
17
  it_should_behave_like 'an oauth2 strategy'
@@ -32,6 +36,13 @@ describe OmniAuth::Strategies::BookingSync do
32
36
  end
33
37
  end
34
38
 
39
+ describe '#authorize_params' do
40
+ it 'should pass account_id from request params' do
41
+ request.params['account_id'] = '123'
42
+ expect(subject.authorize_params[:account_id]).to eq('123')
43
+ end
44
+ end
45
+
35
46
  describe '#raw_info' do
36
47
  it 'should fetch account info from api v3' do
37
48
  subject.stub(:access_token => double)
data/spec/spec_helper.rb CHANGED
File without changes
File without changes
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.1.0
4
+ version: 0.2.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: 2014-02-27 00:00:00.000000000 Z
11
+ date: 2014-03-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: omniauth
@@ -114,3 +114,4 @@ test_files:
114
114
  - spec/omniauth/strategies/bookingsync_spec.rb
115
115
  - spec/spec_helper.rb
116
116
  - spec/support/shared_examples.rb
117
+ has_rdoc: