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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/app/models/padma_account.rb +25 -0
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c512161b4a4818aed8d61437f05ed2890ddc6899
4
- data.tar.gz: 29f29bdd2bc9ab5666a38f64cdb0205c6bab178d
3
+ metadata.gz: 0ec9c2e15ad1385c3b83c3bd893b78502e5a3cb4
4
+ data.tar.gz: b19b93bdbb94805d48c745f881832a7eb8a7d6ec
5
5
  SHA512:
6
- metadata.gz: 31080f2711a14b564235f6217a314ceecd50ff54335ab00734f38803976bfd9b4dc047894081f616a2a1ef875b1276db6af8ebd435ee90d612ce8bacdf0b88e9
7
- data.tar.gz: 437e5dbcd65874b2365670ad53aa0736a7b9b95ac93f8d5cb8e4715fe2e5f300ddccf4ee90dabda0dbe83e4e89b9beb584b29407e032a2dba5a4f036acae5f3a
6
+ metadata.gz: 5f95d6999e2da511bf5095dfa32c82db53264cae360629b0ff6fd43e4acb7c3f4ca8e3bf65247640154388e97a740740268fb51f3ca88ef9ebd51ce5396d8bfe
7
+ data.tar.gz: ee4c79e769560964c47ece4bd8791324c720ff17d370ce667969a8195fb6b676fb31b632d6568d2ceafdb48a45d9439aee5b25407c362345dc776ee9a7f7cd9a
@@ -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.19
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-16 00:00:00.000000000 Z
11
+ date: 2016-02-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties