cronofy 0.8.2 → 0.8.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: 2ef54cf80598736effb76cce568f2e62068814df
4
- data.tar.gz: 1d6a3ea42bf9aed5dd5baf87bcf8d0d3f102d3cf
3
+ metadata.gz: a3f4ad1bcd1d60b04de2d5a623899783666eace5
4
+ data.tar.gz: db32fd4cb307bd4c6b6d41c87dab2d7d7149091a
5
5
  SHA512:
6
- metadata.gz: 62669f6fef7ca94d82076133a01c6253cab630bf7d41a7f8c304113cd7a0ee90dfcba7c8bc929463e2329dc3afbeef1d96909c3f8ef950e4e4e4f37d7ba4c095
7
- data.tar.gz: 3fdffca4993dcd83c62f901dc6a3b422c6b5c98a8183116a869f94eb7e785499c53cb518bfef154dc72a363ebd440d37f5356ff2a7393232d86a9980fdde3d33
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 request
24
- # from the user to the users calendars (required).
25
- # :state - String containing the state value to retain during
26
- # the OAuth authorization process (optional).
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
- params[:scope] = params[:scope].join(' ')
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
@@ -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 request
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 - String containing the state value to retain during
375
- # the OAuth authorization process (optional).
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
  #
@@ -1,3 +1,3 @@
1
1
  module Cronofy
2
- VERSION = "0.8.2".freeze
2
+ VERSION = "0.8.3".freeze
3
3
  end
@@ -84,7 +84,8 @@ describe Cronofy::Auth do
84
84
  end
85
85
 
86
86
  describe '#user_auth_link' do
87
- let(:scope_array) { %w{read_events list_calendars create_event} }
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: scope_array, state: state)
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['state'] = state
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.2
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-14 00:00:00.000000000 Z
12
+ date: 2016-04-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: oauth2