brocade_vrouter 0.1.4 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 850f082f5c5d1b675545f8f622287feb75b13c4c
4
- data.tar.gz: f69299aa6a4a5f328a1b4406282d00cb0297c9dd
3
+ metadata.gz: 7847e3dde2a00e6b23b36f934f6250d6980d3f04
4
+ data.tar.gz: 485f56679feee4e30fed580d2f785a6585f080f3
5
5
  SHA512:
6
- metadata.gz: b638c3a1a40d2aa5991220ac9cb112affc7f8b4e92a5f8a57aed9f5c711fa5fc90e5abbf1b16885d6e53bf305395a864fee0695b5cd0fdd0c9f9a5f144eb8ddc
7
- data.tar.gz: 268157e2b92c1d63f5e9d9d74efbebd8d5e3440fd9fbd8c224ca61d2121d4fe5aba93ad12df39af64dc4803db3d0a65288572e6de82151b34628873d7cf58e86
6
+ metadata.gz: 1469fd57b138770ae14cbacb52bc96748eb47c93b4727a61fa04b75ededd4dfc31bda355976f3ba3988d4ffc810e6f1cbc6d1124b55d95df09a6338e597648f8
7
+ data.tar.gz: 6acb565d24bc6f4f1dcd716674c8844272a4170f377da1b05e1adc0bc1e35b593406827ecc242de739abd63975f0989d42140a8e5d6d6c38a16fbeacdb8b9831
@@ -12,7 +12,10 @@ module BrocadeVRouter
12
12
  end
13
13
 
14
14
  def base_path
15
- @base_path ||= handle_response(connection.post CONF_PATH).headers['location']
15
+ @base_path ||= begin
16
+ handle_request :post, CONF_PATH
17
+ handle_response(connection.post CONF_PATH).headers['location']
18
+ end
16
19
  end
17
20
 
18
21
  def perform(&blk)
@@ -22,7 +25,9 @@ module BrocadeVRouter
22
25
 
23
26
  def set(paths = nil, &blk)
24
27
  res = build_paths(paths, &blk).map do |p|
25
- handle_response connection.put("#{base_path}/set/#{p}")
28
+ path = "#{base_path}/set/#{p}"
29
+ handle_request :put, path
30
+ handle_response connection.put path
26
31
  end
27
32
 
28
33
  res.size > 1 ? res : res.first
@@ -30,7 +35,9 @@ module BrocadeVRouter
30
35
 
31
36
  def get(paths = nil, &blk)
32
37
  all_res = build_paths(paths, &blk).map do |p|
33
- res = handle_response connection.get "#{base_path}/#{p}"
38
+ path = "#{base_path}/#{p}"
39
+ handle_request :get, path
40
+ res = handle_response connection.get path
34
41
  res.success? ? MultiJson.load(res.body) : nil
35
42
  end
36
43
 
@@ -39,21 +46,28 @@ module BrocadeVRouter
39
46
 
40
47
  def delete(paths = nil, &blk)
41
48
  res = build_paths(paths, &blk).map do |p|
42
- handle_response connection.put "#{base_path}/delete/#{p}"
49
+ path = "#{base_path}/delete/#{p}"
50
+ handle_request :put, path
51
+ handle_response connection.put path
43
52
  end
44
53
 
45
54
  res.size > 1 ? res : res.first
46
55
  end
47
56
 
48
57
  def commit(path = nil)
49
- handle_response connection.post "#{path || base_path}/commit"
58
+ req_path = "#{path || base_path}/commit"
59
+ handle_request :post, req_path
60
+ handle_response connection.post req_path
50
61
  end
51
62
 
52
63
  def save(path = nil)
53
- handle_response connection.post "#{path || base_path}/save"
64
+ req_path = "#{path || base_path}/save"
65
+ handle_request :post, req_path
66
+ handle_response connection.post req_path
54
67
  end
55
68
 
56
69
  def close(path = nil)
70
+ handle_request :delete, path || base_path
57
71
  handle_response connection.delete(path || base_path)
58
72
  end
59
73
 
@@ -77,6 +91,11 @@ module BrocadeVRouter
77
91
 
78
92
  private
79
93
 
94
+ def handle_request(method, path)
95
+ message = "#{method.to_s.upcase} #{connection.url_prefix}#{path}"
96
+ logger.info message if logger
97
+ end
98
+
80
99
  def handle_response(resp)
81
100
  @last_response = resp
82
101
 
@@ -1,3 +1,3 @@
1
1
  module BrocadeVRouter
2
- VERSION = '0.1.4'
2
+ VERSION = '0.1.5'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brocade_vrouter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Konstantin Kosmatov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-27 00:00:00.000000000 Z
11
+ date: 2016-05-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday