capcoauth 0.5.1 → 0.6.0
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 +5 -5
- data/lib/capcoauth/config.rb +4 -2
- data/lib/capcoauth/notifications.rb +4 -2
- data/lib/capcoauth/version.rb +2 -2
- data/lib/generators/capcoauth/templates/initializer.rb +3 -0
- data/spec/lib/config_spec.rb +12 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: d7a736720a2d9f231fb757c7767ff7dd05ee633bd82ded34f287b62e70e68d50
|
4
|
+
data.tar.gz: 554ceff89e95f6d17ab858de8e208d0ccd6dea50ed858b9cec3a34560ff2b848
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 334d59c406ebc1cf339c7307d30bd0901330ac1b3e18014a5ef6383350e27bdc855d669700dcb6eecf180c2ed4206595e4dee2b0827d97c4d74619f9f3ae283a
|
7
|
+
data.tar.gz: a54c48e1b0d011f7b7b0910398e9cd14c0bbccc8512a7429149becad01fae1fa6fe0e567923a8852318595283fb0ef25bd7af32f728ae95a1a05335145f2dd9d
|
data/lib/capcoauth/config.rb
CHANGED
@@ -20,7 +20,7 @@ module Capcoauth
|
|
20
20
|
|
21
21
|
class Config
|
22
22
|
CAPCOAUTH_URL_DEFAULT = 'https://capcoauth.capco.com'.freeze
|
23
|
-
TOKEN_VERIFY_TTL_DEFAULT =
|
23
|
+
TOKEN_VERIFY_TTL_DEFAULT = 60.freeze
|
24
24
|
|
25
25
|
class Builder
|
26
26
|
def initialize(&block)
|
@@ -35,6 +35,7 @@ module Capcoauth
|
|
35
35
|
@config.user_id_field = :capcoauth
|
36
36
|
@config.cache_store = ::ActiveSupport::Cache::MemoryStore.new
|
37
37
|
@config.require_user = true
|
38
|
+
@config.send_notifications = false
|
38
39
|
|
39
40
|
# Evaluate configuration block
|
40
41
|
@config.instance_eval(&block)
|
@@ -53,7 +54,8 @@ module Capcoauth
|
|
53
54
|
:user_id_field,
|
54
55
|
:cache_store,
|
55
56
|
:user_resolver,
|
56
|
-
:require_user
|
57
|
+
:require_user,
|
58
|
+
:send_notifications
|
57
59
|
|
58
60
|
def client_id
|
59
61
|
@client_id || raise(MissingRequiredOptionError, 'Missing required option `client_id`')
|
@@ -33,8 +33,8 @@ module Capcoauth
|
|
33
33
|
|
34
34
|
def default_headers
|
35
35
|
{
|
36
|
-
'Authorization'
|
37
|
-
'Content-Type'
|
36
|
+
:'Authorization' => "Bearer #{bearer_token}",
|
37
|
+
:'Content-Type'=>'application/vnd.api+json'
|
38
38
|
}
|
39
39
|
end
|
40
40
|
|
@@ -77,6 +77,8 @@ module Capcoauth
|
|
77
77
|
end
|
78
78
|
|
79
79
|
def notify(user_id, alert=nil, badge=nil, data={})
|
80
|
+
return false unless Capcoauth.configuration.send_notifications
|
81
|
+
|
80
82
|
data = JSON.generate data
|
81
83
|
res = self.post(
|
82
84
|
"#{Capcoauth.configuration.capcoauth_url}/api/v1/user_notifications",
|
data/lib/capcoauth/version.rb
CHANGED
@@ -41,4 +41,7 @@ Capcoauth.configure do |config|
|
|
41
41
|
|
42
42
|
# Don't redirect to last URL on login since we don't want to see API responses
|
43
43
|
# config.perform_login_redirects = true
|
44
|
+
|
45
|
+
# Send push notifications (good to make this dependent on your environment)
|
46
|
+
# config.send_notifications = true
|
44
47
|
end
|
data/spec/lib/config_spec.rb
CHANGED
@@ -212,4 +212,16 @@ describe Capcoauth::Config do
|
|
212
212
|
subject.require_user = true
|
213
213
|
end
|
214
214
|
end
|
215
|
+
|
216
|
+
describe 'send_notifications' do
|
217
|
+
it 'has value true by default' do
|
218
|
+
expect(subject.send_notifications).to be_truthy
|
219
|
+
end
|
220
|
+
it 'can be updated to false' do
|
221
|
+
subject.require_user = false
|
222
|
+
expect(subject.send_notifications).to be_falsey
|
223
|
+
subject.require_user = true
|
224
|
+
expect(subject.send_notifications).to be_truthy
|
225
|
+
end
|
226
|
+
end
|
215
227
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capcoauth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Robertson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-04-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -256,7 +256,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
256
256
|
version: '0'
|
257
257
|
requirements: []
|
258
258
|
rubyforge_project:
|
259
|
-
rubygems_version: 2.
|
259
|
+
rubygems_version: 2.7.8
|
260
260
|
signing_key:
|
261
261
|
specification_version: 4
|
262
262
|
summary: Integration with Capcoauth authentication service
|