whatser 0.5.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -27,7 +27,7 @@ Declare Whatser in your Gemfile:
27
27
 
28
28
  gem 'whatser', :git => "git@github.com:sogeo/whatser"
29
29
 
30
- And instantiate a Whatser client as need:
30
+ And instantiate a Whatser client as needed:
31
31
 
32
32
  client = Whatser::Client.new(:api_key => 'key', :api_secret => 'secret', :oauth_token => '123abc', :logger => Rails.logger)
33
33
 
@@ -66,7 +66,7 @@ Once you have an oauth token for a user, you can access the Whatser API by insta
66
66
 
67
67
  client = Whatser::Client.new( :oauth_token => '123abc' )
68
68
  client.authorized?
69
- authenticated_user = client.user.me
69
+ authenticated_user = client.users.me
70
70
  spots = client.spots.search(:geo => "52.3665312,4.8931739", :text => "pizza", :per_page => 30).data
71
71
  spots.each { |spot| spot.tag('my tag') }
72
72
  a_spot = client.spots.find(12345).data
@@ -140,6 +140,13 @@ A spot is a named geographical location and the most fundamental kind of content
140
140
 
141
141
  <Whatser::Poi @lng=4.0, @region="Noord Holland", @gowalla_id="123456", @lat=52.0, @tag_list=nil, @city="Amsterdam", @name="Example Spot", @country="Netherlands", @street="example street", @id=101, @postal_code="1012", @foursquare_id="123456", @created_at="2010-12-24T16:46:23Z">
142
142
 
143
+ You can also lists of users who have interacted with a spot in some way, either by checking-in or by adding it to their collection. These methods can be called directly from a spot, or by the User class.
144
+
145
+ users = my_spot.visitors( :page => 1, :per_page => 10 )
146
+ users = my_spot.collectors( :page => 1, :per_page => 10 )
147
+
148
+ users = Whatser.client.users.visitors(spot_id, :page => 1, :per_page => 10 )
149
+ users = Whatser.client.users.collectors(spot_id, :page => 1, :per_page => 10 )
143
150
 
144
151
  === Collections
145
152
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.0
1
+ 0.6.0
@@ -71,6 +71,14 @@ module Whatser
71
71
  def comments(opts={})
72
72
  Whatser::Comment.set(self.class.client).poi(id, opts)
73
73
  end
74
+
75
+ def visitors(opts={})
76
+ Whatser::User.set(self.class.client).visitors(id, opts)
77
+ end
78
+
79
+ def collectors(opts={})
80
+ Whatser::User.set(self.class.client).collectors(id, opts)
81
+ end
74
82
 
75
83
  def foursquare_connected?
76
84
  !foursquare_id.blank?
@@ -35,6 +35,14 @@ module Whatser
35
35
  def invite(emails)
36
36
  api_request :post, "/api/invites", {:query => {'emails' => emails} }
37
37
  end
38
+
39
+ def visitors(id, params={})
40
+ api_request :get, "/api/poi/#{id}/visitors", {:query => params}
41
+ end
42
+
43
+ def collectors(id, params={})
44
+ api_request :get, "/api/poi/#{id}/collectors", {:query => params}
45
+ end
38
46
  end
39
47
 
40
48
  def save
data/test/test_poi.rb CHANGED
@@ -81,6 +81,14 @@ class TestPoi < Test::Unit::TestCase
81
81
  assert @poi.comments(:opt => 'test').is_a?(Whatser::Response)
82
82
  end
83
83
 
84
+ def test_visitors
85
+ assert @poi.visitors.is_a?(Whatser::Response)
86
+ end
87
+
88
+ def test_collectors
89
+ assert @poi.collectors.is_a?(Whatser::Response)
90
+ end
91
+
84
92
  def branded_tags
85
93
  @poi.branded_tags = nil
86
94
  assert_nil @poi.branded_tags
data/test/test_user.rb CHANGED
@@ -22,6 +22,14 @@ class TestUser < Test::Unit::TestCase
22
22
  assert @client.users.suggested.is_a?(Whatser::Response)
23
23
  end
24
24
 
25
+ def test_visitors
26
+ assert @client.users.visitors(1).is_a?(Whatser::Response)
27
+ end
28
+
29
+ def test_collectors
30
+ assert @client.users.collectors(1).is_a?(Whatser::Response)
31
+ end
32
+
25
33
  def test_find
26
34
  assert @client.users.find(1, :opt => 'test').is_a?(Whatser::Response)
27
35
  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.5.0"
8
+ s.version = "0.6.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-03-04}
12
+ s.date = %q{2011-03-15}
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 = [
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: 11
4
+ hash: 7
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 5
8
+ - 6
9
9
  - 0
10
- version: 0.5.0
10
+ version: 0.6.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-03-04 00:00:00 +01:00
18
+ date: 2011-03-15 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency