cb-api 18.2.0 → 18.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +1 -0
- data/lib/cb/client.rb +1 -1
- data/lib/cb/utils/api.rb +11 -7
- data/lib/cb/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 279f56a5617e6962823d462d65ac3e7fc3d75543
|
4
|
+
data.tar.gz: 7a3f895ec2d734ed5fd8c7994550c3a007be6bc8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 890287318dbf8a5a0d726e21b8b73fae56bf669f8b039df202760d8079224344c6df0ca4b19a7be5d450e3fefb6f8f5692c3b57bcceed981767064d6b3bc3bf3
|
7
|
+
data.tar.gz: 221143b862d0e9b4fb76392bbed0491f940420b2546d3acba9cb41977e813f907f24bb404758445847e2daa244e2ea36f6d23e2ca5e5923ef610e12ae93d9079
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,7 @@ Version History
|
|
3
3
|
* All Version bumps are required to update this file as well!!
|
4
4
|
----
|
5
5
|
|
6
|
+
* 18.2.1 No functional changes, just renamed `execute_http_request` to `timed_http_request`.
|
6
7
|
* 18.2.0 Collect API caller info a level above lib/cb/client.rb and get timings on errors as well.
|
7
8
|
* 18.1.0 Adding report a job endpoint
|
8
9
|
* 18.0.2 Updating contact info in the gemspec
|
data/lib/cb/client.rb
CHANGED
data/lib/cb/utils/api.rb
CHANGED
@@ -39,35 +39,39 @@ module Cb
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def cb_get(path, options = {}, &block)
|
42
|
-
|
42
|
+
timed_http_request(:get, nil, path, options, &block)
|
43
43
|
end
|
44
44
|
|
45
45
|
def cb_post(path, options = {}, &block)
|
46
|
-
|
46
|
+
timed_http_request(:post, nil, path, options, &block)
|
47
47
|
end
|
48
48
|
|
49
49
|
def cb_put(path, options = {}, &block)
|
50
|
-
|
50
|
+
timed_http_request(:put, nil, path, options, &block)
|
51
51
|
end
|
52
52
|
|
53
53
|
def cb_delete(path, options = {}, &block)
|
54
|
-
|
54
|
+
timed_http_request(:delete, nil, path, options, &block)
|
55
55
|
end
|
56
56
|
|
57
|
-
def
|
58
|
-
self.class.base_uri(uri || Cb.configuration.base_uri)
|
57
|
+
def timed_http_request(http_method, uri, path, options = {}, &block)
|
59
58
|
api_caller = find_api_caller(caller)
|
60
59
|
response = nil
|
61
60
|
start_time = Time.now.to_f
|
62
61
|
cb_event(:"cb_#{ http_method }_before", path, options, api_caller, response, 0.0, &block)
|
63
62
|
begin
|
64
|
-
response =
|
63
|
+
response = execute_http_request(http_method, uri, path, options)
|
65
64
|
ensure
|
66
65
|
cb_event(:"cb_#{ http_method }_after", path, options, api_caller, response, Time.now.to_f - start_time, &block)
|
67
66
|
end
|
68
67
|
validate_response(response)
|
69
68
|
end
|
70
69
|
|
70
|
+
def execute_http_request(http_method, uri, path, options = {})
|
71
|
+
self.class.base_uri(uri || Cb.configuration.base_uri)
|
72
|
+
self.class.method(http_method).call(path, options)
|
73
|
+
end
|
74
|
+
|
71
75
|
def append_api_responses(obj, resp)
|
72
76
|
meta_class = ensure_non_nil_metavalues(obj)
|
73
77
|
|
data/lib/cb/version.rb
CHANGED