Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Emmanuel Oga
authored and
Emmanuel Oga
committed
May 31, 2010
1 parent
7cb69e5
commit 7e04a5c
Showing
58 changed files
with
1,142 additions
and
222 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
doc | ||
.yardoc | ||
bin | ||
*.swp | ||
coverage | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
require 'firering' | ||
|
||
puts "If you prefer it, you can authenticate your user with u/p instead of the campfire token." | ||
|
||
print "Enter subdomain: " | ||
subdomain = gets.chomp | ||
|
||
print "Enter user: " | ||
user = gets.chomp | ||
|
||
print "Enter password: " | ||
password = gets.chomp | ||
|
||
EM.run do | ||
Firering.authenticate(subdomain, user, password) do |user| | ||
|
||
puts "Token for user #{user.name} is #{user.token}" | ||
|
||
EM.stop | ||
|
||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,24 @@ | ||
$LOAD_PATH.unshift(File.expand_path(File.join(File.dirname(__FILE__), "..", "lib"))) | ||
|
||
require 'firering' | ||
|
||
$count = 0 | ||
Firering.subdomain = ENV["CAMPFIRE_SUBDOMAIN"] | ||
Firering.token = ENV["CAMPFIRE_TOKEN"] | ||
|
||
EM.run do | ||
Firering.authenticate("subdomain", "user", "password") do |user| | ||
|
||
Firering.rooms do |rooms| | ||
|
||
$count = rooms.length | ||
|
||
rooms.each do |room| | ||
$count -= 1 | ||
Firering.rooms do |rooms| | ||
|
||
puts "Users in room #{room.name}" | ||
rooms.each do |room| | ||
puts "Users in room #{room.name}" | ||
|
||
if room.users.empty? | ||
puts " empty" | ||
else | ||
room.users.each do |u| | ||
puts " #{ u.name }" | ||
end | ||
if room.users.empty? | ||
puts " empty (locked: #{room.locked?})" | ||
else | ||
room.users.each do |u| | ||
puts " #{ u.name }" | ||
end | ||
|
||
EM.stop if $count == 0 | ||
end | ||
|
||
end | ||
end | ||
|
||
trap("INT") { EM.stop } | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
require 'eventmachine' | ||
require 'yajl' | ||
require 'em-http' | ||
require 'date' | ||
|
||
module Firering | ||
VERSION = '0.1.0' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,13 @@ | ||
=begin | ||
<room> | ||
<id type="integer">1</id> | ||
<name>North May St.</name> | ||
<topic>37signals HQ</topic> | ||
<membership-limit type="integer">60</membership-limit> | ||
<full type="boolean">false</full> | ||
<open-to-guests type="boolean">true</open-to-guests> | ||
<active-token-value>#{ 4c8fb -- requires open-to-guests is true}</active-token-value> | ||
<updated-at type="datetime">2009-11-17T19:41:38Z</updated-at> | ||
<created-at type="datetime">2009-11-17T19:41:38Z</created-at> | ||
<users type="array"> | ||
... | ||
</users> | ||
</room> | ||
=end | ||
|
||
module Firering | ||
class Room < Firering::Data | ||
key :id, :name, :topic, :membership_limit, :full, :open_to_guests, :active_token_value, :updated_at, :created_at, :users | ||
key :id, :name, :topic, :membership_limit, :full, :open_to_guests, :active_token_value, :updated_at, :created_at, :users, :locked | ||
|
||
alias_method :locked?, :locked | ||
alias_method :full?, :full | ||
alias_method :open_to_guests?, :open_to_guests | ||
|
||
def users | ||
@users ||= super.map { |u| Firering::User.new(u, false) } | ||
@users ||= (super || []).map { |u| Firering::User.new(u, false) } | ||
end | ||
end | ||
end |
Oops, something went wrong.