tinychat 1.0.0

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.
Files changed (2) hide show
  1. data/lib/tinychat.rb +23 -0
  2. metadata +87 -0
@@ -0,0 +1,23 @@
1
+ require 'httparty'
2
+ class Tinychat
3
+ include HTTParty
4
+ format :json
5
+ class MissingRoom < Exception; end
6
+
7
+ class Room
8
+ attr_accessor :topic, :pics, :broadcaster_count, :names, :priv, :name, :total_count
9
+ def initialize(data)
10
+ data.each do |key, value|
11
+ self.send("#{key}=", value) rescue(puts "attr_reader :#{key}")
12
+ end
13
+ end
14
+ end
15
+
16
+ def self.info_for(room_name)
17
+ result = get("http://api.tinychat.com/#{room_name}.json")
18
+ if result["error"]
19
+ raise MissingRoom, "#{room_name} is not broadcasting"
20
+ end
21
+ Room.new(result)
22
+ end
23
+ end
metadata ADDED
@@ -0,0 +1,87 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: tinychat
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Chad Fowler
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-11-10 00:00:00 -06:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: httparty
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: "0"
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: fakeweb
27
+ type: :development
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: "0"
34
+ version:
35
+ - !ruby/object:Gem::Dependency
36
+ name: Shoulda
37
+ type: :development
38
+ version_requirement:
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: "0"
44
+ version:
45
+ description: |
46
+ Simple Tinychat API implementation based on HTTParty. Created for the purpose of playing with HTTParty.
47
+ If you know the name of a Tinychat room, you can get information about the room with Tinychat.info_for(room_name).
48
+
49
+ email: chad@chadfowler.com
50
+ executables: []
51
+
52
+ extensions: []
53
+
54
+ extra_rdoc_files: []
55
+
56
+ files:
57
+ - lib/tinychat.rb
58
+ has_rdoc: true
59
+ homepage:
60
+ licenses: []
61
+
62
+ post_install_message:
63
+ rdoc_options: []
64
+
65
+ require_paths:
66
+ - lib
67
+ required_ruby_version: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ version: "0"
72
+ version:
73
+ required_rubygems_version: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - ">="
76
+ - !ruby/object:Gem::Version
77
+ version: "0"
78
+ version:
79
+ requirements: []
80
+
81
+ rubyforge_project:
82
+ rubygems_version: 1.3.5
83
+ signing_key:
84
+ specification_version: 3
85
+ summary: Simple Tinychat API implementation
86
+ test_files: []
87
+