r43 0.2.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.
- data/lib/city.rb +52 -0
- data/lib/entry.rb +63 -0
- data/lib/goal.rb +73 -0
- data/lib/id.rb +39 -0
- data/lib/person.rb +74 -0
- data/lib/r43.rb +637 -0
- data/lib/r43.rb.~1.6.~ +645 -0
- data/lib/tag.rb +31 -0
- data/test/authentication.xml +2 -0
- data/test/echo.xml +6 -0
- data/test/get_city-36.xml +148 -0
- data/test/get_citys_people-1164-offset20.xml +20 -0
- data/test/get_citys_people-1164.xml +192 -0
- data/test/get_entry-33.xml +25 -0
- data/test/get_goal_by_id-255.xml +20 -0
- data/test/get_goal_by_name-255.xml +19 -0
- data/test/get_goals_entries-255-offset20.xml +265 -0
- data/test/get_goals_entries-533.xml +1 -0
- data/test/get_goals_people-533-offset20.xml +1 -0
- data/test/get_goals_people-533.xml +1 -0
- data/test/get_goals_similarities-255.xml +1 -0
- data/test/get_person-erik.xml +268 -0
- data/test/get_person-flickr_username.xml +4 -0
- data/test/get_person-sweeting.xml +2 -0
- data/test/get_persons_completed_things-erik.xml +89 -0
- data/test/get_persons_entries-erik.xml +515 -0
- data/test/get_persons_neighbors-erik-20.xml +200 -0
- data/test/get_persons_neighbors-erik.xml +201 -0
- data/test/get_persons_progress_on_goal-erik-9.xml +57 -0
- data/test/get_persons_tag_cloud-erik.xml +272 -0
- data/test/get_persons_tags-erik.xml +228 -0
- data/test/get_persons_teammates-erik.xml +183 -0
- data/test/search_cities-london.xml +119 -0
- data/test/search_goals-ruby-offset20-max10.xml +83 -0
- data/test/search_goals-ruby-offset20.xml +153 -0
- data/test/search_goals-ruby.xml +153 -0
- data/test/search_goals-schemer.xml +20 -0
- data/test/search_people-Sean.xml +118 -0
- data/test/search_people_by_email-erik@mockerybird.com.xml +38 -0
- data/test/test_r43.rb +852 -0
- data/test/test_r43.rb.~1.8.~ +728 -0
- metadata +77 -0
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<feed xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns="http://43things.com/xml/2005/rc#">
|
|
3
|
+
<title>Goal search results for "ruby" on 43 Things</title>
|
|
4
|
+
<link href="http://www.43things.com/search/query?q=ruby" rel="alternate" type="text/html"/>
|
|
5
|
+
<query>ruby</query>
|
|
6
|
+
<pagination>
|
|
7
|
+
<offset>0</offset>
|
|
8
|
+
<max>20</max>
|
|
9
|
+
<total>101</total>
|
|
10
|
+
<next_offset>20</next_offset>
|
|
11
|
+
<previous_offset></previous_offset>
|
|
12
|
+
</pagination>
|
|
13
|
+
<goal goal_id="305">
|
|
14
|
+
<name>Learn Ruby</name>
|
|
15
|
+
<link href="http://www.43things.com/things/view/305" rel="alternate" type="text/html"/>
|
|
16
|
+
<num_registered_people>695</num_registered_people>
|
|
17
|
+
<num_unregistered_people>195</num_unregistered_people>
|
|
18
|
+
<id>tag:43things.com:goal:305</id>
|
|
19
|
+
</goal>
|
|
20
|
+
<goal goal_id="5040">
|
|
21
|
+
<name>learn ruby on rails</name>
|
|
22
|
+
<link href="http://www.43things.com/things/view/5040" rel="alternate" type="text/html"/>
|
|
23
|
+
<num_registered_people>166</num_registered_people>
|
|
24
|
+
<num_unregistered_people>39</num_unregistered_people>
|
|
25
|
+
<id>tag:43things.com:goal:5040</id>
|
|
26
|
+
</goal>
|
|
27
|
+
<goal goal_id="252">
|
|
28
|
+
<name>master Ruby</name>
|
|
29
|
+
<link href="http://www.43things.com/things/view/252" rel="alternate" type="text/html"/>
|
|
30
|
+
<num_registered_people>83</num_registered_people>
|
|
31
|
+
<num_unregistered_people>10</num_unregistered_people>
|
|
32
|
+
<id>tag:43things.com:goal:252</id>
|
|
33
|
+
</goal>
|
|
34
|
+
<goal goal_id="533">
|
|
35
|
+
<name>Program more in Ruby</name>
|
|
36
|
+
<link href="http://www.43things.com/things/view/533" rel="alternate" type="text/html"/>
|
|
37
|
+
<num_registered_people>26</num_registered_people>
|
|
38
|
+
<num_unregistered_people>4</num_unregistered_people>
|
|
39
|
+
<id>tag:43things.com:goal:533</id>
|
|
40
|
+
</goal>
|
|
41
|
+
<goal goal_id="31053">
|
|
42
|
+
<name>Learn Ruby and Rails</name>
|
|
43
|
+
<link href="http://www.43things.com/things/view/31053" rel="alternate" type="text/html"/>
|
|
44
|
+
<num_registered_people>14</num_registered_people>
|
|
45
|
+
<num_unregistered_people>5</num_unregistered_people>
|
|
46
|
+
<id>tag:43things.com:goal:31053</id>
|
|
47
|
+
</goal>
|
|
48
|
+
<goal goal_id="7328">
|
|
49
|
+
<name>ruby</name>
|
|
50
|
+
<link href="http://www.43things.com/things/view/7328" rel="alternate" type="text/html"/>
|
|
51
|
+
<num_registered_people>9</num_registered_people>
|
|
52
|
+
<num_unregistered_people>62</num_unregistered_people>
|
|
53
|
+
<id>tag:43things.com:goal:7328</id>
|
|
54
|
+
</goal>
|
|
55
|
+
<goal goal_id="72933">
|
|
56
|
+
<name>really understand Ruby on Rails and Ruby in general</name>
|
|
57
|
+
<link href="http://www.43things.com/things/view/72933" rel="alternate" type="text/html"/>
|
|
58
|
+
<num_registered_people>4</num_registered_people>
|
|
59
|
+
<num_unregistered_people>5</num_unregistered_people>
|
|
60
|
+
<id>tag:43things.com:goal:72933</id>
|
|
61
|
+
</goal>
|
|
62
|
+
<goal goal_id="18080">
|
|
63
|
+
<name>Master Ruby on Rails</name>
|
|
64
|
+
<link href="http://www.43things.com/things/view/18080" rel="alternate" type="text/html"/>
|
|
65
|
+
<num_registered_people>4</num_registered_people>
|
|
66
|
+
<num_unregistered_people>1</num_unregistered_people>
|
|
67
|
+
<id>tag:43things.com:goal:18080</id>
|
|
68
|
+
</goal>
|
|
69
|
+
<goal goal_id="15192">
|
|
70
|
+
<name>evangelize Ruby in my company</name>
|
|
71
|
+
<link href="http://www.43things.com/things/view/15192" rel="alternate" type="text/html"/>
|
|
72
|
+
<num_registered_people>4</num_registered_people>
|
|
73
|
+
<num_unregistered_people>1</num_unregistered_people>
|
|
74
|
+
<id>tag:43things.com:goal:15192</id>
|
|
75
|
+
</goal>
|
|
76
|
+
<goal goal_id="1127">
|
|
77
|
+
<name>Learn to program in Ruby</name>
|
|
78
|
+
<link href="http://www.43things.com/things/view/1127" rel="alternate" type="text/html"/>
|
|
79
|
+
<num_registered_people>4</num_registered_people>
|
|
80
|
+
<num_unregistered_people>1</num_unregistered_people>
|
|
81
|
+
<id>tag:43things.com:goal:1127</id>
|
|
82
|
+
</goal>
|
|
83
|
+
<goal goal_id="6249">
|
|
84
|
+
<name>Program in Ruby</name>
|
|
85
|
+
<link href="http://www.43things.com/things/view/6249" rel="alternate" type="text/html"/>
|
|
86
|
+
<num_registered_people>3</num_registered_people>
|
|
87
|
+
<num_unregistered_people>0</num_unregistered_people>
|
|
88
|
+
<id>tag:43things.com:goal:6249</id>
|
|
89
|
+
</goal>
|
|
90
|
+
<goal goal_id="37093">
|
|
91
|
+
<name>Rsnapshot in ruby</name>
|
|
92
|
+
<link href="http://www.43things.com/things/view/37093" rel="alternate" type="text/html"/>
|
|
93
|
+
<num_registered_people>2</num_registered_people>
|
|
94
|
+
<num_unregistered_people>0</num_unregistered_people>
|
|
95
|
+
<id>tag:43things.com:goal:37093</id>
|
|
96
|
+
</goal>
|
|
97
|
+
<goal goal_id="79180">
|
|
98
|
+
<name>Try Ruby</name>
|
|
99
|
+
<link href="http://www.43things.com/things/view/79180" rel="alternate" type="text/html"/>
|
|
100
|
+
<num_registered_people>2</num_registered_people>
|
|
101
|
+
<num_unregistered_people>0</num_unregistered_people>
|
|
102
|
+
<id>tag:43things.com:goal:79180</id>
|
|
103
|
+
</goal>
|
|
104
|
+
<goal goal_id="31669">
|
|
105
|
+
<name>ruby on rails</name>
|
|
106
|
+
<link href="http://www.43things.com/things/view/31669" rel="alternate" type="text/html"/>
|
|
107
|
+
<num_registered_people>2</num_registered_people>
|
|
108
|
+
<num_unregistered_people>20</num_unregistered_people>
|
|
109
|
+
<id>tag:43things.com:goal:31669</id>
|
|
110
|
+
</goal>
|
|
111
|
+
<goal goal_id="55648">
|
|
112
|
+
<name>avoid ruby</name>
|
|
113
|
+
<link href="http://www.43things.com/things/view/55648" rel="alternate" type="text/html"/>
|
|
114
|
+
<num_registered_people>1</num_registered_people>
|
|
115
|
+
<num_unregistered_people>0</num_unregistered_people>
|
|
116
|
+
<id>tag:43things.com:goal:55648</id>
|
|
117
|
+
</goal>
|
|
118
|
+
<goal goal_id="37032">
|
|
119
|
+
<name>Program Ruby</name>
|
|
120
|
+
<link href="http://www.43things.com/things/view/37032" rel="alternate" type="text/html"/>
|
|
121
|
+
<num_registered_people>1</num_registered_people>
|
|
122
|
+
<num_unregistered_people>0</num_unregistered_people>
|
|
123
|
+
<id>tag:43things.com:goal:37032</id>
|
|
124
|
+
</goal>
|
|
125
|
+
<goal goal_id="65956">
|
|
126
|
+
<name>ruby programming</name>
|
|
127
|
+
<link href="http://www.43things.com/things/view/65956" rel="alternate" type="text/html"/>
|
|
128
|
+
<num_registered_people>1</num_registered_people>
|
|
129
|
+
<num_unregistered_people>3</num_unregistered_people>
|
|
130
|
+
<id>tag:43things.com:goal:65956</id>
|
|
131
|
+
</goal>
|
|
132
|
+
<goal goal_id="215932">
|
|
133
|
+
<name>Learn Ruby and Ruby on Rails</name>
|
|
134
|
+
<link href="http://www.43things.com/things/view/215932" rel="alternate" type="text/html"/>
|
|
135
|
+
<num_registered_people>1</num_registered_people>
|
|
136
|
+
<num_unregistered_people>0</num_unregistered_people>
|
|
137
|
+
<id>tag:43things.com:goal:215932</id>
|
|
138
|
+
</goal>
|
|
139
|
+
<goal goal_id="179662">
|
|
140
|
+
<name>Work with Ruby & Ruby on rails programmers - project</name>
|
|
141
|
+
<link href="http://www.43things.com/things/view/179662" rel="alternate" type="text/html"/>
|
|
142
|
+
<num_registered_people>1</num_registered_people>
|
|
143
|
+
<num_unregistered_people>0</num_unregistered_people>
|
|
144
|
+
<id>tag:43things.com:goal:179662</id>
|
|
145
|
+
</goal>
|
|
146
|
+
<goal goal_id="8536">
|
|
147
|
+
<name>Learn more about ruby programming and convince people at work to like ruby</name>
|
|
148
|
+
<link href="http://www.43things.com/things/view/8536" rel="alternate" type="text/html"/>
|
|
149
|
+
<num_registered_people>1</num_registered_people>
|
|
150
|
+
<num_unregistered_people>0</num_unregistered_people>
|
|
151
|
+
<id>tag:43things.com:goal:8536</id>
|
|
152
|
+
</goal>
|
|
153
|
+
</feed>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<?xml version='1.0' encoding='UTF-8'?>
|
|
2
|
+
<feed xmlns='http://43things.com/xml/2005/rc#'>
|
|
3
|
+
<title>Goal search results for 'schemer' on 43 Things</title>
|
|
4
|
+
<link href='http://www.43things.com/search/query?q=schemer' rel='alternate' type='text/html'/>
|
|
5
|
+
<query>schemer</query>
|
|
6
|
+
<pagination>
|
|
7
|
+
<offset>0</offset>
|
|
8
|
+
<max>20</max>
|
|
9
|
+
<total>1</total>
|
|
10
|
+
<next_offset></next_offset>
|
|
11
|
+
<previous_offset></previous_offset>
|
|
12
|
+
</pagination>
|
|
13
|
+
<goal goal_id='12161'>
|
|
14
|
+
<name>finish reading The Little Schemer</name>
|
|
15
|
+
<link href='http://www.43things.com/things/view/12161' rel='alternate' type='text/html'/>
|
|
16
|
+
<num_registered_people>4</num_registered_people>
|
|
17
|
+
<num_unregistered_people>0</num_unregistered_people>
|
|
18
|
+
<id>tag:43things.com:goal:12161</id>
|
|
19
|
+
</goal>
|
|
20
|
+
</feed>
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
<?xml version='1.0' encoding='UTF-8'?><feed xmlns:dc='http://purl.org/dc/elements/1.1/' xmlns='http://43things.com/xml/2005/rc#'>
|
|
2
|
+
<title>People search results for "Sean" on 43 Things</title>
|
|
3
|
+
<link href='http://www.43things.com/search/query?q=Sean' rel='alternate' type='text/html'/>
|
|
4
|
+
<query>Sean</query>
|
|
5
|
+
<pagination>
|
|
6
|
+
<offset>0</offset>
|
|
7
|
+
<max>20</max>
|
|
8
|
+
<total>11</total>
|
|
9
|
+
<next_offset/>
|
|
10
|
+
<previous_offset/>
|
|
11
|
+
</pagination>
|
|
12
|
+
<person person_id='Sean'>
|
|
13
|
+
<username>Sean</username>
|
|
14
|
+
<name>Sean McNulty</name>
|
|
15
|
+
<url>http://seanmcnulty.blogspot.com/</url>
|
|
16
|
+
<flickr_username>Sean</flickr_username>
|
|
17
|
+
<num_open_goals>15</num_open_goals>
|
|
18
|
+
<profile_image_url>http://images.43things.com/profile/00/00/09/2357s.jpg</profile_image_url>
|
|
19
|
+
<num_open_goals>15</num_open_goals>
|
|
20
|
+
<link href='http://www.43things.com/person/Sean' rel='alternate' type='text/html'/>
|
|
21
|
+
</person>
|
|
22
|
+
<person person_id='seano'>
|
|
23
|
+
<username>seano</username>
|
|
24
|
+
<name>Sean</name>
|
|
25
|
+
<url/>
|
|
26
|
+
<flickr_username/>
|
|
27
|
+
<num_open_goals>11</num_open_goals>
|
|
28
|
+
<num_open_goals>11</num_open_goals>
|
|
29
|
+
<link href='http://www.43things.com/person/seano' rel='alternate' type='text/html'/>
|
|
30
|
+
</person>
|
|
31
|
+
<person person_id='pusgums'>
|
|
32
|
+
<username>pusgums</username>
|
|
33
|
+
<name>Sean</name>
|
|
34
|
+
<url/>
|
|
35
|
+
<flickr_username>pusgums</flickr_username>
|
|
36
|
+
<num_open_goals>0</num_open_goals>
|
|
37
|
+
<profile_image_url>http://images.43things.com/profile/00/00/69/27105s.jpg</profile_image_url>
|
|
38
|
+
<num_open_goals>0</num_open_goals>
|
|
39
|
+
<link href='http://www.43things.com/person/pusgums' rel='alternate' type='text/html'/>
|
|
40
|
+
</person>
|
|
41
|
+
<person person_id='dimpledott'>
|
|
42
|
+
<username>dimpledott</username>
|
|
43
|
+
<name>Sean Johnson</name>
|
|
44
|
+
<url>www.sean-johnson.com</url>
|
|
45
|
+
<flickr_username/>
|
|
46
|
+
<num_open_goals>11</num_open_goals>
|
|
47
|
+
<profile_image_url>http://images.43things.com/profile/00/00/01/281s.jpg</profile_image_url>
|
|
48
|
+
<num_open_goals>11</num_open_goals>
|
|
49
|
+
<link href='http://www.43things.com/person/dimpledott' rel='alternate' type='text/html'/>
|
|
50
|
+
</person>
|
|
51
|
+
<person person_id='seannui'>
|
|
52
|
+
<username>seannui</username>
|
|
53
|
+
<name>Sean Porter</name>
|
|
54
|
+
<url>http://seanporter.com/</url>
|
|
55
|
+
<flickr_username>seannui</flickr_username>
|
|
56
|
+
<num_open_goals>3</num_open_goals>
|
|
57
|
+
<profile_image_url>http://images.43things.com/profile/00/00/54/21615s.jpg</profile_image_url>
|
|
58
|
+
<num_open_goals>3</num_open_goals>
|
|
59
|
+
<link href='http://www.43things.com/person/seannui' rel='alternate' type='text/html'/>
|
|
60
|
+
</person>
|
|
61
|
+
<person person_id='publicinvention'>
|
|
62
|
+
<username>publicinvention</username>
|
|
63
|
+
<name>Sean Devine</name>
|
|
64
|
+
<url>http://devine.blogs.com</url>
|
|
65
|
+
<flickr_username/>
|
|
66
|
+
<num_open_goals>5</num_open_goals>
|
|
67
|
+
<num_open_goals>5</num_open_goals>
|
|
68
|
+
<link href='http://www.43things.com/person/publicinvention' rel='alternate' type='text/html'/>
|
|
69
|
+
</person>
|
|
70
|
+
<person person_id='thadeous'>
|
|
71
|
+
<username>thadeous</username>
|
|
72
|
+
<name>Sean Abrahams</name>
|
|
73
|
+
<url>http://www.escex.com/blog</url>
|
|
74
|
+
<flickr_username>thadeous</flickr_username>
|
|
75
|
+
<num_open_goals>1</num_open_goals>
|
|
76
|
+
<num_open_goals>1</num_open_goals>
|
|
77
|
+
<link href='http://www.43things.com/person/thadeous' rel='alternate' type='text/html'/>
|
|
78
|
+
</person>
|
|
79
|
+
<person person_id='stevis'>
|
|
80
|
+
<username>stevis</username>
|
|
81
|
+
<name>Sean Tevis</name>
|
|
82
|
+
<url>http://www.tevis.net</url>
|
|
83
|
+
<flickr_username>stevis</flickr_username>
|
|
84
|
+
<num_open_goals>3</num_open_goals>
|
|
85
|
+
<profile_image_url>http://images.43things.com/profile/00/00/0a/2732s.jpg</profile_image_url>
|
|
86
|
+
<num_open_goals>3</num_open_goals>
|
|
87
|
+
<link href='http://www.43things.com/person/stevis' rel='alternate' type='text/html'/>
|
|
88
|
+
</person>
|
|
89
|
+
<person person_id='seanyboy'>
|
|
90
|
+
<username>seanyboy</username>
|
|
91
|
+
<name>Sean Bamforth</name>
|
|
92
|
+
<url/>
|
|
93
|
+
<flickr_username/>
|
|
94
|
+
<num_open_goals>19</num_open_goals>
|
|
95
|
+
<profile_image_url>http://images.43things.com/profile/00/00/1e/7912s.jpg</profile_image_url>
|
|
96
|
+
<num_open_goals>19</num_open_goals>
|
|
97
|
+
<link href='http://www.43things.com/person/seanyboy' rel='alternate' type='text/html'/>
|
|
98
|
+
</person>
|
|
99
|
+
<person person_id='milythael'>
|
|
100
|
+
<username>milythael</username>
|
|
101
|
+
<name>Sean Carley</name>
|
|
102
|
+
<url/>
|
|
103
|
+
<flickr_username/>
|
|
104
|
+
<num_open_goals>35</num_open_goals>
|
|
105
|
+
<num_open_goals>35</num_open_goals>
|
|
106
|
+
<link href='http://www.43things.com/person/milythael' rel='alternate' type='text/html'/>
|
|
107
|
+
</person>
|
|
108
|
+
<person person_id='santry'>
|
|
109
|
+
<username>santry</username>
|
|
110
|
+
<name>Sean Santry</name>
|
|
111
|
+
<url>http://seansantry.com</url>
|
|
112
|
+
<flickr_username/>
|
|
113
|
+
<num_open_goals>1</num_open_goals>
|
|
114
|
+
<profile_image_url>http://images.43things.com/profile/00/00/03/882s.jpg</profile_image_url>
|
|
115
|
+
<num_open_goals>1</num_open_goals>
|
|
116
|
+
<link href='http://www.43things.com/person/santry' rel='alternate' type='text/html'/>
|
|
117
|
+
</person>
|
|
118
|
+
</feed>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<?xml version='1.0' encoding='UTF-8'?><feed xmlns:dc='http://purl.org/dc/elements/1.1/' xmlns='http://43things.com/xml/2005/rc#'>
|
|
2
|
+
<title>People search results for "erik@mockerybird.com" on 43 Things</title>
|
|
3
|
+
<link href='http://www.43things.com/search/query?q=erik%40mockerybird.com' rel='alternate' type='text/html'/>
|
|
4
|
+
<query>erik@mockerybird.com</query>
|
|
5
|
+
<pagination>
|
|
6
|
+
<offset>0</offset>
|
|
7
|
+
<max>20</max>
|
|
8
|
+
<total>3</total>
|
|
9
|
+
<next_offset/>
|
|
10
|
+
<previous_offset/>
|
|
11
|
+
</pagination>
|
|
12
|
+
<person person_id='ludwig'>
|
|
13
|
+
<username>ludwig</username>
|
|
14
|
+
<name>ludwig</name>
|
|
15
|
+
<url/>
|
|
16
|
+
<num_open_goals>1</num_open_goals>
|
|
17
|
+
<num_open_goals>1</num_open_goals>
|
|
18
|
+
<link href='http://www.43things.com/person/ludwig' rel='alternate' type='text/html'/>
|
|
19
|
+
</person>
|
|
20
|
+
<person person_id='mockerybird'>
|
|
21
|
+
<username>mockerybird</username>
|
|
22
|
+
<name>mockerybird</name>
|
|
23
|
+
<url/>
|
|
24
|
+
<num_open_goals>1</num_open_goals>
|
|
25
|
+
<num_open_goals>1</num_open_goals>
|
|
26
|
+
<link href='http://www.43things.com/person/mockerybird' rel='alternate' type='text/html'/>
|
|
27
|
+
</person>
|
|
28
|
+
<person person_id='erik'>
|
|
29
|
+
<username>erik</username>
|
|
30
|
+
<name>Erik Benson</name>
|
|
31
|
+
<url>http://erikbenson.com</url>
|
|
32
|
+
<flickr_username>erikbenson</flickr_username>
|
|
33
|
+
<num_open_goals>40</num_open_goals>
|
|
34
|
+
<profile_image_url>http://images.43things.com/profile/00/00/22/8818s.jpg</profile_image_url>
|
|
35
|
+
<num_open_goals>40</num_open_goals>
|
|
36
|
+
<link href='http://www.43things.com/person/erik' rel='alternate' type='text/html'/>
|
|
37
|
+
</person>
|
|
38
|
+
</feed>
|
data/test/test_r43.rb
ADDED
|
@@ -0,0 +1,852 @@
|
|
|
1
|
+
# copyright 2005 Pat Eyler, Sean Carley, & Edward Cho
|
|
2
|
+
# distributed under the same terms as Ruby
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
require 'test/unit'
|
|
6
|
+
require 'r43'
|
|
7
|
+
require 'stringio'
|
|
8
|
+
|
|
9
|
+
class FakeService < R43::Service
|
|
10
|
+
|
|
11
|
+
#
|
|
12
|
+
# collection of mock XML responses
|
|
13
|
+
#
|
|
14
|
+
@@data = {
|
|
15
|
+
|
|
16
|
+
#
|
|
17
|
+
# General Methods
|
|
18
|
+
#
|
|
19
|
+
"authentication_test?api_key=1234&username=www&password=1234" =>
|
|
20
|
+
"#{File.open('test/authentication.xml').read}",
|
|
21
|
+
"echo?api_key=1234" =>
|
|
22
|
+
"#{File.open('test/echo.xml').read}",
|
|
23
|
+
|
|
24
|
+
#
|
|
25
|
+
# Goal Methods
|
|
26
|
+
"search_goals?api_key=1234&q=schemer" =>
|
|
27
|
+
"#{File.open('test/search_goals-schemer.xml').read}",
|
|
28
|
+
"search_goals?api_key=1234&q=ruby" =>
|
|
29
|
+
"#{File.open('test/search_goals-ruby.xml').read}",
|
|
30
|
+
"search_goals?api_key=1234&q=ruby&offset=20" =>
|
|
31
|
+
"#{File.open('test/search_goals-ruby-offset20.xml').read}",
|
|
32
|
+
"search_goals?api_key=1234&q=ruby&offset=20&max=10" =>
|
|
33
|
+
"#{File.open('test/search_goals-ruby-offset20-max10.xml').read}",
|
|
34
|
+
"get_goal_by_id?api_key=1234&id=255" =>
|
|
35
|
+
"#{File.open('test/get_goal_by_id-255.xml').read}",
|
|
36
|
+
"get_goal_by_name?api_key=1234&name=Try+out+43+Things" =>
|
|
37
|
+
"#{File.open('test/get_goal_by_name-255.xml').read}",
|
|
38
|
+
"get_goals_similarities?api_key=1234&id=255" =>
|
|
39
|
+
"#{File.open('test/get_goals_similarities-255.xml').read}",
|
|
40
|
+
"get_goals_people?api_key=1234&id=533" =>
|
|
41
|
+
"#{File.open('test/get_goals_people-533.xml').read}",
|
|
42
|
+
"get_goals_people?api_key=1234&id=533&offset=20" =>
|
|
43
|
+
"#{File.open('test/get_goals_people-533-offset20.xml').read}",
|
|
44
|
+
"get_goals_entries?api_key=1234&id=533" =>
|
|
45
|
+
"#{File.open('test/get_goals_entries-533.xml').read}",
|
|
46
|
+
"get_goals_entries?api_key=1234&id=255&offset=20&max=10&view=done" =>
|
|
47
|
+
"#{File.open('test/get_goals_entries-255-offset20.xml').read}",
|
|
48
|
+
|
|
49
|
+
#
|
|
50
|
+
# People Methods
|
|
51
|
+
"search_people?api_key=1234&q=Sean" =>
|
|
52
|
+
"#{File.open('test/search_people-Sean.xml').read}",
|
|
53
|
+
"search_people_by_email?api_key=1234&q=erik@mockerybird.com" =>
|
|
54
|
+
"#{File.open('test/search_people_by_email-erik@mockerybird.com.xml').read}",
|
|
55
|
+
"get_person?api_key=1234&id=erik" =>
|
|
56
|
+
"#{File.open('test/get_person-erik.xml').read}",
|
|
57
|
+
"get_person?api_key=1234&id=sweeting" =>
|
|
58
|
+
"#{File.open('test/get_person-sweeting.xml').read}",
|
|
59
|
+
"get_person?api_key=1234&flickr_username=erikbenson" =>
|
|
60
|
+
"#{File.open('test/get_person-flickr_username.xml').read}",
|
|
61
|
+
"get_persons_completed_things?api_key=1234&id=erik" =>
|
|
62
|
+
"#{File.open('test/get_persons_completed_things-erik.xml').read}",
|
|
63
|
+
"get_persons_entries?api_key=1234&id=erik" =>
|
|
64
|
+
"#{File.open('test/get_persons_entries-erik.xml').read}",
|
|
65
|
+
"get_persons_progress_on_goal?api_key=1234&id=erik&goal_id=9" =>
|
|
66
|
+
"#{File.open('test/get_persons_progress_on_goal-erik-9.xml').read}",
|
|
67
|
+
"get_persons_teammates?api_key=1234&id=erik" =>
|
|
68
|
+
"#{File.open('test/get_persons_teammates-erik.xml').read}",
|
|
69
|
+
"get_persons_neighbors?api_key=1234&id=erik" =>
|
|
70
|
+
"#{File.open('test/get_persons_neighbors-erik.xml').read}",
|
|
71
|
+
"get_persons_neighbors?api_key=1234&id=erik&offset=20" =>
|
|
72
|
+
"#{File.open('test/get_persons_neighbors-erik-20.xml').read}",
|
|
73
|
+
"get_persons_tags?api_key=1234&id=erik" =>
|
|
74
|
+
"#{File.open('test/get_persons_tags-erik.xml').read}",
|
|
75
|
+
"get_persons_tag_cloud?api_key=1234&id=erik" =>
|
|
76
|
+
"#{File.open('test/get_persons_tag_cloud-erik.xml').read}",
|
|
77
|
+
|
|
78
|
+
#
|
|
79
|
+
# Team Methods
|
|
80
|
+
|
|
81
|
+
#
|
|
82
|
+
# Entry Methods
|
|
83
|
+
"get_entry?api_key=1234&id=33" =>
|
|
84
|
+
"#{File.open('test/get_entry-33.xml').read}",
|
|
85
|
+
|
|
86
|
+
#
|
|
87
|
+
# Tag Methods
|
|
88
|
+
|
|
89
|
+
#
|
|
90
|
+
# City Methods
|
|
91
|
+
"search_cities?api_key=1234&q=london" =>
|
|
92
|
+
"#{File.open('test/search_cities-london.xml').read}",
|
|
93
|
+
"get_city?api_key=1234&id=36" =>
|
|
94
|
+
"#{File.open('test/get_city-36.xml').read}",
|
|
95
|
+
"get_citys_people?api_key=1234&id=1164" =>
|
|
96
|
+
"#{File.open('test/get_citys_people-1164.xml').read}",
|
|
97
|
+
"get_citys_people?api_key=1234&id=1164&offset=20" =>
|
|
98
|
+
"#{File.open('test/get_citys_people-1164-offset20.xml').read}",
|
|
99
|
+
"get_citys_people?api_key=1234&id=1164&offset=20&max=20" =>
|
|
100
|
+
"#{File.open('test/get_citys_people-1164-offset20.xml').read}"
|
|
101
|
+
|
|
102
|
+
#
|
|
103
|
+
# Action Methods
|
|
104
|
+
|
|
105
|
+
#
|
|
106
|
+
# ATOM Methods
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
def _get_response(url)
|
|
111
|
+
raise "no data for #{url.inspect}" unless @@data.has_key? url
|
|
112
|
+
return REXML::Document.new(@@data[url])
|
|
113
|
+
end
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
class FakeConnection < R43::Connection
|
|
117
|
+
attr_reader :proxy_addr
|
|
118
|
+
def initialize(key, proxy_addr=nil, proxy_port=nil,
|
|
119
|
+
proxy_user=nil, proxy_pass=nil)
|
|
120
|
+
super key
|
|
121
|
+
@proxy_addr = proxy_addr
|
|
122
|
+
@service = FakeService.new(key, proxy_addr, proxy_port,
|
|
123
|
+
proxy_user, proxy_pass)
|
|
124
|
+
end
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
class TestConnection < Test::Unit::TestCase
|
|
128
|
+
def setup
|
|
129
|
+
@connection = FakeConnection.new('1234')
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
def assert_array_of(type, array)
|
|
133
|
+
assert_instance_of(Array, array)
|
|
134
|
+
array.each do |element|
|
|
135
|
+
assert_instance_of(type, element)
|
|
136
|
+
end
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
def assert_number_of(type, count, enum)
|
|
140
|
+
assert_kind_of(Enumerable, enum)
|
|
141
|
+
assert_equal(count, enum.find_all{|e|e.instance_of? type}.length)
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
def test_key
|
|
145
|
+
assert_equal('1234',@connection.service.key)
|
|
146
|
+
newreq = FakeConnection.new(1234)
|
|
147
|
+
assert_equal('1234',newreq.service.key)
|
|
148
|
+
newreq = FakeConnection.new(['1','2','3','4'])
|
|
149
|
+
assert_equal('1234',newreq.service.key)
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
def test_echo
|
|
153
|
+
assert_equal({"action"=>"echo",
|
|
154
|
+
"api_key"=>"1234",
|
|
155
|
+
"controller"=>"service"},
|
|
156
|
+
@connection.echo)
|
|
157
|
+
# and testing it with a proxy
|
|
158
|
+
req = FakeConnection.new(1234, "http://proxy.example.com")
|
|
159
|
+
assert_not_nil(req.proxy_addr)
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
def test_authentication_test
|
|
163
|
+
assert_equal("true", @connection.authentication_test("www","1234"))
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
def test_get_entry
|
|
167
|
+
content = "It's odd to say that the objective is survival rather than huge market success. But just making it work and sticking to it is the objective I'm after. Hopefully, by making sure the product we develop is meaningful and the work set-up is friendly and fun, drudgery will be held in abeyance and the world will be positively impacted by what we do.\\n\\nAnyway, about 2-3 times a day I'm struck with some paranoid thought or shuddering fear about making sure the company is still here in 2-3 years. It's like an internal emotional tide. Here comes the wave of utter terror! There goes the tide of dread and its a cresting wave of happiness again."
|
|
168
|
+
|
|
169
|
+
entry = @connection.get_entry(33)
|
|
170
|
+
assert_instance_of(R43::Response, @connection.response)
|
|
171
|
+
assert_array_of(Entry, @connection.response.entries)
|
|
172
|
+
assert_number_of(Entry, 1, @connection.response.entries)
|
|
173
|
+
assert_instance_of(Entry, entry)
|
|
174
|
+
assert_equal("Started - September 2004", entry.title)
|
|
175
|
+
assert_instance_of(Person, entry.author)
|
|
176
|
+
assert_equal("Josh Petersen", entry.author.name)
|
|
177
|
+
assert_equal("start a company that survives longer than 2 years",
|
|
178
|
+
entry.dc_subject)
|
|
179
|
+
assert_instance_of(Goal, entry.goal)
|
|
180
|
+
assert_equal(9, entry.goal.goal_id)
|
|
181
|
+
assert_equal(163, entry.goal.num_registered_people)
|
|
182
|
+
assert_equal(content, entry.content)
|
|
183
|
+
assert_equal(1, entry.num_comments)
|
|
184
|
+
assert_equal("2004-12-02T00:43:50Z", entry.issued)
|
|
185
|
+
assert_equal("http://www.43things.com/entries/view/33", entry.link)
|
|
186
|
+
assert_equal("tag:43things.com:joshp:entry:33", entry.id.to_s)
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
def test_get_goal_by_id
|
|
191
|
+
goal = @connection.get_goal_by_id(255)
|
|
192
|
+
assert_instance_of(Goal, goal)
|
|
193
|
+
assert_equal("Try out 43 Things", goal.name)
|
|
194
|
+
assert_equal("http://www.43things.com/things/view/255",
|
|
195
|
+
goal.link)
|
|
196
|
+
assert_equal(903, goal.num_registered_people)
|
|
197
|
+
assert_equal(180, goal.num_unregistered_people)
|
|
198
|
+
assert_equal(352, goal.num_say_worth_it)
|
|
199
|
+
assert_equal(21, goal.num_say_not_worth_it)
|
|
200
|
+
assert_equal(94, goal.percentage_worth_it)
|
|
201
|
+
assert_array_of(Tag, goal.tags)
|
|
202
|
+
assert_number_of(Tag, 5, goal.tags)
|
|
203
|
+
assert_equal("43 things", goal.tags[0].name)
|
|
204
|
+
assert_equal("testing", goal.tags[1].name)
|
|
205
|
+
assert_equal("beta", goal.tags[2].name)
|
|
206
|
+
assert_equal("beta test", goal.tags[3].name)
|
|
207
|
+
assert_equal("blog", goal.tags[4].name)
|
|
208
|
+
assert_equal("tag:43things.com:goal:255",goal.id.to_s)
|
|
209
|
+
end
|
|
210
|
+
|
|
211
|
+
def test_get_goal_by_name
|
|
212
|
+
goal = @connection.get_goal_by_name("Try out 43 Things")
|
|
213
|
+
assert_instance_of(Goal, goal)
|
|
214
|
+
assert_equal("Try out 43 Things", goal.name)
|
|
215
|
+
assert_equal("http://www.43things.com/things/view/255",
|
|
216
|
+
goal.link)
|
|
217
|
+
assert_equal(903, goal.num_registered_people)
|
|
218
|
+
assert_equal(180, goal.num_unregistered_people)
|
|
219
|
+
assert_equal(352, goal.num_say_worth_it)
|
|
220
|
+
assert_equal(21, goal.num_say_not_worth_it)
|
|
221
|
+
assert_equal(94, goal.percentage_worth_it)
|
|
222
|
+
assert_array_of(Tag, goal.tags)
|
|
223
|
+
assert_number_of(Tag, 5, goal.tags)
|
|
224
|
+
assert_equal("43 things", goal.tags[0].name)
|
|
225
|
+
assert_equal("testing", goal.tags[1].name)
|
|
226
|
+
assert_equal("beta", goal.tags[2].name)
|
|
227
|
+
assert_equal("beta test", goal.tags[3].name)
|
|
228
|
+
assert_equal("blog", goal.tags[4].name)
|
|
229
|
+
assert_equal("tag:43things.com:goal:255",goal.id.to_s)
|
|
230
|
+
end
|
|
231
|
+
|
|
232
|
+
def test_search_goals
|
|
233
|
+
goals = @connection.search_goals("schemer")
|
|
234
|
+
assert_array_of(Goal, goals)
|
|
235
|
+
assert_number_of(Goal, 1, goals)
|
|
236
|
+
assert_equal("finish reading The Little Schemer", goals[0].name)
|
|
237
|
+
goals = @connection.search_goals("ruby", {"offset" => 20, "max" => 10})
|
|
238
|
+
assert_array_of(Goal, goals)
|
|
239
|
+
assert_number_of(Goal, 10, goals)
|
|
240
|
+
assert_equal("Learn to program in Ruby", goals[0].name)
|
|
241
|
+
end
|
|
242
|
+
|
|
243
|
+
def test_get_goals_similarities
|
|
244
|
+
goals = @connection.get_goals_similarities(255)
|
|
245
|
+
assert_array_of(Goal, goals)
|
|
246
|
+
assert_equal(212,goals[0].goal_id)
|
|
247
|
+
assert_equal("Make Firefox my default browser",goals[1].name)
|
|
248
|
+
end
|
|
249
|
+
|
|
250
|
+
def test_get_goals_people
|
|
251
|
+
people = @connection.get_goals_people(533)
|
|
252
|
+
assert_array_of(Person, people)
|
|
253
|
+
assert_number_of(Person, 20, people)
|
|
254
|
+
assert_equal("pate", people[0].name)
|
|
255
|
+
people = @connection.get_goals_people(533,{"offset"=>20})
|
|
256
|
+
assert_array_of(Person, people)
|
|
257
|
+
assert_number_of(Person, 5, people)
|
|
258
|
+
assert_equal("Guan Yang", people[0].name)
|
|
259
|
+
end
|
|
260
|
+
|
|
261
|
+
def test_get_goals_entries
|
|
262
|
+
entries = @connection.get_goals_entries(533)
|
|
263
|
+
assert_array_of(Entry, entries)
|
|
264
|
+
assert_number_of(Entry, 4, entries)
|
|
265
|
+
assert_equal("pate", entries[0].author.name)
|
|
266
|
+
entries = @connection.get_goals_entries(255, {
|
|
267
|
+
"offset" => 20,
|
|
268
|
+
"max" => 10,
|
|
269
|
+
"view" => "done"
|
|
270
|
+
})
|
|
271
|
+
assert_array_of(Entry, entries)
|
|
272
|
+
assert_number_of(Entry, 10, entries)
|
|
273
|
+
assert_equal("iflynn",entries[0].author.name)
|
|
274
|
+
end
|
|
275
|
+
|
|
276
|
+
def test_search_people
|
|
277
|
+
people = @connection.search_people("Sean")
|
|
278
|
+
assert_array_of(Person, people)
|
|
279
|
+
assert_number_of(Person, 11, people)
|
|
280
|
+
assert_equal("Sean Carley", people[9].name)
|
|
281
|
+
end
|
|
282
|
+
|
|
283
|
+
def test_search_people_by_email
|
|
284
|
+
people = @connection.search_people_by_email("erik@mockerybird.com")
|
|
285
|
+
assert_array_of(Person, people)
|
|
286
|
+
assert_number_of(Person, 3, people)
|
|
287
|
+
assert_equal("ludwig", people[0].name)
|
|
288
|
+
end
|
|
289
|
+
|
|
290
|
+
def test_get_person
|
|
291
|
+
person = @connection.get_person("erik")
|
|
292
|
+
assert_instance_of(Person, person)
|
|
293
|
+
assert_equal("erik", person.username)
|
|
294
|
+
assert_equal("Erik Benson", person.name)
|
|
295
|
+
assert_equal("http://erikbenson.com", person.url)
|
|
296
|
+
assert_equal("http://images.43things.com/profile/00/00/22/8818s.jpg",person.profile_image_url)
|
|
297
|
+
assert_equal("http://www.43things.com/people/view/erik",person.link)
|
|
298
|
+
assert_instance_of(City, person.city)
|
|
299
|
+
assert_equal(1, person.city.city_id)
|
|
300
|
+
assert_array_of(Goal, person.goals)
|
|
301
|
+
assert_number_of(Goal, person.num_open_goals, person.goals)
|
|
302
|
+
assert_equal("tag:43things.com:Erik Benson:goal:44", person.goals[0].id.to_s)
|
|
303
|
+
assert_equal(person.num_open_goals, person.goals.length)
|
|
304
|
+
|
|
305
|
+
person2 = @connection.get_person("sweeting")
|
|
306
|
+
assert_equal("none", person2.profile_image_url)
|
|
307
|
+
assert_equal(nil,person2.city)
|
|
308
|
+
|
|
309
|
+
person3 = @connection.get_person("erikbenson", true)
|
|
310
|
+
assert_equal("erikbenson",person3.flickr_username)
|
|
311
|
+
assert_equal(person.username, person3.username)
|
|
312
|
+
assert_equal(person.name, person3.name)
|
|
313
|
+
assert_equal(person.url, person3.url)
|
|
314
|
+
assert_equal(person.profile_image_url, person3.profile_image_url)
|
|
315
|
+
assert_equal(person.num_open_goals, person3.num_open_goals)
|
|
316
|
+
assert_equal(person.link, person3.link)
|
|
317
|
+
assert_equal(person.flickr_username, person3.flickr_username)
|
|
318
|
+
end
|
|
319
|
+
|
|
320
|
+
def test_get_persons_completed_things
|
|
321
|
+
person = @connection.get_persons_completed_things("erik")
|
|
322
|
+
assert_instance_of(Person, person)
|
|
323
|
+
goals = person.completed_goals
|
|
324
|
+
assert_array_of(Goal, goals)
|
|
325
|
+
assert_number_of(Goal, 10, goals)
|
|
326
|
+
assert_equal("Erik Benson", person.name)
|
|
327
|
+
assert_equal(122313, goals[0].goal_id)
|
|
328
|
+
end
|
|
329
|
+
|
|
330
|
+
def test_get_persons_entries
|
|
331
|
+
assert_equal(true, true)
|
|
332
|
+
entries = @connection.get_persons_entries("erik")
|
|
333
|
+
assert_array_of(Entry, entries)
|
|
334
|
+
assert_number_of(Entry, 20, entries)
|
|
335
|
+
end
|
|
336
|
+
|
|
337
|
+
def test_get_persons_progress_on_goal
|
|
338
|
+
entries = @connection.get_persons_progress_on_goal("erik", 9)
|
|
339
|
+
assert_array_of(Entry, entries)
|
|
340
|
+
assert_number_of(Entry, 1, entries)
|
|
341
|
+
|
|
342
|
+
goal = @connection.response.goals[0]
|
|
343
|
+
assert_instance_of(Goal, goal)
|
|
344
|
+
assert_equal(9, goal.goal_id)
|
|
345
|
+
|
|
346
|
+
assert_array_of(Tag, @connection.response.tags)
|
|
347
|
+
assert_number_of(Tag, 3, @connection.response.tags)
|
|
348
|
+
|
|
349
|
+
# TODO: test progress
|
|
350
|
+
end
|
|
351
|
+
|
|
352
|
+
def test_get_persons_teammates
|
|
353
|
+
teammates = @connection.get_persons_teammates("erik")
|
|
354
|
+
assert_array_of(Person, teammates)
|
|
355
|
+
assert_number_of(Person, 18, teammates)
|
|
356
|
+
# TODO: test with flickr_username
|
|
357
|
+
# TODO: find someone with more than 20 teammates and test
|
|
358
|
+
# with pagination
|
|
359
|
+
end
|
|
360
|
+
|
|
361
|
+
def test_get_persons_neighbors
|
|
362
|
+
neighbors = @connection.get_persons_neighbors("erik")
|
|
363
|
+
assert_array_of(Person, neighbors)
|
|
364
|
+
assert_number_of(Person, 20, neighbors)
|
|
365
|
+
neighbors += @connection.more
|
|
366
|
+
assert_array_of(Person, neighbors)
|
|
367
|
+
assert_number_of(Person, 40, neighbors)
|
|
368
|
+
end
|
|
369
|
+
|
|
370
|
+
def test_get_persons_tags
|
|
371
|
+
tags = @connection.get_persons_tags("erik")
|
|
372
|
+
assert_array_of(Tag, tags)
|
|
373
|
+
assert_equal(4, tags[0].count)
|
|
374
|
+
assert_equal("music", tags[0].name)
|
|
375
|
+
# TODO: test with flickr_username
|
|
376
|
+
end
|
|
377
|
+
|
|
378
|
+
def test_get_persons_tag_cloud
|
|
379
|
+
tags = @connection.get_persons_tag_cloud("erik")
|
|
380
|
+
assert_array_of(Tag, tags)
|
|
381
|
+
assert_equal(4416, tags[0].count)
|
|
382
|
+
assert_equal("travel", tags[0].name)
|
|
383
|
+
# TODO: test with flickr_username
|
|
384
|
+
end
|
|
385
|
+
|
|
386
|
+
def test_search_cities
|
|
387
|
+
cities = @connection.search_cities("london")
|
|
388
|
+
assert_instance_of(Array, cities)
|
|
389
|
+
assert_equal(16, cities.length)
|
|
390
|
+
assert_equal("United Kingdom", cities[0].country)
|
|
391
|
+
cities.each { |city| assert_instance_of(City, city) }
|
|
392
|
+
end
|
|
393
|
+
|
|
394
|
+
def test_get_city
|
|
395
|
+
city = @connection.get_city(36)
|
|
396
|
+
assert_instance_of(R43::Response, @connection.response)
|
|
397
|
+
assert_equal(1, @connection.response.cities.length)
|
|
398
|
+
assert_instance_of(Array, @connection.response.cities)
|
|
399
|
+
assert_instance_of(City, city)
|
|
400
|
+
assert_equal("Kent", city.name)
|
|
401
|
+
assert_equal("Washington", city.region)
|
|
402
|
+
assert_equal("United States", city.country)
|
|
403
|
+
assert_equal(6, city.num_people)
|
|
404
|
+
assert_equal(20, city.goals.length)
|
|
405
|
+
end
|
|
406
|
+
|
|
407
|
+
def test_get_citys_people
|
|
408
|
+
people = @connection.get_citys_people(1164)
|
|
409
|
+
assert_instance_of(Array, people)
|
|
410
|
+
assert_equal("zerokarmaleft", people[5].username)
|
|
411
|
+
people.each { |person| assert_instance_of(Person, person) }
|
|
412
|
+
people += @connection.more()
|
|
413
|
+
assert_equal(21, people.length)
|
|
414
|
+
assert_equal("JoelBlain", people[20].username)
|
|
415
|
+
|
|
416
|
+
people = @connection.get_citys_people(1164, {"offset" => 20,"max" => 20 })
|
|
417
|
+
assert_equal(1, people.length)
|
|
418
|
+
assert_equal("JoelBlain", people[0].username)
|
|
419
|
+
people.each { |person| assert_instance_of(Person, person) }
|
|
420
|
+
end
|
|
421
|
+
end
|
|
422
|
+
|
|
423
|
+
class TestResponse < Test::Unit::TestCase
|
|
424
|
+
def setup
|
|
425
|
+
@connection = FakeConnection.new('1234')
|
|
426
|
+
end
|
|
427
|
+
|
|
428
|
+
def assert_array_of(type, array)
|
|
429
|
+
assert_instance_of(Array, array)
|
|
430
|
+
array.each do |element|
|
|
431
|
+
assert_instance_of(type, element)
|
|
432
|
+
end
|
|
433
|
+
end
|
|
434
|
+
|
|
435
|
+
def assert_number_of(type, count, enum)
|
|
436
|
+
assert_kind_of(Enumerable, enum)
|
|
437
|
+
assert_equal(count, enum.find_all{|e|e.instance_of? type}.length)
|
|
438
|
+
end
|
|
439
|
+
|
|
440
|
+
def test_more
|
|
441
|
+
goals = @connection.search_goals("ruby")
|
|
442
|
+
goals += @connection.more
|
|
443
|
+
assert_array_of(Goal, goals)
|
|
444
|
+
assert_number_of(Goal, 40, goals)
|
|
445
|
+
end
|
|
446
|
+
end
|
|
447
|
+
|
|
448
|
+
class TestGoal < Test::Unit::TestCase
|
|
449
|
+
def setup
|
|
450
|
+
@goal_id = 255
|
|
451
|
+
@name = "Try out 43 Things"
|
|
452
|
+
@link = "http://www.43things.com/things/view/255"
|
|
453
|
+
@num_registered_people = 899
|
|
454
|
+
@num_unregistered_people = 175
|
|
455
|
+
@num_say_worth_it = 349
|
|
456
|
+
@num_say_not_worth_it = 21
|
|
457
|
+
@percentage_worth_it = 94
|
|
458
|
+
@tags = ["43 things","testing","beta","beta test","blog"]
|
|
459
|
+
@id = "tag:43things.com:goal:255"
|
|
460
|
+
@progress_link = "http://www.43things.com/people/progress/erik/59"
|
|
461
|
+
@team_link = "http://www.43things.com/teams/progress/59"
|
|
462
|
+
@goal = Goal.new()
|
|
463
|
+
end
|
|
464
|
+
|
|
465
|
+
def test_progress_link
|
|
466
|
+
assert_nil(@goal.progress_link)
|
|
467
|
+
end
|
|
468
|
+
|
|
469
|
+
def test_progress_link=()
|
|
470
|
+
@goal.progress_link= @progress_link
|
|
471
|
+
assert_equal(@progress_link,@goal.progress_link)
|
|
472
|
+
end
|
|
473
|
+
|
|
474
|
+
def test_team_link
|
|
475
|
+
assert_nil(@goal.team_link)
|
|
476
|
+
end
|
|
477
|
+
|
|
478
|
+
def test_team_link=()
|
|
479
|
+
@goal.team_link= @team_link
|
|
480
|
+
assert_equal(@team_link,@goal.team_link)
|
|
481
|
+
end
|
|
482
|
+
|
|
483
|
+
def test_goal_id
|
|
484
|
+
assert_nil(@goal.goal_id)
|
|
485
|
+
end
|
|
486
|
+
|
|
487
|
+
def test_goal_id
|
|
488
|
+
@goal.goal_id= @goal_id
|
|
489
|
+
assert_equal(@goal_id, @goal.goal_id)
|
|
490
|
+
end
|
|
491
|
+
|
|
492
|
+
def test_name
|
|
493
|
+
assert_equal(nil,@goal.name)
|
|
494
|
+
end
|
|
495
|
+
|
|
496
|
+
def test_name
|
|
497
|
+
@goal.name= @name
|
|
498
|
+
assert_equal(@name,@goal.name)
|
|
499
|
+
end
|
|
500
|
+
|
|
501
|
+
def test_link
|
|
502
|
+
assert_nil(@goal.link)
|
|
503
|
+
end
|
|
504
|
+
|
|
505
|
+
def test_link
|
|
506
|
+
@goal.link= @link
|
|
507
|
+
assert_equal(@link, @goal.link)
|
|
508
|
+
end
|
|
509
|
+
|
|
510
|
+
def test_num_registered_people
|
|
511
|
+
assert_nil(@goal.num_registered_people)
|
|
512
|
+
end
|
|
513
|
+
|
|
514
|
+
def test_num_registered_people=
|
|
515
|
+
@goal.num_registered_people= @num_registered_people
|
|
516
|
+
assert_equal(@num_registered_people, @goal.num_registered_people)
|
|
517
|
+
end
|
|
518
|
+
|
|
519
|
+
def test_num_unregistered_people
|
|
520
|
+
assert_nil(@goal.num_unregistered_people)
|
|
521
|
+
end
|
|
522
|
+
|
|
523
|
+
def test_num_unregistered_people=
|
|
524
|
+
@goal.num_unregistered_people= @num_unregistered_people
|
|
525
|
+
assert_equal(@num_unregistered_people, @goal.num_unregistered_people)
|
|
526
|
+
end
|
|
527
|
+
|
|
528
|
+
def test_num_say_worth_it
|
|
529
|
+
assert_nil(@goal.num_say_worth_it)
|
|
530
|
+
end
|
|
531
|
+
|
|
532
|
+
def test_num_say_worth_it=
|
|
533
|
+
@goal.num_say_worth_it= @num_say_worth_it
|
|
534
|
+
assert_equal(@num_say_worth_it, @goal.num_say_worth_it)
|
|
535
|
+
end
|
|
536
|
+
|
|
537
|
+
def test_num_say_not_worth_it
|
|
538
|
+
assert_nil(@goal.num_say_not_worth_it)
|
|
539
|
+
end
|
|
540
|
+
|
|
541
|
+
def test_num_say_not_worth_it=
|
|
542
|
+
@goal.num_say_not_worth_it= @num_say_not_worth_it
|
|
543
|
+
assert_equal(@num_say_not_worth_it, @goal.num_say_not_worth_it)
|
|
544
|
+
end
|
|
545
|
+
|
|
546
|
+
def test_percentage_worth_it
|
|
547
|
+
assert_nil(@goal.percentage_worth_it)
|
|
548
|
+
end
|
|
549
|
+
|
|
550
|
+
def test_percentage_worth_it=
|
|
551
|
+
@goal.percentage_worth_it= @percentage_worth_it
|
|
552
|
+
assert_equal(@percentage_worth_it, @goal.percentage_worth_it)
|
|
553
|
+
end
|
|
554
|
+
|
|
555
|
+
def test_tags
|
|
556
|
+
assert_equal(nil,@goal.tags)
|
|
557
|
+
end
|
|
558
|
+
|
|
559
|
+
def test_tags
|
|
560
|
+
@goal.tags= @tags
|
|
561
|
+
assert_instance_of(Array, @goal.tags)
|
|
562
|
+
assert_equal(@tags,@goal.tags)
|
|
563
|
+
end
|
|
564
|
+
|
|
565
|
+
def test_id
|
|
566
|
+
assert_equal(nil,@goal.id)
|
|
567
|
+
end
|
|
568
|
+
|
|
569
|
+
def test_id=
|
|
570
|
+
@goal.id= @id
|
|
571
|
+
assert_equal(@id,@goal.id)
|
|
572
|
+
end
|
|
573
|
+
end
|
|
574
|
+
|
|
575
|
+
|
|
576
|
+
class TestPerson < Test::Unit::TestCase
|
|
577
|
+
def setup
|
|
578
|
+
@username = "erik"
|
|
579
|
+
@name = "Erik Benson"
|
|
580
|
+
@url = "http://erikbenson.com"
|
|
581
|
+
@profile_image_url = "http://www.43things.com/profile/00/00/17/6124s.jpg"
|
|
582
|
+
@num_open_goals = 32
|
|
583
|
+
@link = "http://www.43things.com/people/view/erik"
|
|
584
|
+
@city = [
|
|
585
|
+
"Seattle","Washington","United States",
|
|
586
|
+
236, "http://www.43things.com/city/view/1"]
|
|
587
|
+
goal1 = Goal.new()
|
|
588
|
+
@goals = [goal1]
|
|
589
|
+
@testPerson = Person.new()
|
|
590
|
+
end
|
|
591
|
+
|
|
592
|
+
def test_city
|
|
593
|
+
assert_nil(@testPerson.city)
|
|
594
|
+
end
|
|
595
|
+
|
|
596
|
+
def test_city=
|
|
597
|
+
@testPerson.city= @city
|
|
598
|
+
assert_equal(@city, @testPerson.city)
|
|
599
|
+
end
|
|
600
|
+
|
|
601
|
+
def test_goals
|
|
602
|
+
assert_nil(@testPerson.goals)
|
|
603
|
+
end
|
|
604
|
+
|
|
605
|
+
def test_goals=
|
|
606
|
+
@testPerson.goals= @goals
|
|
607
|
+
assert_equal(@goals, @testPerson.goals)
|
|
608
|
+
end
|
|
609
|
+
|
|
610
|
+
def test_profile_image_url
|
|
611
|
+
assert_nil(@testPerson.profile_image_url)
|
|
612
|
+
end
|
|
613
|
+
|
|
614
|
+
def test_profile_image_url=
|
|
615
|
+
@testPerson.profile_image_url= @profile_image_url
|
|
616
|
+
assert_equal(@profile_image_url, @testPerson.profile_image_url)
|
|
617
|
+
end
|
|
618
|
+
|
|
619
|
+
def test_link
|
|
620
|
+
assert_nil(@testPerson.link)
|
|
621
|
+
end
|
|
622
|
+
|
|
623
|
+
def test_link=
|
|
624
|
+
@testPerson.link= @link
|
|
625
|
+
assert_equal(@link, @testPerson.link)
|
|
626
|
+
end
|
|
627
|
+
|
|
628
|
+
def test_num_open_goals
|
|
629
|
+
assert_nil(@testPerson.num_open_goals)
|
|
630
|
+
end
|
|
631
|
+
|
|
632
|
+
def test_num_open_goals=
|
|
633
|
+
@testPerson.num_open_goals= @num_open_goals
|
|
634
|
+
assert_equal(@num_open_goals, @testPerson.num_open_goals)
|
|
635
|
+
end
|
|
636
|
+
|
|
637
|
+
def test_url
|
|
638
|
+
assert_nil(@testPerson.url)
|
|
639
|
+
end
|
|
640
|
+
|
|
641
|
+
def test_url=
|
|
642
|
+
@testPerson.url= @url
|
|
643
|
+
assert_equal(@url, @testPerson.url)
|
|
644
|
+
end
|
|
645
|
+
|
|
646
|
+
def test_username
|
|
647
|
+
assert_nil(@testPerson.username)
|
|
648
|
+
end
|
|
649
|
+
|
|
650
|
+
def test_username
|
|
651
|
+
@testPerson.username= @username
|
|
652
|
+
assert_equal(@username, @testPerson.username)
|
|
653
|
+
end
|
|
654
|
+
|
|
655
|
+
end
|
|
656
|
+
|
|
657
|
+
|
|
658
|
+
class TestEntry < Test::Unit::TestCase
|
|
659
|
+
|
|
660
|
+
def setup
|
|
661
|
+
@title = "Started - September 2004"
|
|
662
|
+
@author = {
|
|
663
|
+
"name" => "Josh Petersen",
|
|
664
|
+
"username" => "joshp",
|
|
665
|
+
"url" => "http://joshp.typepad.com",
|
|
666
|
+
"num_open_goals" => 41,
|
|
667
|
+
"link" => "http://www.43things.com/people/view/joshp"
|
|
668
|
+
}
|
|
669
|
+
@dc_subject = "start a company that survives longer than 2 years"
|
|
670
|
+
@goal = {
|
|
671
|
+
"goal_id" => 9,
|
|
672
|
+
"name" => "Start a company that survives longer than 2 years",
|
|
673
|
+
"link" => "http://www.43things.com/things/view/9",
|
|
674
|
+
"num_registered_people" => 162,
|
|
675
|
+
"num_unregistered_people" => 16,
|
|
676
|
+
"id" => "tag:43things.com:goal:9"
|
|
677
|
+
}
|
|
678
|
+
@content = "It's odd to say that the objective is survival rather than huge market success. But just making it work and sticking to it is the objective I'm after. Hopefully, by making sure the product we develop is meaningful and the work set-up is friendly and fun, drudgery will be held in abeyance and the world will be positively impacted by what we do.
|
|
679
|
+
|
|
680
|
+
Anyway, about 2-3 times a day I'm struck with some paranoid thought or shuddering fear about making sure the company is still here in 2-3 years. It's like an internal emotional tide. Here comes the wave of utter terror! There goes the tide of dread and its a cresting wave of happiness again."
|
|
681
|
+
@num_comments = 1
|
|
682
|
+
@issued = "2004-12-02T00:43:50Z"
|
|
683
|
+
@link = "http://www.43things.com/entries/view/33"
|
|
684
|
+
@id = "tag:43things.com:joshp:entry:33"
|
|
685
|
+
|
|
686
|
+
@entry = Entry.new()
|
|
687
|
+
end
|
|
688
|
+
|
|
689
|
+
def test_title
|
|
690
|
+
assert_nil(@entry.title)
|
|
691
|
+
end
|
|
692
|
+
|
|
693
|
+
def test_title=
|
|
694
|
+
@entry.title=@title
|
|
695
|
+
assert_equal(@title, @entry.title)
|
|
696
|
+
end
|
|
697
|
+
|
|
698
|
+
def test_author
|
|
699
|
+
assert_nil(@entry.author)
|
|
700
|
+
end
|
|
701
|
+
|
|
702
|
+
def test_author=
|
|
703
|
+
@entry.author=@author
|
|
704
|
+
assert_equal(@author, @entry.author)
|
|
705
|
+
end
|
|
706
|
+
|
|
707
|
+
def test_dc_subject
|
|
708
|
+
assert_nil(@entry.dc_subject)
|
|
709
|
+
end
|
|
710
|
+
|
|
711
|
+
def test_dc_subject=
|
|
712
|
+
@entry.dc_subject=@dc_subject
|
|
713
|
+
assert_equal(@dc_subject, @entry.dc_subject)
|
|
714
|
+
end
|
|
715
|
+
|
|
716
|
+
def test_goal
|
|
717
|
+
assert_nil(@entry.goal)
|
|
718
|
+
end
|
|
719
|
+
|
|
720
|
+
def test_goal=
|
|
721
|
+
@entry.goal=@goal
|
|
722
|
+
assert_equal(@goal, @entry.goal)
|
|
723
|
+
end
|
|
724
|
+
|
|
725
|
+
def test_content
|
|
726
|
+
assert_nil(@entry.content)
|
|
727
|
+
end
|
|
728
|
+
|
|
729
|
+
def test_content=
|
|
730
|
+
@entry.content=@content
|
|
731
|
+
assert_equal(@content, @entry.content)
|
|
732
|
+
end
|
|
733
|
+
|
|
734
|
+
def test_num_comments
|
|
735
|
+
assert_nil(@entry.num_comments)
|
|
736
|
+
end
|
|
737
|
+
|
|
738
|
+
def test_num_comments=
|
|
739
|
+
@entry.num_comments=@num_comments
|
|
740
|
+
assert_equal(@num_comments, @entry.num_comments)
|
|
741
|
+
end
|
|
742
|
+
|
|
743
|
+
def test_issued
|
|
744
|
+
assert_nil(@entry.issued)
|
|
745
|
+
end
|
|
746
|
+
|
|
747
|
+
def test_issued=
|
|
748
|
+
@entry.issued=@issued
|
|
749
|
+
assert_equal(@issued, @entry.issued)
|
|
750
|
+
end
|
|
751
|
+
|
|
752
|
+
def test_link
|
|
753
|
+
assert_nil(@entry.link)
|
|
754
|
+
end
|
|
755
|
+
|
|
756
|
+
def test_link=
|
|
757
|
+
@entry.link=@link
|
|
758
|
+
assert_equal(@link, @entry.link)
|
|
759
|
+
end
|
|
760
|
+
|
|
761
|
+
def test_id
|
|
762
|
+
assert_nil(@entry.id)
|
|
763
|
+
end
|
|
764
|
+
|
|
765
|
+
def test_id=
|
|
766
|
+
@entry.id=@id
|
|
767
|
+
assert_equal(@id, @entry.id)
|
|
768
|
+
end
|
|
769
|
+
end
|
|
770
|
+
|
|
771
|
+
|
|
772
|
+
class TestCity < Test::Unit::TestCase
|
|
773
|
+
def setup
|
|
774
|
+
@city_id = 36
|
|
775
|
+
@name = 'Kent'
|
|
776
|
+
@region = 'Washington'
|
|
777
|
+
@country = 'USA'
|
|
778
|
+
@num_people = 2
|
|
779
|
+
@link = "http://www.43things.com/city/view/36"
|
|
780
|
+
goal1 = Goal.new
|
|
781
|
+
@goals = [goal1]
|
|
782
|
+
@city = City.new
|
|
783
|
+
end
|
|
784
|
+
|
|
785
|
+
def test_new
|
|
786
|
+
assert_instance_of(City, @city)
|
|
787
|
+
end
|
|
788
|
+
|
|
789
|
+
def test_name
|
|
790
|
+
assert_nil(@city.name)
|
|
791
|
+
end
|
|
792
|
+
|
|
793
|
+
def test_name=()
|
|
794
|
+
@city.name= @name
|
|
795
|
+
assert_equal(@name, @city.name)
|
|
796
|
+
end
|
|
797
|
+
|
|
798
|
+
def test_city_id
|
|
799
|
+
assert_nil(@city.city_id)
|
|
800
|
+
end
|
|
801
|
+
|
|
802
|
+
def test_city_id=()
|
|
803
|
+
@city.city_id= @city_id
|
|
804
|
+
assert_equal(@city_id, @city.city_id)
|
|
805
|
+
end
|
|
806
|
+
|
|
807
|
+
def test_region
|
|
808
|
+
assert_nil(@city.region)
|
|
809
|
+
end
|
|
810
|
+
|
|
811
|
+
def test_region=()
|
|
812
|
+
@city.region= @region
|
|
813
|
+
assert_equal(@region, @city.region)
|
|
814
|
+
end
|
|
815
|
+
|
|
816
|
+
def test_country
|
|
817
|
+
assert_nil(@city.country)
|
|
818
|
+
end
|
|
819
|
+
|
|
820
|
+
def test_country=()
|
|
821
|
+
@city.country= @country
|
|
822
|
+
assert_equal(@country, @city.country)
|
|
823
|
+
end
|
|
824
|
+
|
|
825
|
+
def test_num_people
|
|
826
|
+
assert_nil(@city.num_people)
|
|
827
|
+
end
|
|
828
|
+
|
|
829
|
+
def test_num_people=()
|
|
830
|
+
@city.num_people= @num_people
|
|
831
|
+
assert_equal(@num_people, @city.num_people)
|
|
832
|
+
end
|
|
833
|
+
|
|
834
|
+
def test_link
|
|
835
|
+
assert_nil(@city.link)
|
|
836
|
+
end
|
|
837
|
+
|
|
838
|
+
def test_link=()
|
|
839
|
+
@city.link= @link
|
|
840
|
+
assert_equal(@link, @city.link)
|
|
841
|
+
end
|
|
842
|
+
|
|
843
|
+
def test_goals
|
|
844
|
+
assert_nil(@city.goals)
|
|
845
|
+
end
|
|
846
|
+
|
|
847
|
+
def test_goals=()
|
|
848
|
+
@city.goals= @goals
|
|
849
|
+
assert_equal(@goals, @city.goals)
|
|
850
|
+
end
|
|
851
|
+
end
|
|
852
|
+
|