cronofy 0.8.2 → 0.8.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cronofy/auth.rb +9 -5
- data/lib/cronofy/client.rb +4 -4
- data/lib/cronofy/version.rb +1 -1
- data/spec/lib/cronofy/auth_spec.rb +12 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a3f4ad1bcd1d60b04de2d5a623899783666eace5
|
4
|
+
data.tar.gz: db32fd4cb307bd4c6b6d41c87dab2d7d7149091a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c25bdc2ca36a4b3350e2634e63a4bbd505e52ccc3fc53b661acdd44a4c5fe3acd0d3e15ed3e236fb4e15807a71d54d8bf2d1309812d92b54edfc373a7183574f
|
7
|
+
data.tar.gz: b1d3651e5dad66f624c7c9d46dd95572f59f0701165bbe43af7df82c4bdf333460a1fc0be6965173f683acf5d66fd3c87692eb18d01225679f1680388a9d9e57
|
data/lib/cronofy/auth.rb
CHANGED
@@ -20,10 +20,11 @@ module Cronofy
|
|
20
20
|
# have completed the authorization steps.
|
21
21
|
# options - The Hash options used to refine the selection
|
22
22
|
# (default: {}):
|
23
|
-
# :scope - Array of scopes describing the access to
|
24
|
-
# from the user to the users calendars
|
25
|
-
#
|
26
|
-
#
|
23
|
+
# :scope - Array or String of scopes describing the access to
|
24
|
+
# request from the user to the users calendars
|
25
|
+
# (required).
|
26
|
+
# :state - Array of states to retain during the OAuth
|
27
|
+
# authorization process (optional).
|
27
28
|
#
|
28
29
|
# See http://www.cronofy.com/developers/api#authorization for reference.
|
29
30
|
#
|
@@ -35,7 +36,10 @@ module Cronofy
|
|
35
36
|
|
36
37
|
# Reformat params as needed
|
37
38
|
params.delete(:state) if params[:state].nil?
|
38
|
-
|
39
|
+
|
40
|
+
if params[:scope].respond_to?(:join)
|
41
|
+
params[:scope] = params[:scope].join(' ')
|
42
|
+
end
|
39
43
|
|
40
44
|
@auth_client.auth_code.authorize_url(params)
|
41
45
|
end
|
data/lib/cronofy/client.rb
CHANGED
@@ -368,11 +368,11 @@ module Cronofy
|
|
368
368
|
# have completed the authorization steps.
|
369
369
|
# options - The Hash options used to refine the selection
|
370
370
|
# (default: {}):
|
371
|
-
# :scope - Array of scopes describing the access to
|
372
|
-
# from the user to the users calendars
|
371
|
+
# :scope - Array or String of scopes describing the access to
|
372
|
+
# request from the user to the users calendars
|
373
373
|
# (default: DEFAULT_OAUTH_SCOPE).
|
374
|
-
# :state -
|
375
|
-
#
|
374
|
+
# :state - Array of states to retain during the OAuth
|
375
|
+
# authorization process (optional).
|
376
376
|
#
|
377
377
|
# See http://www.cronofy.com/developers/api#authorization for reference.
|
378
378
|
#
|
data/lib/cronofy/version.rb
CHANGED
@@ -84,7 +84,8 @@ describe Cronofy::Auth do
|
|
84
84
|
end
|
85
85
|
|
86
86
|
describe '#user_auth_link' do
|
87
|
-
let(:
|
87
|
+
let(:input_scope) { %w{read_events list_calendars create_event} }
|
88
|
+
let(:state) { nil }
|
88
89
|
let(:scheme) { 'https' }
|
89
90
|
let(:host) { 'app.cronofy.com' }
|
90
91
|
let(:path) { '/oauth/authorize' }
|
@@ -93,7 +94,7 @@ describe Cronofy::Auth do
|
|
93
94
|
'client_id' => client_id,
|
94
95
|
'redirect_uri' => redirect_uri,
|
95
96
|
'response_type' => 'code',
|
96
|
-
'scope' => scope
|
97
|
+
'scope' => scope,
|
97
98
|
}
|
98
99
|
end
|
99
100
|
|
@@ -102,7 +103,7 @@ describe Cronofy::Auth do
|
|
102
103
|
end
|
103
104
|
|
104
105
|
subject do
|
105
|
-
url = auth.user_auth_link(redirect_uri, scope:
|
106
|
+
url = auth.user_auth_link(redirect_uri, scope: input_scope, state: state)
|
106
107
|
URI.parse(url)
|
107
108
|
end
|
108
109
|
|
@@ -134,12 +135,18 @@ describe Cronofy::Auth do
|
|
134
135
|
context 'when state is passed' do
|
135
136
|
let(:state) { SecureRandom.hex }
|
136
137
|
let(:params) do
|
137
|
-
default_params
|
138
|
-
default_params
|
138
|
+
default_params.merge('state' => state)
|
139
139
|
end
|
140
140
|
|
141
141
|
it_behaves_like 'a user auth link provider'
|
142
142
|
end
|
143
|
+
|
144
|
+
context 'when scope is a string' do
|
145
|
+
let(:input_scope) { scope }
|
146
|
+
let(:params) { default_params }
|
147
|
+
|
148
|
+
it_behaves_like 'a user auth link provider'
|
149
|
+
end
|
143
150
|
end
|
144
151
|
|
145
152
|
shared_examples 'an authorization request' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cronofy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sergii Paryzhskyi
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-04-
|
12
|
+
date: 2016-04-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: oauth2
|