camper_van 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- camper_van (0.0.5)
4
+ camper_van (0.0.6)
5
5
  eventmachine (~> 0.12.10)
6
6
  firering (~> 1.2.0)
7
7
  logging (~> 1.5.1)
@@ -361,8 +361,9 @@ module CamperVan
361
361
  # client.numeric_reply :rpl_topic, channel, ':' + message.body
362
362
 
363
363
  when "Upload"
364
- client.campfire_reply :privmsg, name, channel, ":\01ACTION uploaded " +
365
- "https://#{client.subdomain}.campfirenow.com/room/#{room.id}/uploads/#{message.id}/#{message.body}"
364
+ room.connection.http(:get, "/room/#{message.room_id}/messages/#{message.id}/upload.json") do |data|
365
+ client.campfire_reply :privmsg, name, channel, ":\01ACTION uploaded " + data[:upload][:full_url]
366
+ end
366
367
 
367
368
  when "Tweet"
368
369
  # stringify keys since campfire API is inconsistent about it
@@ -1,3 +1,3 @@
1
1
  module CamperVan
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
@@ -26,6 +26,8 @@ describe CamperVan::Channel do
26
26
  attr_writer :users, :topic, :locked, :full, :open_to_guests
27
27
  attr_writer :stream
28
28
 
29
+ attr_accessor :connection
30
+
29
31
  def initialize
30
32
  @users = []
31
33
  @sent = []
@@ -455,8 +457,16 @@ describe CamperVan::Channel do
455
457
  end
456
458
 
457
459
  it "sends a message containing the upload link when a user uploads a file" do
458
- @channel.map_message_to_irc msg("Upload", :body => "filename")
459
- @client.sent.last.must_match %r(:joe\S+ PRIVMSG #test .*uploads/1234/filename)
460
+ conn = Class.new do
461
+ def http(method, url)
462
+ raise "bad method #{method}" unless method == :get
463
+ raise "bad url #{url}" unless url == "/room/456/messages/1234/upload.json"
464
+ yield :upload => {:full_url => "filename"}
465
+ end
466
+ end.new
467
+ @room.connection = conn
468
+ @channel.map_message_to_irc msg("Upload", :body => "filename", :room_id => 456)
469
+ @client.sent.last.must_match %r(:joe\S+ PRIVMSG #test .* filename)
460
470
  end
461
471
 
462
472
  it "sends a message containing the tweet url when a user posts a tweet" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: camper_van
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
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-08-30 00:00:00.000000000 Z
12
+ date: 2012-10-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: eventmachine
@@ -150,7 +150,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
150
150
  version: '0'
151
151
  segments:
152
152
  - 0
153
- hash: 4196066118135228285
153
+ hash: 3878281362238996625
154
154
  requirements: []
155
155
  rubyforge_project: camper_van
156
156
  rubygems_version: 1.8.24