accounts_client 0.3.1 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/api_key.rb +25 -0
- data/app/models/padma_user.rb +10 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 813ef1d64d157cf2ef57d636fbc49726a52b7746ede1e766fa1dd6279b4dac76
|
4
|
+
data.tar.gz: b883c131d79fb12ee9cadb3365a06e5e032fdc8a9f9a25cccfc4a8c7804c8b65
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d6fb932f34152abe7088b0775cc6f8e1adf8e9de0181eb8c90b62fe624feda507e625cd5de74c0079bf06888a0b0075345215174ff9790b5857ef4403c85ad4c
|
7
|
+
data.tar.gz: bbd544922e9c03ed167754577c87f957837431451e068021d59ed6cb4f6a01814faa31ac98ef36ddf9569e473535b444b219b1049d3811d5a040e1a14189ed36
|
data/app/models/api_key.rb
CHANGED
@@ -13,6 +13,31 @@ class ApiKey < LogicalModel
|
|
13
13
|
TIMEOUT = 5500 # milisecons
|
14
14
|
PER_PAGE = 9999
|
15
15
|
|
16
|
+
def self.find(id, params={})
|
17
|
+
Rails.logger.warn "ApiKey.find is deprecated. Use ApiKey.check instead"
|
18
|
+
self.check(id, params)
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.check(key, params={})
|
22
|
+
res = nil
|
23
|
+
params = self.merge_key(params).merge({api_key: key})
|
24
|
+
request = Typhoeus::Request.new("#{resource_uri}/check", params: params )
|
25
|
+
|
26
|
+
request.on_complete do |response|
|
27
|
+
if response.code >= 200 && response.code < 400
|
28
|
+
log_ok(response)
|
29
|
+
res = self.new.from_json(response.body)
|
30
|
+
else
|
31
|
+
log_failed(response)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
self.hydra.queue(request)
|
36
|
+
self.hydra.run
|
37
|
+
|
38
|
+
res
|
39
|
+
end
|
40
|
+
|
16
41
|
def json_root
|
17
42
|
'api_key'
|
18
43
|
end
|
data/app/models/padma_user.rb
CHANGED
@@ -31,6 +31,16 @@ class PadmaUser < LogicalModel
|
|
31
31
|
TIMEOUT = 5500 # milisecons
|
32
32
|
PER_PAGE = 9999
|
33
33
|
|
34
|
+
IGNORED_USERNAMES = %W(system gympass)
|
35
|
+
|
36
|
+
def self.find(id, params = {})
|
37
|
+
if id.in?(IGNORED_USERNAMES)
|
38
|
+
nil
|
39
|
+
else
|
40
|
+
super(id, params)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
34
44
|
def self.find_with_rails_cache(username,options = {})
|
35
45
|
pu = Rails.cache.read([username,"padma_user"])
|
36
46
|
if pu.nil? || options[:refresh]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: accounts_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dwayne Macgowan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-09-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|