whatser 0.3.2 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +15 -0
- data/VERSION +1 -1
- data/lib/whatser/client.rb +1 -0
- data/lib/whatser/resources/comment.rb +28 -0
- data/lib/whatser/resources/poi.rb +4 -0
- data/lib/whatser.rb +1 -0
- data/test/test_comment.rb +27 -0
- data/test/test_poi.rb +4 -0
- data/whatser.gemspec +5 -2
- metadata +8 -5
data/README.rdoc
CHANGED
@@ -9,6 +9,7 @@ The 'Whatser API' Gem is a simple Ruby / Rails wrapper for interacting with What
|
|
9
9
|
* network connectivity (using httparty)
|
10
10
|
* simple DSL for API resource classes (spots, media, reviews, check ins, etc.)
|
11
11
|
* user spot collection management
|
12
|
+
* check-in aggregation
|
12
13
|
* social network integration (facebook, twitter, foursquare, gowalla)
|
13
14
|
* photo uploads
|
14
15
|
|
@@ -267,6 +268,20 @@ A data source represents a free or purchasable content stream of collected spots
|
|
267
268
|
<Whatser::DataSource @review_count=405, @poi_count=0, @price=0.0, @collection_count=0, @name="Rough Guides - Barcelona", @media_count=0, @id=9, @users=[{"name": "premium user", "id": 33}]>
|
268
269
|
|
269
270
|
|
271
|
+
=== Comments
|
272
|
+
|
273
|
+
A comment is just a short user note that can be associated with other resources. At the moment, you can comment on a POI, Media, or an Activity Feed. Users can also delete their own comments.
|
274
|
+
|
275
|
+
Whatser.client.comments.poi( poi_id, :page => 1, :per_page => 10 )
|
276
|
+
Whatser.client.comments.media( media_id, :page => 1, :per_page => 10 )
|
277
|
+
Whatser.client.comments.create( 'activity_feed', feed_id, 'This is a comment. Interesting activity!' )
|
278
|
+
Whatser.client.comments.create( 'media', media_id, 'This is a comment on a media. Stunning photo!' )
|
279
|
+
m = Whatser.client.comments.create( 'poi', spot_id, 'This is a comment on a spot. Nice spot!' )
|
280
|
+
m.delete
|
281
|
+
|
282
|
+
<Whatser::Comment @body="This is a comment.", @id=101, @user_id=101, @activity_feed_id=null, @user_avatar="http://example.com/images/thumb/4394.jpg", @subject_id=33, @user_name='Whaster User', @created_at="2010-12-24T16:31:38Z", @subject_type='poi', @subject_name="Some Spot">
|
283
|
+
|
284
|
+
|
270
285
|
=== Activity Feeds
|
271
286
|
|
272
287
|
User activity is recorded by the API, for example when a user adds or tags a POI, befriends another user, or uploads a photo. This activity is recorded in a user's activity feed, a collection of short messages detailing that user's activity. You can view feeds either by user, by spot, or globally.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.4.0
|
data/lib/whatser/client.rb
CHANGED
@@ -36,6 +36,7 @@ module Whatser
|
|
36
36
|
def reviews; Whatser::Review.set(self); end
|
37
37
|
def subscriptions; Whatser::Subscription.set(self); end
|
38
38
|
def tags; Whatser::Tag.set(self); end
|
39
|
+
def comments; Whatser::Comment.set(self); end
|
39
40
|
def cities; Whatser::City.set(self); end
|
40
41
|
def feeds; Whatser::ActivityFeed.set(self); end
|
41
42
|
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Whatser
|
2
|
+
class Comment < Whatser::Resource
|
3
|
+
attr_accessor :id,:user_id,:activity_feed_id,:subject_id,:created_at
|
4
|
+
attr_accessor :user_name,:user_avatar,:subject_type,:subject_name,:body
|
5
|
+
|
6
|
+
class << self
|
7
|
+
def poi(poi_id, opts={})
|
8
|
+
api_request :get, "/api/poi/#{poi_id}/comments", {:query => opts}
|
9
|
+
end
|
10
|
+
|
11
|
+
def media(media_id, opts={})
|
12
|
+
api_request :get, "/api/media/#{media_id}/comments", {:query => opts}
|
13
|
+
end
|
14
|
+
|
15
|
+
def delete(id)
|
16
|
+
api_request :delete, "/api/comments/#{id}"
|
17
|
+
end
|
18
|
+
|
19
|
+
def create(resource_name, resource_id, body)
|
20
|
+
api_request :post, "/api/#{resource_name}/#{resource_id}/tags", {:body => {'comment' => {'body' => body}} }
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def delete
|
25
|
+
self.class.delete(id)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
data/lib/whatser.rb
CHANGED
@@ -21,6 +21,7 @@ require File.expand_path('../whatser/resources/subscription', __FILE__)
|
|
21
21
|
require File.expand_path('../whatser/resources/tag', __FILE__)
|
22
22
|
require File.expand_path('../whatser/resources/user', __FILE__)
|
23
23
|
require File.expand_path('../whatser/resources/follow', __FILE__)
|
24
|
+
require File.expand_path('../whatser/resources/comment', __FILE__)
|
24
25
|
require File.expand_path('../whatser/resources/activity_feed', __FILE__)
|
25
26
|
|
26
27
|
require File.expand_path('../whatser/api/service', __FILE__)
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class TestComment < Test::Unit::TestCase
|
4
|
+
def setup
|
5
|
+
@client = Whatser::Client.new
|
6
|
+
@poi_id = 1
|
7
|
+
@media_id = 1
|
8
|
+
@comment = Whatser::Comment.new(:poi_id => @poi_id, :body => 'test')
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_poi_list
|
12
|
+
assert @client.comments.poi(@poi_id, :page => 1).is_a?(Whatser::Response)
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_media_list
|
16
|
+
assert @client.comments.media(@media_id, :page => 1).is_a?(Whatser::Response)
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_create
|
20
|
+
assert @client.comments.create('poi', @poi_id, 'testing.').is_a?(Whatser::Response)
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_delete
|
24
|
+
assert @client.comments.delete(@poi_id).is_a?(Whatser::Response)
|
25
|
+
assert @comment.delete.is_a?(Whatser::Response)
|
26
|
+
end
|
27
|
+
end
|
data/test/test_poi.rb
CHANGED
@@ -77,6 +77,10 @@ class TestPoi < Test::Unit::TestCase
|
|
77
77
|
assert @poi.activity(:opt => 'test').is_a?(Whatser::Response)
|
78
78
|
end
|
79
79
|
|
80
|
+
def test_comments
|
81
|
+
assert @poi.comments(:opt => 'test').is_a?(Whatser::Response)
|
82
|
+
end
|
83
|
+
|
80
84
|
def test_details
|
81
85
|
assert @poi.details(:page => 1).is_a?(Whatser::Response)
|
82
86
|
end
|
data/whatser.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{whatser}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.4.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Travis Dunn"]
|
12
|
-
s.date = %q{2011-
|
12
|
+
s.date = %q{2011-02-03}
|
13
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
14
|
s.email = %q{cmd@travisdunn.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -41,6 +41,7 @@ Gem::Specification.new do |s|
|
|
41
41
|
"lib/whatser/resources/check_in.rb",
|
42
42
|
"lib/whatser/resources/city.rb",
|
43
43
|
"lib/whatser/resources/collection.rb",
|
44
|
+
"lib/whatser/resources/comment.rb",
|
44
45
|
"lib/whatser/resources/data_source.rb",
|
45
46
|
"lib/whatser/resources/detail.rb",
|
46
47
|
"lib/whatser/resources/follow.rb",
|
@@ -57,6 +58,7 @@ Gem::Specification.new do |s|
|
|
57
58
|
"test/test_city.rb",
|
58
59
|
"test/test_client.rb",
|
59
60
|
"test/test_collection.rb",
|
61
|
+
"test/test_comment.rb",
|
60
62
|
"test/test_configuration.rb",
|
61
63
|
"test/test_data_source.rb",
|
62
64
|
"test/test_detail.rb",
|
@@ -90,6 +92,7 @@ Gem::Specification.new do |s|
|
|
90
92
|
"test/test_city.rb",
|
91
93
|
"test/test_client.rb",
|
92
94
|
"test/test_collection.rb",
|
95
|
+
"test/test_comment.rb",
|
93
96
|
"test/test_configuration.rb",
|
94
97
|
"test/test_data_source.rb",
|
95
98
|
"test/test_detail.rb",
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: whatser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 15
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 4
|
9
|
+
- 0
|
10
|
+
version: 0.4.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Travis Dunn
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-02-03 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -140,6 +140,7 @@ files:
|
|
140
140
|
- lib/whatser/resources/check_in.rb
|
141
141
|
- lib/whatser/resources/city.rb
|
142
142
|
- lib/whatser/resources/collection.rb
|
143
|
+
- lib/whatser/resources/comment.rb
|
143
144
|
- lib/whatser/resources/data_source.rb
|
144
145
|
- lib/whatser/resources/detail.rb
|
145
146
|
- lib/whatser/resources/follow.rb
|
@@ -156,6 +157,7 @@ files:
|
|
156
157
|
- test/test_city.rb
|
157
158
|
- test/test_client.rb
|
158
159
|
- test/test_collection.rb
|
160
|
+
- test/test_comment.rb
|
159
161
|
- test/test_configuration.rb
|
160
162
|
- test/test_data_source.rb
|
161
163
|
- test/test_detail.rb
|
@@ -217,6 +219,7 @@ test_files:
|
|
217
219
|
- test/test_city.rb
|
218
220
|
- test/test_client.rb
|
219
221
|
- test/test_collection.rb
|
222
|
+
- test/test_comment.rb
|
220
223
|
- test/test_configuration.rb
|
221
224
|
- test/test_data_source.rb
|
222
225
|
- test/test_detail.rb
|