card-mod-api_key 0.12.0 → 0.13.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
  SHA256:
3
- metadata.gz: a91e9b7cd1807138f2b25ab7d3490bbbbdf2222b5af29df3110af4a5a01a5d80
4
- data.tar.gz: bb175ad1c31ef56832695d0c6ca6dfca652018679df8b0c1ccfd58121fd4238b
3
+ metadata.gz: e9822f719c1166831d0eec0ead0b1403845839a4eaade9758686ae47906347fd
4
+ data.tar.gz: 52517786e557d599c767dccb91986056e4df9395ea9fc29483e4830dcdba5a47
5
5
  SHA512:
6
- metadata.gz: ab06f85bc2b919a68b449fe25fec65b30f4d6aa6db3f2e8b3622c96ae089179cbabbfc73817a7df2855e195d8422bef93fe12717c9f9391672237bc9740a1401
7
- data.tar.gz: 23aef24525a891b02ebbb4518fa897adb263cbff4af42df0d72ffa301323b22b16994afd6fed380fdb24cfb56abf3dd5529bc73f27ee321a32a044b81a3226e1
6
+ metadata.gz: 813c5cd3ca3f865eae51c66e8f5d5548cfb7ee0d4c6e2c66212475e03fe8ffdc687e1cad722ca982e1702327845ba7bb077093f4db700f1e17421d4c4d32a40b
7
+ data.tar.gz: c7aa1dd2d13e3e793d91883df8a5a27f7d5bda29117d37b2eb8640596c7b52fff484e2298867fc77b81198957a42964da0c95b3c72fe8328202c64b5d2b65d80
@@ -4,11 +4,11 @@ class Card
4
4
  module Auth
5
5
  # methods for setting current account
6
6
  module ApiKey
7
- def signin_with opts={}
8
- if opts[:token]
9
- signin_with_token opts[:token]
10
- elsif opts[:api_key]
11
- signin_with_api_key opts[:api_key]
7
+ def signin_with token: nil, api_key: nil
8
+ if token
9
+ signin_with_token token
10
+ elsif api_key
11
+ signin_with_api_key api_key
12
12
  else
13
13
  signin_with_session
14
14
  end
@@ -0,0 +1,12 @@
1
+ class CardController
2
+ # add support for passing api key through header using X-API-Key
3
+ module ApiKey
4
+ def authenticators
5
+ super.merge api_key: api_key_from_header || params[:api_key]
6
+ end
7
+
8
+ def api_key_from_header
9
+ request.headers["X-API-Key"]
10
+ end
11
+ end
12
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: card-mod-api_key
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.0
4
+ version: 0.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ethan McCutchen
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2021-07-05 00:00:00.000000000 Z
13
+ date: 2021-08-06 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: card
@@ -18,28 +18,28 @@ dependencies:
18
18
  requirements:
19
19
  - - '='
20
20
  - !ruby/object:Gem::Version
21
- version: 1.102.0
21
+ version: 1.103.0
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
26
  - - '='
27
27
  - !ruby/object:Gem::Version
28
- version: 1.102.0
28
+ version: 1.103.0
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: card-mod-account
31
31
  requirement: !ruby/object:Gem::Requirement
32
32
  requirements:
33
33
  - - '='
34
34
  - !ruby/object:Gem::Version
35
- version: 0.12.0
35
+ version: 0.13.0
36
36
  type: :runtime
37
37
  prerelease: false
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
40
40
  - - '='
41
41
  - !ruby/object:Gem::Version
42
- version: 0.12.0
42
+ version: 0.13.0
43
43
  description: ''
44
44
  email:
45
45
  - info@decko.org
@@ -48,8 +48,8 @@ extensions: []
48
48
  extra_rdoc_files: []
49
49
  files:
50
50
  - README.md
51
- - config/initializers/api_key.rb
52
51
  - lib/card/auth/api_key.rb
52
+ - lib/card_controller/api_key.rb
53
53
  - set/right/account.rb
54
54
  - set/right/api_key.rb
55
55
  - set/right/api_key/core.haml
@@ -78,7 +78,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
78
78
  - !ruby/object:Gem::Version
79
79
  version: '0'
80
80
  requirements: []
81
- rubygems_version: 3.2.15
81
+ rubygems_version: 3.1.6
82
82
  signing_key:
83
83
  specification_version: 4
84
84
  summary: API Keys and JWT Tokens for Decko
@@ -1,3 +0,0 @@
1
- # Adds {Card::Auth::ApiKey} methods to Card::Auth class
2
-
3
- Card::Auth.extend Card::Auth::ApiKey