wes-data-api 10.0.2 → 10.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/wes/data/api/client.rb +19 -4
- data/lib/wes/data/api.rb +1 -1
- 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: ef1bbc3cd67b946c94a9415da458be03fea379e4
|
4
|
+
data.tar.gz: 3f0234ade268431243b64f60df922c512e13ee2e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 58a2bb577049995012e4fcf33919f817d3e089f4b169b4dbba541d7af2054c1a47417a46327d76017a24fea8fada82e6c49846652da44b157776577fd94a5b95
|
7
|
+
data.tar.gz: d65368cc9ae0b6135014120e69c0adad607a998eb36e9f0ec0f944b364fc8a69c7db1c34109e0154129148969257fd650c7636b3f2ec1a79ed17316dc99dfb66
|
data/lib/wes/data/api/client.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'logger'
|
1
2
|
require 'wes/data/api/request'
|
2
3
|
require 'wes/data/api/response'
|
3
4
|
|
@@ -6,27 +7,33 @@ module Wes
|
|
6
7
|
module API
|
7
8
|
class Client
|
8
9
|
def get(path)
|
9
|
-
api_response = request.get(path)
|
10
|
+
api_response = time_method(path, 'GET') { request.get(path) }
|
10
11
|
response(api_response)
|
11
12
|
end
|
12
13
|
|
13
14
|
def post(path, options)
|
14
|
-
api_response =
|
15
|
+
api_response = time_method(path, 'POST') do
|
16
|
+
request.post(path, options)
|
17
|
+
end
|
15
18
|
response(api_response)
|
16
19
|
end
|
17
20
|
|
18
21
|
def put(path, options)
|
19
|
-
api_response = request.put(path, options)
|
22
|
+
api_response = time_method(path, 'PUT') { request.put(path, options) }
|
20
23
|
response(api_response)
|
21
24
|
end
|
22
25
|
|
23
26
|
def delete(path)
|
24
|
-
api_response = request.delete(path)
|
27
|
+
api_response = time_method(path, 'DELETE') { request.delete(path) }
|
25
28
|
response(api_response)
|
26
29
|
end
|
27
30
|
|
28
31
|
private
|
29
32
|
|
33
|
+
def log
|
34
|
+
@log ||= ::Logger.new(STDOUT)
|
35
|
+
end
|
36
|
+
|
30
37
|
def request
|
31
38
|
Request
|
32
39
|
end
|
@@ -34,6 +41,14 @@ module Wes
|
|
34
41
|
def response(api_response)
|
35
42
|
Response.new(api_response).build
|
36
43
|
end
|
44
|
+
|
45
|
+
def time_method(path, type)
|
46
|
+
start_time = Time.now
|
47
|
+
result = yield
|
48
|
+
end_time = Time.now
|
49
|
+
log.info("[WDA] #{type} \"/v1/#{path}\" #{end_time - start_time}s")
|
50
|
+
result
|
51
|
+
end
|
37
52
|
end
|
38
53
|
end
|
39
54
|
end
|
data/lib/wes/data/api.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wes-data-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 10.0
|
4
|
+
version: 10.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ''
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-07-
|
11
|
+
date: 2016-07-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|