cb-api 18.1.0 → 18.2.0

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: fd9955d0ae203d1d2aa704d67a0472d092a471a6
4
- data.tar.gz: 97019dd5061c292b061aa0351b05fb787fab79bd
3
+ metadata.gz: 4422245ed4eaaac2561e4f9ec9c18078f992bd34
4
+ data.tar.gz: d14f587db18a9feeaaed78f1b8b9c4add9caaa49
5
5
  SHA512:
6
- metadata.gz: 45c01620e0e656308309d478360bdb8311c3fc70bb29b8d87ef723c5d6244a772eedd5d3fac042da60f063d5a90f78778568b1e091c2d1eaa339ab09080619ec
7
- data.tar.gz: d5891a94017457bb3933527d54d852749bfdfb36137515d4ba51cdf4d9e99f61d71b769c630de9f514ed5fb9ca9407567462ae695140972f5bc0b7c83d425d4f
6
+ metadata.gz: d065b64369a899f2212bbd8844e18765dd8a89a82e8e3adb908909a97a733be65ced6310ef3ecb7fd72bf646b58e3b8002ab83a2f4988db354ff7776da1e76f9
7
+ data.tar.gz: 46dcd4006752094bc49d8e520bdaf646f7e76b0e2b75353d6dfdb2fdeb5e39144340614ef3d2d2fdb6c98216dc601df20830a2910558824517b4c95e5432c8e9
@@ -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
@@ -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, nil, 0.0, &block)
62
- response = self.class.method(http_method).call(path, options)
63
- cb_event(:"cb_#{ http_method }_after", path, options, api_caller, response, Time.now.to_f - start_time, &block)
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] != __FILE__ }[0..-2].split(linenum_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)
@@ -9,5 +9,5 @@
9
9
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
10
  # See the License for the specific language governing permissions and limitations under the License.
11
11
  module Cb
12
- VERSION = '18.1.0'
12
+ VERSION = '18.2.0'
13
13
  end
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.1.0
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-14 00:00:00.000000000 Z
11
+ date: 2015-09-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty