tinder 1.2.0 → 1.2.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/CHANGELOG.txt CHANGED
@@ -1,6 +1,9 @@
1
+ 1.2.1 - 2009-08-27
2
+ * Fixes for listening after campfire updates [Jordan Byron]
3
+
1
4
  1.2.0 - 2009-01-28
2
5
  * Get the list of available files [Christopher MacGown]
3
- * Upload files [Joshua Want]
6
+ * Upload files [Joshua Wand]
4
7
  * Find rooms even when full [Josh Owens]
5
8
  * Join rooms as a guest [Ian Lesperance]
6
9
 
data/lib/tinder/room.rb CHANGED
@@ -13,10 +13,10 @@ module Tinder
13
13
  def join(force = false)
14
14
  @room = returning(get("room/#{id}")) do |room|
15
15
  raise Error, "Could not join room" unless verify_response(room, :success)
16
- @membership_key = room.body.scan(/\"membershipKey\": \"([a-z0-9]+)\"/).to_s
17
- @user_id = room.body.scan(/\"userID\": (\d+)/).to_s
18
- @last_cache_id = room.body.scan(/\"lastCacheID\": (\d+)/).to_s
19
- @timestamp = room.body.scan(/\"timestamp\": (\d+)/).to_s
16
+ @membership_key = room.body.scan(/\"membershipKey\":\s?\"([a-z0-9]+)\"/).to_s
17
+ @user_id = room.body.scan(/\"userID\":\s?(\d+)/).to_s
18
+ @last_cache_id = room.body.scan(/\"lastCacheID\":\s?(\d+)/).to_s
19
+ @timestamp = room.body.scan(/\"timestamp\":\s?(\d+)/).to_s
20
20
  @idle_since = Time.now
21
21
  end if @room.nil? || force
22
22
  ping
@@ -159,16 +159,36 @@ module Tinder
159
159
  # Get the transcript for the given date (Returns a hash in the same format as #listen)
160
160
  #
161
161
  # room.transcript(room.available_transcripts.first)
162
- # #=> [{:message=>"foobar!", :user_id=>"99999", :person=>"Brandon", :id=>"18659245"}]
162
+ # #=> [{:message=>"foobar!",
163
+ # :user_id=>"99999",
164
+ # :person=>"Brandon",
165
+ # :id=>"18659245",
166
+ # :timestamp=>=>Tue May 05 07:15:00 -0700 2009}]
163
167
  #
164
- def transcript(date)
165
- (Hpricot(get("room/#{id}/transcript/#{date.to_date.strftime('%Y/%m/%d')}").body) / ".message").collect do |message|
168
+ # The timestamp slot will typically have a granularity of five minutes.
169
+ #
170
+ def transcript(transcript_date)
171
+ url = "room/#{id}/transcript/#{transcript_date.to_date.strftime('%Y/%m/%d')}"
172
+ date, time = nil, nil
173
+ (Hpricot(get(url).body) / ".message").collect do |message|
166
174
  person = (message / '.person span').first
175
+ if !person
176
+ # No span for enter/leave the room messages
177
+ person = (message / '.person').first
178
+ end
167
179
  body = (message / '.body div').first
180
+ if d = (message / '.date span').first
181
+ date = d.inner_html
182
+ end
183
+ if t = (message / '.time div').first
184
+ time = t.inner_html
185
+ end
168
186
  {:id => message.attributes['id'].scan(/message_(\d+)/).to_s,
169
187
  :person => person ? person.inner_html : nil,
170
188
  :user_id => message.attributes['class'].scan(/user_(\d+)/).to_s,
171
- :message => body ? body.inner_html : nil
189
+ :message => body ? body.inner_html : nil,
190
+ # Use the transcript_date to fill in the correct year
191
+ :timestamp => Time.parse("#{date} #{time}", transcript_date)
172
192
  }
173
193
  end
174
194
  end
@@ -2,7 +2,7 @@ module Tinder #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 1
4
4
  MINOR = 2
5
- TINY = 0
5
+ TINY = 1
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
@@ -1,12 +1,13 @@
1
1
  require File.dirname(__FILE__) + '/../test_helper'
2
+ require File.dirname(__FILE__) + '/credentials'
2
3
 
3
4
  class RemoteCampfireTest < Test::Unit::TestCase
4
5
 
5
6
  def setup
6
- # @subdomain = 'domain'
7
- # @user, @pass = 'email@example.com', 'password'
8
- @ssl = false
9
- raise "Set your campfire credentials before running the remote tests" unless @user && @pass && @subdomain
7
+ @subdomain = SUBDOMAIN
8
+ @user, @pass = USER, PASS
9
+ @ssl = SSL
10
+ raise "Set your campfire credentials in /test/remote/credentials.rb before running the remote tests" unless @user && @pass && @subdomain
10
11
  @campfire = Tinder::Campfire.new @subdomain, :ssl => @ssl
11
12
  end
12
13
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tinder
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandon Keepers
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-01-28 00:00:00 -05:00
12
+ date: 2009-09-06 00:00:00 -04:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -50,7 +50,7 @@ dependencies:
50
50
  requirements:
51
51
  - - ">="
52
52
  - !ruby/object:Gem::Version
53
- version: 1.8.2
53
+ version: 2.0.0
54
54
  version:
55
55
  description: An API for interfacing with Campfire, the 37Signals chat application.
56
56
  email: brandon@opensoul.org
@@ -75,6 +75,8 @@ files:
75
75
  - lib/tinder/version.rb
76
76
  has_rdoc: true
77
77
  homepage: http://tinder.rubyforge.org
78
+ licenses: []
79
+
78
80
  post_install_message:
79
81
  rdoc_options:
80
82
  - --main
@@ -96,9 +98,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
96
98
  requirements: []
97
99
 
98
100
  rubyforge_project: tinder
99
- rubygems_version: 1.3.1
101
+ rubygems_version: 1.3.3
100
102
  signing_key:
101
- specification_version: 2
103
+ specification_version: 3
102
104
  summary: An (unofficial) Campfire API
103
105
  test_files:
104
106
  - test/remote/remote_campfire_test.rb