whatser 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. data/.document +5 -0
  2. data/Gemfile +12 -0
  3. data/Gemfile.lock +34 -0
  4. data/LICENSE.txt +20 -0
  5. data/README.rdoc +310 -0
  6. data/Rakefile +53 -0
  7. data/VERSION +1 -0
  8. data/lib/whatser/api/batch.rb +0 -0
  9. data/lib/whatser/api/facebook.rb +13 -0
  10. data/lib/whatser/api/foursquare.rb +5 -0
  11. data/lib/whatser/api/gowalla.rb +5 -0
  12. data/lib/whatser/api/response.rb +84 -0
  13. data/lib/whatser/api/service.rb +15 -0
  14. data/lib/whatser/api/twitter.rb +13 -0
  15. data/lib/whatser/client.rb +54 -0
  16. data/lib/whatser/configuration.rb +15 -0
  17. data/lib/whatser/errors.rb +4 -0
  18. data/lib/whatser/net/http.rb +26 -0
  19. data/lib/whatser/net/oauth.rb +41 -0
  20. data/lib/whatser/resources/activity_feed.rb +20 -0
  21. data/lib/whatser/resources/check_in.rb +25 -0
  22. data/lib/whatser/resources/city.rb +16 -0
  23. data/lib/whatser/resources/collection.rb +68 -0
  24. data/lib/whatser/resources/data_source.rb +24 -0
  25. data/lib/whatser/resources/detail.rb +40 -0
  26. data/lib/whatser/resources/follow.rb +42 -0
  27. data/lib/whatser/resources/media.rb +41 -0
  28. data/lib/whatser/resources/poi.rb +74 -0
  29. data/lib/whatser/resources/resource.rb +53 -0
  30. data/lib/whatser/resources/review.rb +40 -0
  31. data/lib/whatser/resources/subscription.rb +12 -0
  32. data/lib/whatser/resources/tag.rb +32 -0
  33. data/lib/whatser/resources/user.rb +81 -0
  34. data/lib/whatser.rb +38 -0
  35. data/test/helper.rb +25 -0
  36. data/test/test_activity_feed.rb +20 -0
  37. data/test/test_check_in.rb +28 -0
  38. data/test/test_city.rb +16 -0
  39. data/test/test_client.rb +84 -0
  40. data/test/test_collection.rb +28 -0
  41. data/test/test_configuration.rb +26 -0
  42. data/test/test_data_source.rb +35 -0
  43. data/test/test_detail.rb +38 -0
  44. data/test/test_facebook.rb +7 -0
  45. data/test/test_follow.rb +33 -0
  46. data/test/test_foursquare.rb +7 -0
  47. data/test/test_gowalla.rb +7 -0
  48. data/test/test_hondius.rb +12 -0
  49. data/test/test_http.rb +40 -0
  50. data/test/test_oauth.rb +37 -0
  51. data/test/test_poi.rb +75 -0
  52. data/test/test_resource.rb +73 -0
  53. data/test/test_response.rb +44 -0
  54. data/test/test_review.rb +37 -0
  55. data/test/test_subscription.rb +11 -0
  56. data/test/test_tag.rb +32 -0
  57. data/test/test_twitter.rb +7 -0
  58. data/test/test_user.rb +53 -0
  59. data/whatser.gemspec +140 -0
  60. metadata +236 -0
@@ -0,0 +1,37 @@
1
+ require 'helper'
2
+
3
+ class TestReview < Test::Unit::TestCase
4
+ def setup
5
+ @client = Whatser::Client.new
6
+ @poi_id = 1
7
+ @review = Whatser::Review.new(:poi_id => @poi_id, :body => 'four stars')
8
+ end
9
+
10
+ def test_list
11
+ assert @client.reviews.list(@poi_id, :page => 1).is_a?(Whatser::Response)
12
+ end
13
+
14
+ def test_create
15
+ assert @client.reviews.create(@poi_id, :body => 'four stars').is_a?(Whatser::Response)
16
+ end
17
+
18
+ def test_delete
19
+ assert @client.reviews.delete(@poi_id, :body => 'four stars').is_a?(Whatser::Response)
20
+ end
21
+
22
+ def test_save
23
+ assert @review.save.is_a?(Whatser::Response)
24
+ end
25
+
26
+ def test_update
27
+ @review.id = 1
28
+ assert @review.save.is_a?(Whatser::Response)
29
+ end
30
+
31
+ def test_to_params
32
+ params = [:body]
33
+ params.each do |p|
34
+ assert @review.to_params.keys.include?(p)
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,11 @@
1
+ require 'helper'
2
+
3
+ class TestSubscription < Test::Unit::TestCase
4
+ def setup
5
+ @client = Whatser::Client.new(:oauth_token => '1234')
6
+ end
7
+
8
+ def test_list
9
+ assert @client.subscriptions.list( :page => 1, :per_page => 10 ).is_a?(Whatser::Response)
10
+ end
11
+ end
data/test/test_tag.rb ADDED
@@ -0,0 +1,32 @@
1
+ require 'helper'
2
+
3
+ class TestTag < Test::Unit::TestCase
4
+ def setup
5
+ @client = Whatser::Client.new
6
+ @poi_id = 1
7
+ @tag = Whatser::Tag.new(:poi_id => @poi_id, :name => 'my tag')
8
+ end
9
+
10
+ def test_list
11
+ assert @client.tags.list(@poi_id, :page => 1).is_a?(Whatser::Response)
12
+ end
13
+
14
+ def test_create
15
+ assert @client.tags.create(@poi_id, 'my tag').is_a?(Whatser::Response)
16
+ end
17
+
18
+ def test_delete
19
+ assert @client.tags.delete(@poi_id, 'my tag').is_a?(Whatser::Response)
20
+ end
21
+
22
+ def test_save
23
+ assert @tag.save.is_a?(Whatser::Response)
24
+ end
25
+
26
+ def test_to_params
27
+ params = [:name]
28
+ params.each do |p|
29
+ assert @tag.to_params.keys.include?(p)
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,7 @@
1
+ require 'helper'
2
+
3
+ class TestTwitter < Test::Unit::TestCase
4
+ def test_key
5
+ assert_equal 'twitter', Whatser::Twitter.new.key
6
+ end
7
+ end
data/test/test_user.rb ADDED
@@ -0,0 +1,53 @@
1
+ require 'helper'
2
+
3
+ class TestUser < Test::Unit::TestCase
4
+ def setup
5
+ @client = Whatser::Client.new
6
+ @user = Whatser::User.new
7
+ end
8
+
9
+ def test_to_params
10
+ user = Whatser::User.new
11
+ params = [:name,:avatar_pic,:location,:bio,:email]
12
+ params.each do |p|
13
+ assert user.to_params.keys.include?(p)
14
+ end
15
+ end
16
+
17
+ def test_me
18
+ assert @client.users.me.is_a?(Whatser::Response)
19
+ end
20
+
21
+ def test_suggested
22
+ assert @client.users.suggested.is_a?(Whatser::Response)
23
+ end
24
+
25
+ def test_find
26
+ assert @client.users.find(1, :opt => 'test').is_a?(Whatser::Response)
27
+ end
28
+
29
+ def test_search
30
+ assert @client.users.search(:opt => 'test').is_a?(Whatser::Response)
31
+ end
32
+
33
+ def test_anonymous
34
+ assert @client.users.anonymous.is_a?(Whatser::Response)
35
+ end
36
+
37
+ def test_invite
38
+ assert @client.users.invite( :emails => 'first@example.com;second@example.com' ).is_a?(Whatser::Response)
39
+ end
40
+
41
+ def test_create
42
+ assert @client.users.create(:name => 'test', :email => 'test@example.com', :password => '123pass').is_a?(Whatser::Response)
43
+ end
44
+
45
+ def test_save
46
+ assert @user.save.is_a?(Whatser::Response)
47
+ end
48
+
49
+ def test_save_and_update
50
+ @user.id = 1
51
+ assert @user.save.is_a?(Whatser::Response)
52
+ end
53
+ end
data/whatser.gemspec ADDED
@@ -0,0 +1,140 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{whatser}
8
+ s.version = "0.2.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Travis Dunn"]
12
+ s.date = %q{2011-01-12}
13
+ s.description = %q{The 'Whatser API' Gem is a simple Ruby / Rails wrapper for interacting with Whatser's location-based web services (see http://docs.sogeoapi.com for more details).}
14
+ s.email = %q{cmd@travisdunn.com}
15
+ s.extra_rdoc_files = [
16
+ "LICENSE.txt",
17
+ "README.rdoc"
18
+ ]
19
+ s.files = [
20
+ ".document",
21
+ "Gemfile",
22
+ "Gemfile.lock",
23
+ "LICENSE.txt",
24
+ "README.rdoc",
25
+ "Rakefile",
26
+ "VERSION",
27
+ "lib/whatser.rb",
28
+ "lib/whatser/api/batch.rb",
29
+ "lib/whatser/api/facebook.rb",
30
+ "lib/whatser/api/foursquare.rb",
31
+ "lib/whatser/api/gowalla.rb",
32
+ "lib/whatser/api/response.rb",
33
+ "lib/whatser/api/service.rb",
34
+ "lib/whatser/api/twitter.rb",
35
+ "lib/whatser/client.rb",
36
+ "lib/whatser/configuration.rb",
37
+ "lib/whatser/errors.rb",
38
+ "lib/whatser/net/http.rb",
39
+ "lib/whatser/net/oauth.rb",
40
+ "lib/whatser/resources/activity_feed.rb",
41
+ "lib/whatser/resources/check_in.rb",
42
+ "lib/whatser/resources/city.rb",
43
+ "lib/whatser/resources/collection.rb",
44
+ "lib/whatser/resources/data_source.rb",
45
+ "lib/whatser/resources/detail.rb",
46
+ "lib/whatser/resources/follow.rb",
47
+ "lib/whatser/resources/media.rb",
48
+ "lib/whatser/resources/poi.rb",
49
+ "lib/whatser/resources/resource.rb",
50
+ "lib/whatser/resources/review.rb",
51
+ "lib/whatser/resources/subscription.rb",
52
+ "lib/whatser/resources/tag.rb",
53
+ "lib/whatser/resources/user.rb",
54
+ "test/helper.rb",
55
+ "test/test_activity_feed.rb",
56
+ "test/test_check_in.rb",
57
+ "test/test_city.rb",
58
+ "test/test_client.rb",
59
+ "test/test_collection.rb",
60
+ "test/test_configuration.rb",
61
+ "test/test_data_source.rb",
62
+ "test/test_detail.rb",
63
+ "test/test_facebook.rb",
64
+ "test/test_follow.rb",
65
+ "test/test_foursquare.rb",
66
+ "test/test_gowalla.rb",
67
+ "test/test_hondius.rb",
68
+ "test/test_http.rb",
69
+ "test/test_oauth.rb",
70
+ "test/test_poi.rb",
71
+ "test/test_resource.rb",
72
+ "test/test_response.rb",
73
+ "test/test_review.rb",
74
+ "test/test_subscription.rb",
75
+ "test/test_tag.rb",
76
+ "test/test_twitter.rb",
77
+ "test/test_user.rb",
78
+ "whatser.gemspec"
79
+ ]
80
+ s.homepage = %q{http://github.com/sogeo/whatser}
81
+ s.licenses = ["MIT"]
82
+ s.require_paths = ["lib"]
83
+ s.rubygems_version = %q{1.3.7}
84
+ s.summary = %q{An HTTP and model DSL wrapper for the Whatser API}
85
+ s.test_files = [
86
+ "test/helper.rb",
87
+ "test/test_activity_feed.rb",
88
+ "test/test_check_in.rb",
89
+ "test/test_city.rb",
90
+ "test/test_client.rb",
91
+ "test/test_collection.rb",
92
+ "test/test_configuration.rb",
93
+ "test/test_data_source.rb",
94
+ "test/test_detail.rb",
95
+ "test/test_facebook.rb",
96
+ "test/test_follow.rb",
97
+ "test/test_foursquare.rb",
98
+ "test/test_gowalla.rb",
99
+ "test/test_hondius.rb",
100
+ "test/test_http.rb",
101
+ "test/test_oauth.rb",
102
+ "test/test_poi.rb",
103
+ "test/test_resource.rb",
104
+ "test/test_response.rb",
105
+ "test/test_review.rb",
106
+ "test/test_subscription.rb",
107
+ "test/test_tag.rb",
108
+ "test/test_twitter.rb",
109
+ "test/test_user.rb"
110
+ ]
111
+
112
+ if s.respond_to? :specification_version then
113
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
114
+ s.specification_version = 3
115
+
116
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
117
+ s.add_runtime_dependency(%q<httparty>, [">= 0"])
118
+ s.add_runtime_dependency(%q<oauth2>, [">= 0"])
119
+ s.add_runtime_dependency(%q<json>, [">= 0"])
120
+ s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
121
+ s.add_development_dependency(%q<jeweler>, ["~> 1.5.1"])
122
+ s.add_development_dependency(%q<rcov>, [">= 0"])
123
+ else
124
+ s.add_dependency(%q<httparty>, [">= 0"])
125
+ s.add_dependency(%q<oauth2>, [">= 0"])
126
+ s.add_dependency(%q<json>, [">= 0"])
127
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
128
+ s.add_dependency(%q<jeweler>, ["~> 1.5.1"])
129
+ s.add_dependency(%q<rcov>, [">= 0"])
130
+ end
131
+ else
132
+ s.add_dependency(%q<httparty>, [">= 0"])
133
+ s.add_dependency(%q<oauth2>, [">= 0"])
134
+ s.add_dependency(%q<json>, [">= 0"])
135
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
136
+ s.add_dependency(%q<jeweler>, ["~> 1.5.1"])
137
+ s.add_dependency(%q<rcov>, [">= 0"])
138
+ end
139
+ end
140
+
metadata ADDED
@@ -0,0 +1,236 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: whatser
3
+ version: !ruby/object:Gem::Version
4
+ hash: 23
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 2
9
+ - 0
10
+ version: 0.2.0
11
+ platform: ruby
12
+ authors:
13
+ - Travis Dunn
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-01-12 00:00:00 +01:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ requirement: &id001 !ruby/object:Gem::Requirement
23
+ none: false
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ hash: 3
28
+ segments:
29
+ - 0
30
+ version: "0"
31
+ type: :runtime
32
+ name: httparty
33
+ prerelease: false
34
+ version_requirements: *id001
35
+ - !ruby/object:Gem::Dependency
36
+ requirement: &id002 !ruby/object:Gem::Requirement
37
+ none: false
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ hash: 3
42
+ segments:
43
+ - 0
44
+ version: "0"
45
+ type: :runtime
46
+ name: oauth2
47
+ prerelease: false
48
+ version_requirements: *id002
49
+ - !ruby/object:Gem::Dependency
50
+ requirement: &id003 !ruby/object:Gem::Requirement
51
+ none: false
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ hash: 3
56
+ segments:
57
+ - 0
58
+ version: "0"
59
+ type: :runtime
60
+ name: json
61
+ prerelease: false
62
+ version_requirements: *id003
63
+ - !ruby/object:Gem::Dependency
64
+ requirement: &id004 !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ~>
68
+ - !ruby/object:Gem::Version
69
+ hash: 23
70
+ segments:
71
+ - 1
72
+ - 0
73
+ - 0
74
+ version: 1.0.0
75
+ type: :development
76
+ name: bundler
77
+ prerelease: false
78
+ version_requirements: *id004
79
+ - !ruby/object:Gem::Dependency
80
+ requirement: &id005 !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ~>
84
+ - !ruby/object:Gem::Version
85
+ hash: 1
86
+ segments:
87
+ - 1
88
+ - 5
89
+ - 1
90
+ version: 1.5.1
91
+ type: :development
92
+ name: jeweler
93
+ prerelease: false
94
+ version_requirements: *id005
95
+ - !ruby/object:Gem::Dependency
96
+ requirement: &id006 !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ">="
100
+ - !ruby/object:Gem::Version
101
+ hash: 3
102
+ segments:
103
+ - 0
104
+ version: "0"
105
+ type: :development
106
+ name: rcov
107
+ prerelease: false
108
+ version_requirements: *id006
109
+ description: The 'Whatser API' Gem is a simple Ruby / Rails wrapper for interacting with Whatser's location-based web services (see http://docs.sogeoapi.com for more details).
110
+ email: cmd@travisdunn.com
111
+ executables: []
112
+
113
+ extensions: []
114
+
115
+ extra_rdoc_files:
116
+ - LICENSE.txt
117
+ - README.rdoc
118
+ files:
119
+ - .document
120
+ - Gemfile
121
+ - Gemfile.lock
122
+ - LICENSE.txt
123
+ - README.rdoc
124
+ - Rakefile
125
+ - VERSION
126
+ - lib/whatser.rb
127
+ - lib/whatser/api/batch.rb
128
+ - lib/whatser/api/facebook.rb
129
+ - lib/whatser/api/foursquare.rb
130
+ - lib/whatser/api/gowalla.rb
131
+ - lib/whatser/api/response.rb
132
+ - lib/whatser/api/service.rb
133
+ - lib/whatser/api/twitter.rb
134
+ - lib/whatser/client.rb
135
+ - lib/whatser/configuration.rb
136
+ - lib/whatser/errors.rb
137
+ - lib/whatser/net/http.rb
138
+ - lib/whatser/net/oauth.rb
139
+ - lib/whatser/resources/activity_feed.rb
140
+ - lib/whatser/resources/check_in.rb
141
+ - lib/whatser/resources/city.rb
142
+ - lib/whatser/resources/collection.rb
143
+ - lib/whatser/resources/data_source.rb
144
+ - lib/whatser/resources/detail.rb
145
+ - lib/whatser/resources/follow.rb
146
+ - lib/whatser/resources/media.rb
147
+ - lib/whatser/resources/poi.rb
148
+ - lib/whatser/resources/resource.rb
149
+ - lib/whatser/resources/review.rb
150
+ - lib/whatser/resources/subscription.rb
151
+ - lib/whatser/resources/tag.rb
152
+ - lib/whatser/resources/user.rb
153
+ - test/helper.rb
154
+ - test/test_activity_feed.rb
155
+ - test/test_check_in.rb
156
+ - test/test_city.rb
157
+ - test/test_client.rb
158
+ - test/test_collection.rb
159
+ - test/test_configuration.rb
160
+ - test/test_data_source.rb
161
+ - test/test_detail.rb
162
+ - test/test_facebook.rb
163
+ - test/test_follow.rb
164
+ - test/test_foursquare.rb
165
+ - test/test_gowalla.rb
166
+ - test/test_hondius.rb
167
+ - test/test_http.rb
168
+ - test/test_oauth.rb
169
+ - test/test_poi.rb
170
+ - test/test_resource.rb
171
+ - test/test_response.rb
172
+ - test/test_review.rb
173
+ - test/test_subscription.rb
174
+ - test/test_tag.rb
175
+ - test/test_twitter.rb
176
+ - test/test_user.rb
177
+ - whatser.gemspec
178
+ has_rdoc: true
179
+ homepage: http://github.com/sogeo/whatser
180
+ licenses:
181
+ - MIT
182
+ post_install_message:
183
+ rdoc_options: []
184
+
185
+ require_paths:
186
+ - lib
187
+ required_ruby_version: !ruby/object:Gem::Requirement
188
+ none: false
189
+ requirements:
190
+ - - ">="
191
+ - !ruby/object:Gem::Version
192
+ hash: 3
193
+ segments:
194
+ - 0
195
+ version: "0"
196
+ required_rubygems_version: !ruby/object:Gem::Requirement
197
+ none: false
198
+ requirements:
199
+ - - ">="
200
+ - !ruby/object:Gem::Version
201
+ hash: 3
202
+ segments:
203
+ - 0
204
+ version: "0"
205
+ requirements: []
206
+
207
+ rubyforge_project:
208
+ rubygems_version: 1.3.7
209
+ signing_key:
210
+ specification_version: 3
211
+ summary: An HTTP and model DSL wrapper for the Whatser API
212
+ test_files:
213
+ - test/helper.rb
214
+ - test/test_activity_feed.rb
215
+ - test/test_check_in.rb
216
+ - test/test_city.rb
217
+ - test/test_client.rb
218
+ - test/test_collection.rb
219
+ - test/test_configuration.rb
220
+ - test/test_data_source.rb
221
+ - test/test_detail.rb
222
+ - test/test_facebook.rb
223
+ - test/test_follow.rb
224
+ - test/test_foursquare.rb
225
+ - test/test_gowalla.rb
226
+ - test/test_hondius.rb
227
+ - test/test_http.rb
228
+ - test/test_oauth.rb
229
+ - test/test_poi.rb
230
+ - test/test_resource.rb
231
+ - test/test_response.rb
232
+ - test/test_review.rb
233
+ - test/test_subscription.rb
234
+ - test/test_tag.rb
235
+ - test/test_twitter.rb
236
+ - test/test_user.rb