ratchetio 0.6.1 → 0.6.3

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.
data/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # Change Log
2
2
 
3
+ **0.6.2**
4
+ - Added EventMachine support
5
+
3
6
  **0.6.1**
4
7
  - Added a log message containing a link to the instance. Copy-paste the link into your browser to view its details in Ratchet.
5
8
  - Ratchetio.report_message now returns 'ignored' or 'error' instead of nil when a message is not reported for one of those reasons, for consistency with Ratchetio.report_exception.
data/README.md CHANGED
@@ -126,11 +126,6 @@ You can supply your own handler using `config.async_handler`. The handler should
126
126
  Make sure you pass `payload` to `Ratchetio.process_payload` in your own implementation.
127
127
 
128
128
 
129
- ## Using with Goalie
130
-
131
- If you're using [Goalie](https://github.com/obvio171/goalie) for custom error pages, you may need to explicitly add `require 'goalie'` to `config/application.rb` (in addition to `require goalie/rails`) so that the monkeypatch will work. (This will be obvious if it is needed because your app won't start up: you'll see a cryptic error message about `Goalie::CustomErrorPages.render_exception` not being defined.)
132
-
133
-
134
129
  ## Using with ratchet-agent
135
130
 
136
131
  For even more asynchrony, you can configure the gem to write to a file instead of sending the payload to Ratchet servers directly. [ratchet-agent](https://github.com/ratchetio/ratchet-agent) can then be hooked up to this file to actually send the payload across. To enable, add the following in `config/initializers/ratchetio.rb`:
@@ -144,6 +139,11 @@ For even more asynchrony, you can configure the gem to write to a file instead o
144
139
  For this to work, you'll also need to set up ratchet-agent--see its docs for details.
145
140
 
146
141
 
142
+ ## Using with Goalie
143
+
144
+ If you're using [Goalie](https://github.com/obvio171/goalie) for custom error pages, you may need to explicitly add `require 'goalie'` to `config/application.rb` (in addition to `require 'goalie/rails'`) so that the monkeypatch will work. (This will be obvious if it is needed because your app won't start up: you'll see a cryptic error message about `Goalie::CustomErrorPages.render_exception` not being defined.)
145
+
146
+
147
147
  ## Using with Resque
148
148
 
149
149
  Check out [resque-ratchetio](https://github.com/CrowdFlower/resque-ratchetio) for using Ratchetio as a failure backend for Resque.
data/THANKS CHANGED
@@ -1,9 +1,10 @@
1
1
  Huge thanks to the following contributors (by github username). For the most up-to-date list, see https://github.com/ratchetio/ratchetio-gem/graphs/contributors
2
2
 
3
3
  arr-ee
4
+ JoshuaOSHickman
4
5
  kavu
5
6
  magnolia-fan
6
7
  mipearson
7
8
  trisweb
8
9
  tysontate
9
- wbond
10
+ wbond
@@ -21,6 +21,7 @@ module Ratchetio
21
21
  attr_accessor :root
22
22
  attr_accessor :scrub_fields
23
23
  attr_accessor :use_async
24
+ attr_accessor :use_eventmachine
24
25
  attr_accessor :web_base
25
26
  attr_accessor :write_to_file
26
27
 
@@ -47,6 +48,12 @@ module Ratchetio
47
48
  @use_async = false
48
49
  @web_base = DEFAULT_WEB_BASE
49
50
  @write_to_file = false
51
+ @use_eventmachine = false
52
+ end
53
+
54
+ def use_eventmachine=(value)
55
+ require 'em-http-request' if value
56
+ @use_eventmachine = value
50
57
  end
51
58
 
52
59
  # allow params to be read like a hash
@@ -1,3 +1,3 @@
1
1
  module Ratchetio
2
- VERSION = "0.6.1"
2
+ VERSION = "0.6.3"
3
3
  end
data/lib/ratchetio.rb CHANGED
@@ -235,9 +235,29 @@ module Ratchetio
235
235
  end
236
236
  end
237
237
 
238
+ def send_payload_using_eventmachine(payload)
239
+ req = EventMachine::HttpRequest.new(configuration.endpoint).post(:body => payload)
240
+ req.callback do
241
+ if req.response_header.status == 200
242
+ logger.info '[Ratchet.io] Success'
243
+ else
244
+ logger.warn "[Ratchet.io] Got unexpected status code from Ratchet.io api: #{req.response_header.status}"
245
+ logger.info "[Ratchet.io] Response: #{req.response}"
246
+ end
247
+ end
248
+ req.errback do
249
+ logger.warn "[Ratchet.io] Call to API failed, status code: #{req.response_header.status}"
250
+ logger.info "[Ratchet.io] Error's response: #{req.response}"
251
+ end
252
+ end
253
+
238
254
  def send_payload(payload)
239
255
  logger.info '[Ratchet.io] Sending payload'
240
-
256
+
257
+ if configuration.use_eventmachine
258
+ send_payload_using_eventmachine(payload)
259
+ return
260
+ end
241
261
  uri = URI.parse(configuration.endpoint)
242
262
  http = Net::HTTP.new(uri.host, uri.port)
243
263
 
data/ratchetio.gemspec CHANGED
@@ -14,9 +14,9 @@ Gem::Specification.new do |gem|
14
14
  gem.require_paths = ["lib"]
15
15
  gem.version = Ratchetio::VERSION
16
16
 
17
- gem.add_runtime_dependency 'multi_json', '~> 1.5.0'
17
+ gem.add_runtime_dependency 'multi_json', '~> 1.5.1'
18
18
 
19
- gem.add_development_dependency 'rails', '~> 3.2.11'
19
+ gem.add_development_dependency 'rails', '~> 3.2.12'
20
20
  gem.add_development_dependency 'devise', '>= 2.1.2'
21
21
  gem.add_development_dependency 'rspec-rails', '~> 2.12.0'
22
22
  gem.add_development_dependency 'database_cleaner', '>= 0.9.1'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ratchetio
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.6.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-01 00:00:00.000000000 Z
12
+ date: 2013-02-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: multi_json
@@ -18,7 +18,7 @@ dependencies:
18
18
  requirements:
19
19
  - - ~>
20
20
  - !ruby/object:Gem::Version
21
- version: 1.5.0
21
+ version: 1.5.1
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - ~>
28
28
  - !ruby/object:Gem::Version
29
- version: 1.5.0
29
+ version: 1.5.1
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: rails
32
32
  requirement: !ruby/object:Gem::Requirement
@@ -34,7 +34,7 @@ dependencies:
34
34
  requirements:
35
35
  - - ~>
36
36
  - !ruby/object:Gem::Version
37
- version: 3.2.11
37
+ version: 3.2.12
38
38
  type: :development
39
39
  prerelease: false
40
40
  version_requirements: !ruby/object:Gem::Requirement
@@ -42,7 +42,7 @@ dependencies:
42
42
  requirements:
43
43
  - - ~>
44
44
  - !ruby/object:Gem::Version
45
- version: 3.2.11
45
+ version: 3.2.12
46
46
  - !ruby/object:Gem::Dependency
47
47
  name: devise
48
48
  requirement: !ruby/object:Gem::Requirement
@@ -278,3 +278,4 @@ test_files:
278
278
  - spec/requests/home_spec.rb
279
279
  - spec/spec_helper.rb
280
280
  - spec/support/devise.rb
281
+ has_rdoc: