em-campfire 1.1.0 → 1.1.1

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/README.md CHANGED
@@ -1,3 +1,5 @@
1
+ [![Build Status](https://secure.travis-ci.org/wjessop/em-campfire.png?branch=master)](https://travis-ci.org/wjessop/em-campfire)
2
+
1
3
  em-campfire is a library for interacting with the [Campfire](http://campfirenow.com/) chat application. It was extracted from the [Scamp](https://github.com/wjessop/Scamp) v1 bot framework.
2
4
 
3
5
  ## Installation
@@ -53,7 +55,8 @@ EM.run {
53
55
  :verbose => true,
54
56
  :logger => Logger::Syslog.new('process_name', Syslog::LOG_PID | Syslog::LOG_CONS),
55
57
  :cache => custom_cache_object,
56
- :ignore_self => true
58
+ :ignore_self => true,
59
+ :ignore_timestamps => true
57
60
  )
58
61
 
59
62
  # more code
@@ -78,6 +81,10 @@ The cache object should conform to the get/set API of the [redis-rb](https://git
78
81
 
79
82
  em-campfire receives messages that it posted on it's streaming connections. By default it processes these just as it would any other message. set :ignore_self to true to make it ignore messages it sends.
80
83
 
84
+ #### :ignore_timestamps
85
+
86
+ Campfire sends periodic timestamp messages. They're useless for most applications, so set this option and they will be totally ignored.
87
+
81
88
  ## Requirements
82
89
 
83
90
  I've tested it in Ruby >= 1.9.3.
@@ -23,7 +23,7 @@ module EventMachine
23
23
  def stream(room_id)
24
24
  json_parser = Yajl::Parser.new :symbolize_keys => true
25
25
  json_parser.on_parse_complete = method(:process_message)
26
-
26
+
27
27
  url = "https://streaming.campfirenow.com/room/#{room_id}/live.json"
28
28
  # Timeout per https://github.com/igrigorik/em-http-request/wiki/Redirects-and-Timeouts
29
29
  http = EventMachine::HttpRequest.new(url, :connect_timeout => 20, :inactivity_timeout => 0).get :head => {'authorization' => [api_key, 'X']}
@@ -44,6 +44,7 @@ module EventMachine
44
44
  json_parser << chunk
45
45
  rescue Yajl::ParseError => e
46
46
  logger.error "Couldn't parse json data for room 123, data was #{chunk}, error was: #{e}"
47
+ EM.next_tick {stream(room_id)}
47
48
  end
48
49
  end
49
50
  end
@@ -1,5 +1,5 @@
1
1
  module EventMachine
2
2
  class Campfire
3
- VERSION = "1.1.0"
3
+ VERSION = "1.1.1"
4
4
  end
5
5
  end
@@ -31,7 +31,7 @@ describe EventMachine::Campfire::Rooms do
31
31
  join_stub = stub_join_room_request(123)
32
32
  object = mock()
33
33
  object.expects(:ping).with("foo")
34
-
34
+
35
35
  EM.run_block {
36
36
  @adaptor.join(123) {|room_id| object.ping("foo") }
37
37
  }
@@ -90,7 +90,7 @@ describe EventMachine::Campfire::Rooms do
90
90
  stream_stub.should have_been_requested.twice
91
91
  end
92
92
  end
93
-
93
+
94
94
  describe "fetching metadata" do
95
95
  describe "for individual rooms" do
96
96
  it "should fetch room data" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: em-campfire
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,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-03 00:00:00.000000000 Z
12
+ date: 2013-03-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: eventmachine
@@ -185,7 +185,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
185
185
  version: '0'
186
186
  segments:
187
187
  - 0
188
- hash: 734765957230943654
188
+ hash: 3592014490074001869
189
189
  required_rubygems_version: !ruby/object:Gem::Requirement
190
190
  none: false
191
191
  requirements:
@@ -194,7 +194,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
194
194
  version: '0'
195
195
  segments:
196
196
  - 0
197
- hash: 734765957230943654
197
+ hash: 3592014490074001869
198
198
  requirements: []
199
199
  rubyforge_project:
200
200
  rubygems_version: 1.8.24