cb-api 18.1.0 → 18.2.0
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/utils/api.rb +12 -4
- data/lib/cb/version.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: 4422245ed4eaaac2561e4f9ec9c18078f992bd34
|
4
|
+
data.tar.gz: d14f587db18a9feeaaed78f1b8b9c4add9caaa49
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d065b64369a899f2212bbd8844e18765dd8a89a82e8e3adb908909a97a733be65ced6310ef3ecb7fd72bf646b58e3b8002ab83a2f4988db354ff7776da1e76f9
|
7
|
+
data.tar.gz: 46dcd4006752094bc49d8e520bdaf646f7e76b0e2b75353d6dfdb2fdeb5e39144340614ef3d2d2fdb6c98216dc601df20830a2910558824517b4c95e5432c8e9
|
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.0 Collect API caller info a level above lib/cb/client.rb and get timings on errors as well.
|
6
7
|
* 18.1.0 Adding report a job endpoint
|
7
8
|
* 18.0.2 Updating contact info in the gemspec
|
8
9
|
* 18.0.1 Adding job search version 3 query parameters
|
data/lib/cb/utils/api.rb
CHANGED
@@ -57,10 +57,14 @@ module Cb
|
|
57
57
|
def execute_http_request(http_method, uri, path, options = {}, &block)
|
58
58
|
self.class.base_uri(uri || Cb.configuration.base_uri)
|
59
59
|
api_caller = find_api_caller(caller)
|
60
|
+
response = nil
|
60
61
|
start_time = Time.now.to_f
|
61
|
-
cb_event(:"cb_#{ http_method }_before", path, options, api_caller,
|
62
|
-
|
63
|
-
|
62
|
+
cb_event(:"cb_#{ http_method }_before", path, options, api_caller, response, 0.0, &block)
|
63
|
+
begin
|
64
|
+
response = self.class.method(http_method).call(path, options)
|
65
|
+
ensure
|
66
|
+
cb_event(:"cb_#{ http_method }_after", path, options, api_caller, response, Time.now.to_f - start_time, &block)
|
67
|
+
end
|
64
68
|
validate_response(response)
|
65
69
|
end
|
66
70
|
|
@@ -115,11 +119,15 @@ module Cb
|
|
115
119
|
def find_api_caller(call_list)
|
116
120
|
filename_regex = /.*\.rb/
|
117
121
|
linenum_regex = /:.*:in `/
|
118
|
-
filename, method_name = call_list.find { |l| l[filename_regex]
|
122
|
+
filename, method_name = call_list.find { |l| use_this_api_caller?(l[filename_regex]) }[0..-2].split(linenum_regex)
|
119
123
|
simplified_filename = filename.include?('/lib/') ? filename[/\/lib\/.*/] : filename
|
120
124
|
{ file: simplified_filename, method: method_name }
|
121
125
|
end
|
122
126
|
|
127
|
+
def use_this_api_caller?(calling_file)
|
128
|
+
(calling_file == __FILE__ || calling_file.include?('/lib/cb/client.rb')) ? false : true
|
129
|
+
end
|
130
|
+
|
123
131
|
def validate_response(response)
|
124
132
|
validated_response = ResponseValidator.validate(response)
|
125
133
|
set_api_error(validated_response)
|
data/lib/cb/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cb-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 18.
|
4
|
+
version: 18.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- The CareerBuilder.com Niche and Consumer Development teams
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-09-
|
11
|
+
date: 2015-09-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|