accounts_client 0.2.19 → 0.2.20
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/padma_account.rb +25 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0ec9c2e15ad1385c3b83c3bd893b78502e5a3cb4
|
4
|
+
data.tar.gz: b19b93bdbb94805d48c745f881832a7eb8a7d6ec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5f95d6999e2da511bf5095dfa32c82db53264cae360629b0ff6fd43e4acb7c3f4ca8e3bf65247640154388e97a740740268fb51f3ca88ef9ebd51ce5396d8bfe
|
7
|
+
data.tar.gz: ee4c79e769560964c47ece4bd8791324c720ff17d370ce667969a8195fb6b676fb31b632d6568d2ceafdb48a45d9439aee5b25407c362345dc776ee9a7f7cd9a
|
data/app/models/padma_account.rb
CHANGED
@@ -71,6 +71,31 @@ class PadmaAccount < LogicalModel
|
|
71
71
|
res
|
72
72
|
end
|
73
73
|
|
74
|
+
def access_for_key(key)
|
75
|
+
res = nil
|
76
|
+
# params = { token: Accounts::API_KEY }
|
77
|
+
params = self.class.merge_key({})
|
78
|
+
request = Typhoeus::Request.new("#{self.class.resource_uri}/#{self.name}/api_keys/#{key}", params: params )
|
79
|
+
|
80
|
+
request.on_complete do |response|
|
81
|
+
if response.code == 200
|
82
|
+
self.class.log_ok(response)
|
83
|
+
res = ActiveSupport::JSON.decode(response.body)['access']
|
84
|
+
elsif response.code == 404
|
85
|
+
self.class.log_ok(response)
|
86
|
+
res = nil
|
87
|
+
else
|
88
|
+
self.class.log_failed(response)
|
89
|
+
res = nil
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
self.class.hydra.queue(request)
|
94
|
+
self.class.hydra.run
|
95
|
+
|
96
|
+
res
|
97
|
+
end
|
98
|
+
|
74
99
|
private
|
75
100
|
|
76
101
|
# Accounts-ws uses account name of identification
|
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.2.
|
4
|
+
version: 0.2.20
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dwayne Macgowan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-02-
|
11
|
+
date: 2016-02-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|