accounts_client 0.2.20 → 0.2.21
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 +17 -0
- data/app/models/padma_account.rb +0 -25
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: afdba6c320cc40e3df1ae666a73b84a7cec22508
|
4
|
+
data.tar.gz: 80e253aec3393a4b2c745ad3a83aebe4d0fa8d82
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d626eb0aea805df4f527e86016ad40cc26d6787be0194e544dfa5dfcdc820cdca484b6da5fb06c022fe455fd91407b0733b8ba489604ccd674b6d9f9a499d97b
|
7
|
+
data.tar.gz: fe40281fbecd3414e82cd2489d9fac3c869e976e935ae225a59bca002ac541dcbd8f0497015db16cd281548d3251640eae1ddbaa56eabe07d5e0d0195914a41d
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class ApiKey < LogicalModel
|
2
|
+
use_hydra Accounts::HYDRA
|
3
|
+
set_resource_host Accounts::HOST
|
4
|
+
set_resource_path "/v0/api_keys"
|
5
|
+
|
6
|
+
attribute :account_name
|
7
|
+
attribute :access
|
8
|
+
|
9
|
+
set_api_key 'token', Accounts::API_KEY
|
10
|
+
|
11
|
+
TIMEOUT = 5500 # milisecons
|
12
|
+
PER_PAGE = 9999
|
13
|
+
|
14
|
+
def json_root
|
15
|
+
'api_key'
|
16
|
+
end
|
17
|
+
end
|
data/app/models/padma_account.rb
CHANGED
@@ -71,31 +71,6 @@ 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
|
-
|
99
74
|
private
|
100
75
|
|
101
76
|
# 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.21
|
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-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -60,6 +60,7 @@ extensions: []
|
|
60
60
|
extra_rdoc_files: []
|
61
61
|
files:
|
62
62
|
- app/helpers/encoding_helper.rb
|
63
|
+
- app/models/api_key.rb
|
63
64
|
- app/models/padma_account.rb
|
64
65
|
- app/models/padma_user.rb
|
65
66
|
- app/models/petal_subscription.rb
|