zephyr 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/VERSION +1 -1
  2. data/lib/zephyr.rb +12 -4
  3. data/zephyr.gemspec +2 -2
  4. metadata +4 -4
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.2
1
+ 1.0.3
data/lib/zephyr.rb CHANGED
@@ -263,10 +263,14 @@ class Zephyr
263
263
  end
264
264
 
265
265
  # request has class methods for :delete, :get, :head, :put, and :post
266
- response = Typhoeus::Request.send(method, uri(path_components).to_s, params)
266
+ http_start = Time.now.to_f
267
+ response = Typhoeus::Request.send(method, uri(path_components).to_s, params)
268
+ http_end = Time.now.to_f
267
269
 
268
270
  if defined?(Rails)
269
- Rails.logger.info "lib/http.rb: #{method.to_s.upcase} #{uri(path_components).to_s}"
271
+ Rails.logger.info "[zephyr]: \"%s %s\" %s %0.4f" % [
272
+ method.to_s.upcase, uri(path_components).to_s, response.code, (http_end - http_start)
273
+ ]
270
274
  end
271
275
 
272
276
  # be consistent with what came before
@@ -283,8 +287,12 @@ class Zephyr
283
287
  end
284
288
  result
285
289
  else
286
- response_body = response.timed_out? || response.code == 0 ? "Exceeded #{timeout}ms" : response.body
287
- raise FailedRequest.new(method, expect, response.code, response_headers.to_hash, response_body, response.timed_out?)
290
+ response_body = response.timed_out? || response.code == 0 ? "Exceeded #{timeout}ms" : response.body
291
+ failed_request = FailedRequest.new(method, expect, response.code, response_headers.to_hash, response_body, response.timed_out?)
292
+ if defined?(Rails)
293
+ Rails.logger.error "[zephyr]: #{ failed_request }"
294
+ end
295
+ raise failed_request
288
296
  end
289
297
  end
290
298
 
data/zephyr.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{zephyr}
8
- s.version = "1.0.2"
8
+ s.version = "1.0.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Matt Knopp"]
12
- s.date = %q{2011-10-03}
12
+ s.date = %q{2011-10-06}
13
13
  s.description = %q{Simple HTTP client using Typheous, derived from the Riak client}
14
14
  s.email = %q{matt.knopp@gmail.com}
15
15
  s.extra_rdoc_files = [
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zephyr
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 17
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 2
10
- version: 1.0.2
9
+ - 3
10
+ version: 1.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Matt Knopp
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-10-03 00:00:00 -07:00
18
+ date: 2011-10-06 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency