zephyr 1.1.0 → 1.1.1

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 +18 -8
  3. data/zephyr.gemspec +2 -2
  4. metadata +13 -13
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.0
1
+ 1.1.1
data/lib/zephyr.rb CHANGED
@@ -1,3 +1,4 @@
1
+ require 'logger'
1
2
  require 'net/http'
2
3
  require 'typhoeus'
3
4
  require 'yajl'
@@ -53,6 +54,19 @@ class Zephyr
53
54
  }
54
55
  end
55
56
 
57
+ class << self
58
+ def logger
59
+ @@logger
60
+ end
61
+
62
+ def logger=(logger)
63
+ @@logger = logger
64
+ end
65
+ end
66
+
67
+ @@logger = Logger.new(STDOUT)
68
+ @@logger.level = Logger::Severity::WARN
69
+
56
70
  # Performs a HEAD request to the specified resource.
57
71
  #
58
72
  # A request to /users/#{@user.id}/things?q=woof with an Accept header of
@@ -268,11 +282,9 @@ class Zephyr
268
282
  response = Typhoeus::Request.send(method, uri(path_components).to_s, params)
269
283
  http_end = Time.now.to_f
270
284
 
271
- if defined?(Rails)
272
- Rails.logger.info "[zephyr:#{$$}:#{Time.now.to_f}] \"%s %s\" %s %0.4f" % [
273
- method.to_s.upcase, uri(path_components).to_s, response.code, (http_end - http_start)
274
- ]
275
- end
285
+ Zephyr.logger.info "[zephyr:#{$$}:#{Time.now.to_f}] \"%s %s\" %s %0.4f" % [
286
+ method.to_s.upcase, uri(path_components).to_s, response.code, (http_end - http_start)
287
+ ]
276
288
 
277
289
  # be consistent with what came before
278
290
  response_headers = Headers.new.tap do |h|
@@ -290,9 +302,7 @@ class Zephyr
290
302
  else
291
303
  response_body = response.timed_out? || response.code == 0 ? "Exceeded #{timeout}ms" : response.body
292
304
  failed_request = FailedRequest.new(method, expect, response.code, response_headers.to_hash, response_body, response.timed_out?)
293
- if defined?(Rails)
294
- Rails.logger.error "[zephyr:#{$$}:#{Time.now.to_f}]: #{ failed_request }"
295
- end
305
+ Zephyr.logger.error "[zephyr:#{$$}:#{Time.now.to_f}]: #{ failed_request }"
296
306
  raise failed_request
297
307
  end
298
308
  end
data/zephyr.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "zephyr"
8
- s.version = "1.1.0"
8
+ s.version = "1.1.1"
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 = "2012-02-16"
12
+ s.date = "2012-02-17"
13
13
  s.description = "Simple HTTP client using Typheous, derived from the Riak client"
14
14
  s.email = "matt.knopp@gmail.com"
15
15
  s.extra_rdoc_files = [
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zephyr
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-02-16 00:00:00.000000000 Z
12
+ date: 2012-02-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: typhoeus
16
- requirement: &70217574635840 !ruby/object:Gem::Requirement
16
+ requirement: &70113484381080 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 0.2.4
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70217574635840
24
+ version_requirements: *70113484381080
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: yajl-ruby
27
- requirement: &70217574635100 !ruby/object:Gem::Requirement
27
+ requirement: &70113484380360 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70217574635100
35
+ version_requirements: *70113484380360
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: bundler
38
- requirement: &70217574634540 !ruby/object:Gem::Requirement
38
+ requirement: &70113484379780 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 1.0.0
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70217574634540
46
+ version_requirements: *70113484379780
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: jeweler
49
- requirement: &70217574633860 !ruby/object:Gem::Requirement
49
+ requirement: &70113484379100 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 1.6.4
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70217574633860
57
+ version_requirements: *70113484379100
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: shoulda
60
- requirement: &70217574633260 !ruby/object:Gem::Requirement
60
+ requirement: &70113484378520 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,7 +65,7 @@ dependencies:
65
65
  version: 2.11.3
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *70217574633260
68
+ version_requirements: *70113484378520
69
69
  description: Simple HTTP client using Typheous, derived from the Riak client
70
70
  email: matt.knopp@gmail.com
71
71
  executables: []
@@ -100,7 +100,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
100
100
  version: '0'
101
101
  segments:
102
102
  - 0
103
- hash: 2954699441524959600
103
+ hash: 13337105164833368
104
104
  required_rubygems_version: !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements: