aitu-wallet 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/aitu_wallet/client.rb +14 -10
- data/lib/aitu_wallet/version.rb +1 -1
- 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: 50f56be2eb2c5b736bfcf67261c4116162fa34dd421ac6bed2845d319010005d
|
4
|
+
data.tar.gz: 7808f737f9fca6d7dfb8aa5b06ba0daf5c21571154555f319f99e6c8b21d923d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 917169696555a3d7e3301e77dfe5347b6cb071f27be0b19b7a269bc2ee0a287de52eabcb4b94a61e0f5bcdcdaa30ebc4727f961db0758a0d23fb94862ef41b7f
|
7
|
+
data.tar.gz: 69695e6dfb8582baff1521f05d95919ef246d54c82a750b31535574116228e9226af99750fd3acbf866e912a0453f56810d624eaddeb3afd667a6ca62f152381
|
data/lib/aitu_wallet/client.rb
CHANGED
@@ -14,25 +14,29 @@ module AituWallet
|
|
14
14
|
}
|
15
15
|
# Client to send Aitu Wallet requests
|
16
16
|
class Client
|
17
|
-
attr_accessor :handler, :
|
17
|
+
attr_accessor :handler, :auth_headers
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
@
|
19
|
+
# creates connection to Aitu Wallet endpoints and sets basic auth headers
|
20
|
+
def initialize(login, password)
|
21
|
+
@handler = Faraday.new(BASE_URL)
|
22
|
+
@handler.basic_auth(login, password)
|
22
23
|
end
|
23
24
|
|
24
25
|
def get_user_info(phone)
|
25
|
-
|
26
|
-
response = @handler.get(url, headers: @headers)
|
27
|
-
JSON.parse(response) if response
|
26
|
+
get_request(ENDPOINTS[:user] + "/#{phone}")
|
28
27
|
end
|
29
28
|
|
30
29
|
private
|
31
30
|
|
32
|
-
def
|
33
|
-
|
31
|
+
def get_request(url)
|
32
|
+
response = @handler.get(url)
|
34
33
|
|
35
|
-
|
34
|
+
begin
|
35
|
+
JSON.parse(response.body) if response
|
36
|
+
rescue JSON::ParserError
|
37
|
+
puts "Not JSON body returned"
|
38
|
+
nil
|
39
|
+
end
|
36
40
|
end
|
37
41
|
end
|
38
42
|
end
|
data/lib/aitu_wallet/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aitu-wallet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yaroslav Shevchenko
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-03-
|
11
|
+
date: 2022-03-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|