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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a1b874c9b36a96129a21efdb2d1e4edae1a57e21
4
- data.tar.gz: d668810e699a362ebd4a633dd07678d48db876fd
3
+ metadata.gz: ef1bbc3cd67b946c94a9415da458be03fea379e4
4
+ data.tar.gz: 3f0234ade268431243b64f60df922c512e13ee2e
5
5
  SHA512:
6
- metadata.gz: 4e12b1c53813b209f906d636b116cf49d9557adec07031e6f5721015dcbcaa4c0f8e1f8c50e8629b07737091db0399a6f1122e4557fb614e2ef654305f740200
7
- data.tar.gz: 54f23deeb8a621e7baf3c1876079477e77027a19507eb60611f53ede57b1a905ad3d6a55f38676ddf561d805a62cdfa5d4d9cd2f3cc2576e226a185983abaff6
6
+ metadata.gz: 58a2bb577049995012e4fcf33919f817d3e089f4b169b4dbba541d7af2054c1a47417a46327d76017a24fea8fada82e6c49846652da44b157776577fd94a5b95
7
+ data.tar.gz: d65368cc9ae0b6135014120e69c0adad607a998eb36e9f0ec0f944b364fc8a69c7db1c34109e0154129148969257fd650c7636b3f2ec1a79ed17316dc99dfb66
@@ -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 = request.post(path, options)
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
@@ -5,7 +5,7 @@ require 'wes/data/api/configuration'
5
5
  module Wes
6
6
  module Data
7
7
  module API
8
- VERSION = '10.0.2'.freeze
8
+ VERSION = '10.1.0'.freeze
9
9
  end
10
10
  end
11
11
  end
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.2
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-13 00:00:00.000000000 Z
11
+ date: 2016-07-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler