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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 2e7d9ce3ab0387a5e6ff63bfa9990b2ecb552e8e
4
- data.tar.gz: 4700e039564f3df38017eec44876359cc643176a
2
+ SHA256:
3
+ metadata.gz: d7a736720a2d9f231fb757c7767ff7dd05ee633bd82ded34f287b62e70e68d50
4
+ data.tar.gz: 554ceff89e95f6d17ab858de8e208d0ccd6dea50ed858b9cec3a34560ff2b848
5
5
  SHA512:
6
- metadata.gz: cc4856103fb5ae49308bb88e0a6de6066a9d21aad931bca50f51843fe9548ca0781d5aa29b87c8617a97864b67c667e63d9066e132f0382eb36af0c6c5e0642f
7
- data.tar.gz: 80aef30e6b13fdf3cd524d1216b1cfc64eeb12f982cc4af6f093495096ecdcf2b9d486c8f0303d6110e21b458df76e4589edaba087ac02f6aa16e19eafe5b18c
6
+ metadata.gz: 334d59c406ebc1cf339c7307d30bd0901330ac1b3e18014a5ef6383350e27bdc855d669700dcb6eecf180c2ed4206595e4dee2b0827d97c4d74619f9f3ae283a
7
+ data.tar.gz: a54c48e1b0d011f7b7b0910398e9cd14c0bbccc8512a7429149becad01fae1fa6fe0e567923a8852318595283fb0ef25bd7af32f728ae95a1a05335145f2dd9d
@@ -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 = 10.freeze
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': "Bearer #{bearer_token}",
37
- 'Content-Type': 'application/vnd.api+json'
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",
@@ -5,8 +5,8 @@ module Capcoauth
5
5
 
6
6
  module VERSION
7
7
  MAJOR = 0
8
- MINOR = 5
9
- PATCH = 1
8
+ MINOR = 6
9
+ PATCH = 0
10
10
 
11
11
  STRING = [MAJOR, MINOR, PATCH].compact.join(".")
12
12
  end
@@ -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
@@ -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.5.1
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: 2017-10-03 00:00:00.000000000 Z
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.6.7
259
+ rubygems_version: 2.7.8
260
260
  signing_key:
261
261
  specification_version: 4
262
262
  summary: Integration with Capcoauth authentication service