foursquare2 1.8.1 → 1.8.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Readme.md +2 -0
- data/VERSION +1 -1
- data/foursquare2.gemspec +43 -38
- data/lib/foursquare2/checkins.rb +29 -0
- data/lib/foursquare2/client.rb +1 -0
- data/lib/foursquare2/events.rb +21 -0
- data/lib/foursquare2/venues.rb +0 -2
- data/lib/foursquare2.rb +1 -0
- data/test/fixtures/{campaign_created.json → campaigns/campaign_created.json} +0 -0
- data/test/fixtures/{checkin.json → checkins/checkin.json} +0 -0
- data/test/fixtures/checkins/checkin_reply.json +30 -0
- data/test/fixtures/{friend_checkins.json → checkins/friend_checkins.json} +0 -0
- data/test/fixtures/checkins/post_created.json +30 -0
- data/test/fixtures/events/event.json +53 -0
- data/test/fixtures/events/event_categories.json +153 -0
- data/test/fixtures/{list.json → lists/list.json} +0 -0
- data/test/fixtures/{list_created.json → lists/list_created.json} +0 -0
- data/test/fixtures/{list_followed.json → lists/list_followed.json} +0 -0
- data/test/fixtures/{list_item.json → lists/list_item.json} +0 -0
- data/test/fixtures/{list_moved_item.json → lists/list_moved_item.json} +0 -0
- data/test/fixtures/{list_updated.json → lists/list_updated.json} +0 -0
- data/test/fixtures/{page.json → pages/page.json} +0 -0
- data/test/fixtures/{page_venues.json → pages/page_venues.json} +0 -0
- data/test/fixtures/{search_pages.json → pages/search_pages.json} +0 -0
- data/test/fixtures/{photo.json → photos/photo.json} +0 -0
- data/test/fixtures/{search_specials.json → specials/search_specials.json} +0 -0
- data/test/fixtures/{special.json → specials/special.json} +0 -0
- data/test/fixtures/{special_created.json → specials/special_created.json} +0 -0
- data/test/fixtures/{search_tips.json → tips/search_tips.json} +0 -0
- data/test/fixtures/{tip.json → tips/tip.json} +0 -0
- data/test/fixtures/{search_users.json → users/search_users.json} +0 -0
- data/test/fixtures/{user.json → users/user.json} +0 -0
- data/test/fixtures/{user_lists.json → users/user_lists.json} +0 -0
- data/test/fixtures/{user_mayorships.json → users/user_mayorships.json} +0 -0
- data/test/fixtures/{user_tips.json → users/user_tips.json} +0 -0
- data/test/fixtures/{explore_venues.json → venues/explore_venues.json} +0 -0
- data/test/fixtures/{managed_venues.json → venues/managed_venues.json} +0 -0
- data/test/fixtures/{no_venues_by_tip.json → venues/no_venues_by_tip.json} +0 -0
- data/test/fixtures/{search_venues.json → venues/search_venues.json} +0 -0
- data/test/fixtures/{search_venues_by_tip.json → venues/search_venues_by_tip.json} +0 -0
- data/test/fixtures/{suggest_completion_venues.json → venues/suggest_completion_venues.json} +0 -0
- data/test/fixtures/{venue.json → venues/venue.json} +0 -0
- data/test/fixtures/{venue_links.json → venues/venue_links.json} +0 -0
- data/test/fixtures/{venue_menus.json → venues/venue_menus.json} +0 -0
- data/test/fixtures/{venue_photos.json → venues/venue_photos.json} +0 -0
- data/test/fixtures/{venue_stats.json → venues/venue_stats.json} +0 -0
- data/test/fixtures/{venue_tips.json → venues/venue_tips.json} +0 -0
- data/test/test_campaigns.rb +1 -1
- data/test/test_checkins.rb +14 -2
- data/test/test_client.rb +1 -1
- data/test/test_events.rb +23 -0
- data/test/test_lists.rb +8 -8
- data/test/test_pages.rb +3 -3
- data/test/test_photos.rb +1 -1
- data/test/test_specials.rb +3 -3
- data/test/test_tips.rb +2 -2
- data/test/test_users.rb +9 -9
- data/test/test_venues.rb +16 -16
- metadata +68 -63
- data/test/fixtures/user_tips_empty.json +0 -11
data/test/test_events.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class TestEvents < Test::Unit::TestCase
|
4
|
+
|
5
|
+
context "When using the foursquare API and working with events" do
|
6
|
+
setup do
|
7
|
+
@client = foursquare_test_client
|
8
|
+
end
|
9
|
+
|
10
|
+
should "fetch list of event categories" do
|
11
|
+
stub_get("https://api.foursquare.com/v2/events/categories?oauth_token=#{@client.oauth_token}", "events/event_categories.json")
|
12
|
+
event_categories = @client.event_categories()
|
13
|
+
event_categories.first.name.should == "Movies"
|
14
|
+
end
|
15
|
+
|
16
|
+
should "fetch info for a single event" do
|
17
|
+
stub_get("https://api.foursquare.com/v2/events/4f98d496f6903e7ae2a3628c?oauth_token=#{@client.oauth_token}", "events/event.json")
|
18
|
+
event = @client.event('4f98d496f6903e7ae2a3628c')
|
19
|
+
event.name.should == "Marvel's The Avengers"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
data/test/test_lists.rb
CHANGED
@@ -9,46 +9,46 @@ class TestLists < Test::Unit::TestCase
|
|
9
9
|
end
|
10
10
|
|
11
11
|
should "fetch info for a single list" do
|
12
|
-
stub_get("https://api.foursquare.com/v2/lists/#{@list_id}?oauth_token=#{@client.oauth_token}", "list.json")
|
12
|
+
stub_get("https://api.foursquare.com/v2/lists/#{@list_id}?oauth_token=#{@client.oauth_token}", "lists/list.json")
|
13
13
|
list = @client.list(@list_id)
|
14
14
|
list.name.should == 'Restaurants to Try'
|
15
15
|
list.venueCount.should == 8
|
16
16
|
end
|
17
17
|
|
18
18
|
should "add a list" do
|
19
|
-
stub_post("https://api.foursquare.com/v2/lists/add?oauth_token=#{@client.oauth_token}&name=Ramen+Spots", "list_created.json")
|
19
|
+
stub_post("https://api.foursquare.com/v2/lists/add?oauth_token=#{@client.oauth_token}&name=Ramen+Spots", "lists/list_created.json")
|
20
20
|
list = @client.add_list(:name => "Ramen Spots")
|
21
21
|
list.name.should == "Ramen Spots"
|
22
22
|
end
|
23
23
|
|
24
24
|
should "follow a list" do
|
25
|
-
stub_post("https://api.foursquare.com/v2/lists/#{@list_id}/follow?oauth_token=#{@client.oauth_token}", "list_followed.json")
|
25
|
+
stub_post("https://api.foursquare.com/v2/lists/#{@list_id}/follow?oauth_token=#{@client.oauth_token}", "lists/list_followed.json")
|
26
26
|
list = @client.follow_list(@list_id)
|
27
27
|
list.following.should == true
|
28
28
|
end
|
29
29
|
|
30
30
|
should "unfollow a list" do
|
31
|
-
stub_post("https://api.foursquare.com/v2/lists/#{@list_id}/unfollow?oauth_token=#{@client.oauth_token}", "list.json")
|
31
|
+
stub_post("https://api.foursquare.com/v2/lists/#{@list_id}/unfollow?oauth_token=#{@client.oauth_token}", "lists/list.json")
|
32
32
|
list = @client.unfollow_list(@list_id)
|
33
33
|
list.following.should == false
|
34
34
|
end
|
35
35
|
|
36
36
|
should "update a list" do
|
37
|
-
stub_post("https://api.foursquare.com/v2/lists/#{@list_id}/update?oauth_token=#{@client.oauth_token}&name=Ramen+Sports", "list_updated.json")
|
37
|
+
stub_post("https://api.foursquare.com/v2/lists/#{@list_id}/update?oauth_token=#{@client.oauth_token}&name=Ramen+Sports", "lists/list_updated.json")
|
38
38
|
list = @client.update_list(@list_id, :name => "Ramen Sports")
|
39
39
|
list.name.should == "Ramen Sports"
|
40
40
|
end
|
41
41
|
|
42
42
|
should "add an item to a list" do
|
43
43
|
venue_id = '4ba19cb0f964a520c2c337e3'
|
44
|
-
stub_post("https://api.foursquare.com/v2/lists/#{@list_id}/additem?oauth_token=#{@client.oauth_token}&venueId=#{venue_id}", "list_item.json")
|
44
|
+
stub_post("https://api.foursquare.com/v2/lists/#{@list_id}/additem?oauth_token=#{@client.oauth_token}&venueId=#{venue_id}", "lists/list_item.json")
|
45
45
|
item = @client.add_list_item(@list_id, :venueId => venue_id)
|
46
46
|
item.venue.id.should == venue_id
|
47
47
|
end
|
48
48
|
|
49
49
|
should "delete an item from a list" do
|
50
50
|
item_id = 'v4ba19cb0f964a520c2c337e3'
|
51
|
-
stub_post("https://api.foursquare.com/v2/lists/#{@list_id}/deleteitem?oauth_token=#{@client.oauth_token}&itemId=#{item_id}", "list_item.json")
|
51
|
+
stub_post("https://api.foursquare.com/v2/lists/#{@list_id}/deleteitem?oauth_token=#{@client.oauth_token}&itemId=#{item_id}", "lists/list_item.json")
|
52
52
|
item = @client.delete_list_item(@list_id, item_id)
|
53
53
|
item.id.should == item_id
|
54
54
|
end
|
@@ -56,7 +56,7 @@ class TestLists < Test::Unit::TestCase
|
|
56
56
|
should "move an item on a list" do
|
57
57
|
item_id = 't4d404fc934f42d43b2624385'
|
58
58
|
before_id = 'v4a01c477f964a520f9701fe3'
|
59
|
-
stub_post("https://api.foursquare.com/v2/lists/#{@list_id}/moveitem?oauth_token=#{@client.oauth_token}&itemId=#{item_id}&beforeId=#{before_id}", "list_moved_item.json")
|
59
|
+
stub_post("https://api.foursquare.com/v2/lists/#{@list_id}/moveitem?oauth_token=#{@client.oauth_token}&itemId=#{item_id}&beforeId=#{before_id}", "lists/list_moved_item.json")
|
60
60
|
list = @client.move_list_item(@list_id, item_id, :beforeId => before_id)
|
61
61
|
list.listItems.items[0].id.should == item_id
|
62
62
|
list.listItems.items[1].id.should == before_id
|
data/test/test_pages.rb
CHANGED
@@ -8,20 +8,20 @@ class TestPages < Test::Unit::TestCase
|
|
8
8
|
end
|
9
9
|
|
10
10
|
should "fetch info for a single page" do
|
11
|
-
stub_get("https://api.foursquare.com/v2/pages/14046309?oauth_token=#{@client.oauth_token}", "page.json")
|
11
|
+
stub_get("https://api.foursquare.com/v2/pages/14046309?oauth_token=#{@client.oauth_token}", "pages/page.json")
|
12
12
|
page = @client.page('14046309')
|
13
13
|
page.firstName.should == "Nashville Geeks"
|
14
14
|
page.type.should == "page"
|
15
15
|
end
|
16
16
|
|
17
17
|
should "fetch results when searching for a page" do
|
18
|
-
stub_get("https://api.foursquare.com/v2/pages/search?name=NashvilleGeeks&oauth_token=#{@client.oauth_token}", "search_pages.json")
|
18
|
+
stub_get("https://api.foursquare.com/v2/pages/search?name=NashvilleGeeks&oauth_token=#{@client.oauth_token}", "pages/search_pages.json")
|
19
19
|
pages = @client.search_pages(:name => 'NashvilleGeeks')
|
20
20
|
pages.results.first.firstName.should == "Nashville Geeks"
|
21
21
|
end
|
22
22
|
|
23
23
|
should "fetch venues for a given page" do
|
24
|
-
stub_get("https://api.foursquare.com/v2/pages/1070527/venues?limit=2&oauth_token=#{@client.oauth_token}", "page_venues.json")
|
24
|
+
stub_get("https://api.foursquare.com/v2/pages/1070527/venues?limit=2&oauth_token=#{@client.oauth_token}", "pages/page_venues.json")
|
25
25
|
venues = @client.page_venues(1070527, :limit => 2)
|
26
26
|
venues['count'].should == 11051
|
27
27
|
venues.items.length.should == 2
|
data/test/test_photos.rb
CHANGED
@@ -8,7 +8,7 @@ class TestPhotos < Test::Unit::TestCase
|
|
8
8
|
end
|
9
9
|
|
10
10
|
should "fetch info for a single photo" do
|
11
|
-
stub_get("https://api.foursquare.com/v2/photos/4d0fb8162d39a340637dc42b?oauth_token=#{@client.oauth_token}", "photo.json")
|
11
|
+
stub_get("https://api.foursquare.com/v2/photos/4d0fb8162d39a340637dc42b?oauth_token=#{@client.oauth_token}", "photos/photo.json")
|
12
12
|
photo = @client.photo('4d0fb8162d39a340637dc42b')
|
13
13
|
photo.sizes.items.count.should == 4
|
14
14
|
photo.sizes.items.first.url.should == "http://playfoursquare.s3.amazonaws.com/pix/UYU54GYOCURPAUYXH5V2U3EOM4DCX4VZPT3YOMN43H555KU2.jpg"
|
data/test/test_specials.rb
CHANGED
@@ -8,20 +8,20 @@ class TestSpecials < Test::Unit::TestCase
|
|
8
8
|
end
|
9
9
|
|
10
10
|
should "fetch info for a single special" do
|
11
|
-
stub_get("https://api.foursquare.com/v2/specials/4bd876f886ba62b58a6e88b3?oauth_token=#{@client.oauth_token}", "special.json")
|
11
|
+
stub_get("https://api.foursquare.com/v2/specials/4bd876f886ba62b58a6e88b3?oauth_token=#{@client.oauth_token}", "specials/special.json")
|
12
12
|
special = @client.special('4bd876f886ba62b58a6e88b3')
|
13
13
|
special.message.should == "$10 off for the mayor!"
|
14
14
|
end
|
15
15
|
|
16
16
|
should "fetch results when searching for nearby specials" do
|
17
|
-
stub_get("https://api.foursquare.com/v2/specials/search?ll=40.7%2C-73.9&oauth_token=#{@client.oauth_token}", "search_specials.json")
|
17
|
+
stub_get("https://api.foursquare.com/v2/specials/search?ll=40.7%2C-73.9&oauth_token=#{@client.oauth_token}", "specials/search_specials.json")
|
18
18
|
specials = @client.search_specials(:ll => '40.7,-73.9')
|
19
19
|
specials.count.should == 1
|
20
20
|
specials.first.message.should == "Buy 1 Get 1 40% Off All Video Games (priced up to $19.99)\r\n\r\nItems must be of equal or lesser value to the lowest priced item purchased\r\n\r\nEnds 2/12/2011"
|
21
21
|
end
|
22
22
|
|
23
23
|
should "add a special for a venue with given params" do
|
24
|
-
stub_post("https://api.foursquare.com/v2/specials/add?text=Test&unlockedText=Congrats&oauth_token=#{@client.oauth_token}", "special_created.json")
|
24
|
+
stub_post("https://api.foursquare.com/v2/specials/add?text=Test&unlockedText=Congrats&oauth_token=#{@client.oauth_token}", "specials/special_created.json")
|
25
25
|
special = @client.add_special(:text => 'Test', :unlockedText => 'Congrats')
|
26
26
|
special.message.should == "Test"
|
27
27
|
end
|
data/test/test_tips.rb
CHANGED
@@ -8,7 +8,7 @@ class TestTips < Test::Unit::TestCase
|
|
8
8
|
end
|
9
9
|
|
10
10
|
should "fetch info for a single tip" do
|
11
|
-
stub_get("https://api.foursquare.com/v2/tips/4b5e662a70c603bba7d790b4?oauth_token=#{@client.oauth_token}", "tip.json")
|
11
|
+
stub_get("https://api.foursquare.com/v2/tips/4b5e662a70c603bba7d790b4?oauth_token=#{@client.oauth_token}", "tips/tip.json")
|
12
12
|
tip = @client.tip('4b5e662a70c603bba7d790b4')
|
13
13
|
tip.done.groups.first['count'].should == 0
|
14
14
|
tip.done.groups.last['count'].should == 6
|
@@ -17,7 +17,7 @@ class TestTips < Test::Unit::TestCase
|
|
17
17
|
end
|
18
18
|
|
19
19
|
should "fetch results when searching for nearby tips" do
|
20
|
-
stub_get("https://api.foursquare.com/v2/tips/search?ll=40.7%2C-73.9&oauth_token=#{@client.oauth_token}&limit=3", "search_tips.json")
|
20
|
+
stub_get("https://api.foursquare.com/v2/tips/search?ll=40.7%2C-73.9&oauth_token=#{@client.oauth_token}&limit=3", "tips/search_tips.json")
|
21
21
|
tips = @client.search_tips(:ll => '40.7,-73.9', :limit => 3)
|
22
22
|
tips.count.should == 3
|
23
23
|
tips.first.text.should == "If you want a soda go to the vending machine next to the ice Cream place near the music barge it's only $2 for a 20oz bottle instead of $2 for a can at one of the carts."
|
data/test/test_users.rb
CHANGED
@@ -8,34 +8,34 @@ class TestUsers < Test::Unit::TestCase
|
|
8
8
|
end
|
9
9
|
|
10
10
|
should "fetch info for a single user" do
|
11
|
-
stub_get("https://api.foursquare.com/v2/users/self?oauth_token=#{@client.oauth_token}", "user.json")
|
11
|
+
stub_get("https://api.foursquare.com/v2/users/self?oauth_token=#{@client.oauth_token}", "users/user.json")
|
12
12
|
user = @client.user('self')
|
13
13
|
user.firstName.should == 'Matt'
|
14
14
|
user.checkins['count'].should == 669
|
15
15
|
end
|
16
16
|
|
17
17
|
should "fetch results when searching for users" do
|
18
|
-
stub_get("https://api.foursquare.com/v2/users/search?oauth_token=#{@client.oauth_token}&twitter=matt_mueller", "search_users.json")
|
18
|
+
stub_get("https://api.foursquare.com/v2/users/search?oauth_token=#{@client.oauth_token}&twitter=matt_mueller", "users/search_users.json")
|
19
19
|
users = @client.search_users(:twitter => 'matt_mueller')
|
20
20
|
users.results.count.should == 1
|
21
21
|
users.results.first.lastName.should == 'Mueller'
|
22
22
|
end
|
23
23
|
|
24
24
|
should "fetch tips" do
|
25
|
-
stub_get("https://api.foursquare.com/v2/users/self/tips?oauth_token=#{@client.oauth_token}", "user_tips.json")
|
25
|
+
stub_get("https://api.foursquare.com/v2/users/self/tips?oauth_token=#{@client.oauth_token}", "users/user_tips.json")
|
26
26
|
tips = @client.user_tips('self')
|
27
27
|
tips.items.first.text.should == "Encontrei mesas e chao sujos."
|
28
28
|
tips.items.size.should == 12
|
29
29
|
end
|
30
30
|
|
31
31
|
should "fetch tips and filter with term #{QUERY}" do
|
32
|
-
stub_get("https://api.foursquare.com/v2/users/self/tips?oauth_token=#{@client.oauth_token}&query=#{QUERY}", "user_tips.json")
|
32
|
+
stub_get("https://api.foursquare.com/v2/users/self/tips?oauth_token=#{@client.oauth_token}&query=#{QUERY}", "users/user_tips.json")
|
33
33
|
tips = @client.user_tips('self', {:query => QUERY})
|
34
34
|
tips.items.size.should == 1
|
35
35
|
end
|
36
36
|
|
37
37
|
should "fetch lists for a single user" do
|
38
|
-
stub_get("https://api.foursquare.com/v2/users/self/lists?oauth_token=#{@client.oauth_token}", "user_lists.json")
|
38
|
+
stub_get("https://api.foursquare.com/v2/users/self/lists?oauth_token=#{@client.oauth_token}", "users/user_lists.json")
|
39
39
|
lists = @client.user_lists('self')
|
40
40
|
lists.items.size.should == 21
|
41
41
|
end
|
@@ -43,27 +43,27 @@ class TestUsers < Test::Unit::TestCase
|
|
43
43
|
#TODO refactoring all call to method stub_get
|
44
44
|
|
45
45
|
should "list only user with tip #{QUERY}" do
|
46
|
-
stub_get("https://api.foursquare.com/v2/tips/search?oauth_token=#{@client.oauth_token}&ll=77.7%2C-77.7&query=#{QUERY}&limit=500", "search_tips.json")
|
46
|
+
stub_get("https://api.foursquare.com/v2/tips/search?oauth_token=#{@client.oauth_token}&ll=77.7%2C-77.7&query=#{QUERY}&limit=500", "tips/search_tips.json")
|
47
47
|
users = @client.search_users_by_tip({:name => 'developer', :ll =>'77.7,-77.7', :query => QUERY})
|
48
48
|
users.first.id.should == "2227298"
|
49
49
|
users.size.should == 1
|
50
50
|
end
|
51
51
|
|
52
52
|
should "find by name not case sensitive" do
|
53
|
-
stub_get("https://api.foursquare.com/v2/tips/search?oauth_token=#{@client.oauth_token}&ll=77.7%2C-77.7&query=#{QUERY}&limit=500", "search_tips.json")
|
53
|
+
stub_get("https://api.foursquare.com/v2/tips/search?oauth_token=#{@client.oauth_token}&ll=77.7%2C-77.7&query=#{QUERY}&limit=500", "tips/search_tips.json")
|
54
54
|
users = @client.search_users_by_tip({:name => 'Developer', :ll =>'77.7,-77.7', :query => QUERY})
|
55
55
|
users.first.id.should == "2227298"
|
56
56
|
users.size.should == 1
|
57
57
|
end
|
58
58
|
|
59
59
|
should "haven't user with name anonymous with tip #{QUERY}" do
|
60
|
-
stub_get("https://api.foursquare.com/v2/tips/search?oauth_token=#{@client.oauth_token}&ll=77.7%2C-77.7&query=#{QUERY}&limit=500", "search_tips.json")
|
60
|
+
stub_get("https://api.foursquare.com/v2/tips/search?oauth_token=#{@client.oauth_token}&ll=77.7%2C-77.7&query=#{QUERY}&limit=500", "tips/search_tips.json")
|
61
61
|
users = @client.search_users_by_tip({:name => 'anonymous', :ll =>'77.7,-77.7', :query => QUERY})
|
62
62
|
users.size.should == 0
|
63
63
|
end
|
64
64
|
|
65
65
|
should "find a users mayorships" do
|
66
|
-
stub_get("https://api.foursquare.com/v2/users/self/mayorships?oauth_token=#{@client.oauth_token}", "user_mayorships.json")
|
66
|
+
stub_get("https://api.foursquare.com/v2/users/self/mayorships?oauth_token=#{@client.oauth_token}", "users/user_mayorships.json")
|
67
67
|
mayorships = @client.user_mayorships('self')
|
68
68
|
mayorships.items.size.should == 2
|
69
69
|
end
|
data/test/test_venues.rb
CHANGED
@@ -8,46 +8,46 @@ class TestVenues < Test::Unit::TestCase
|
|
8
8
|
end
|
9
9
|
|
10
10
|
should "fetch info for a single venue" do
|
11
|
-
stub_get("https://api.foursquare.com/v2/venues/4b8c3d87f964a520f7c532e3?oauth_token=#{@client.oauth_token}", "venue.json")
|
11
|
+
stub_get("https://api.foursquare.com/v2/venues/4b8c3d87f964a520f7c532e3?oauth_token=#{@client.oauth_token}", "venues/venue.json")
|
12
12
|
venue = @client.venue('4b8c3d87f964a520f7c532e3')
|
13
13
|
venue.name.should == 'Bridgestone Arena'
|
14
14
|
venue.location.address.should == '501 Broadway'
|
15
15
|
end
|
16
16
|
|
17
17
|
should "search for venues based on passed criteria" do
|
18
|
-
stub_get("https://api.foursquare.com/v2/venues/search?ll=36.142064%2C-86.816086&oauth_token=#{@client.oauth_token}&query=coffee", "search_venues.json")
|
18
|
+
stub_get("https://api.foursquare.com/v2/venues/search?ll=36.142064%2C-86.816086&oauth_token=#{@client.oauth_token}&query=coffee", "venues/search_venues.json")
|
19
19
|
venues = @client.search_venues(:ll => "36.142064,-86.816086", :query => "coffee")
|
20
20
|
venues.groups.first.items.first.name.should == 'Ugly Mugs'
|
21
21
|
end
|
22
22
|
|
23
23
|
should "search for venues from a tip search" do
|
24
|
-
stub_get("https://api.foursquare.com/v2/tips/search?ll=-23.013968%2C-45.550802&oauth_token=#{@client.oauth_token}&query=rodoviaria", "search_venues_by_tip.json")
|
24
|
+
stub_get("https://api.foursquare.com/v2/tips/search?ll=-23.013968%2C-45.550802&oauth_token=#{@client.oauth_token}&query=rodoviaria", "venues/search_venues_by_tip.json")
|
25
25
|
venues = @client.search_venues_by_tip(:ll => "-23.013968,-45.550802", :query => "rodoviaria")
|
26
26
|
venues.first.name.should == "Santa Barbara"
|
27
27
|
end
|
28
28
|
|
29
29
|
should "not find venues from a tip search" do
|
30
|
-
stub_get("https://api.foursquare.com/v2/tips/search?ll=-23.013968%2C-45.550802&oauth_token=#{@client.oauth_token}&query=loremlpsun", "no_venues_by_tip.json")
|
30
|
+
stub_get("https://api.foursquare.com/v2/tips/search?ll=-23.013968%2C-45.550802&oauth_token=#{@client.oauth_token}&query=loremlpsun", "venues/no_venues_by_tip.json")
|
31
31
|
venues = @client.search_venues_by_tip(:ll => "-23.013968,-45.550802", :query => "loremlpsun")
|
32
32
|
venues.size.should == 0
|
33
33
|
end
|
34
34
|
|
35
35
|
should "get tips from a venue" do
|
36
|
-
stub_get("https://api.foursquare.com/v2/venues/4b8c3d87f964a520f7c532e3/tips?oauth_token=#{@client.oauth_token}", "venue_tips.json")
|
36
|
+
stub_get("https://api.foursquare.com/v2/venues/4b8c3d87f964a520f7c532e3/tips?oauth_token=#{@client.oauth_token}", "venues/venue_tips.json")
|
37
37
|
tips = @client.venue_tips('4b8c3d87f964a520f7c532e3')
|
38
38
|
tips.items.first.id.should == "4c94a45c82b56dcb47cad0aa"
|
39
39
|
tips.items.size.should == 4
|
40
40
|
end
|
41
41
|
|
42
42
|
should "get tips from a venue only with some term" do
|
43
|
-
stub_get("https://api.foursquare.com/v2/venues/4c94a45c82b56dcb47cad0aa/tips?oauth_token=#{@client.oauth_token}", "venue_tips.json")
|
43
|
+
stub_get("https://api.foursquare.com/v2/venues/4c94a45c82b56dcb47cad0aa/tips?oauth_token=#{@client.oauth_token}", "venues/venue_tips.json")
|
44
44
|
tips = @client.venue_tips('4c94a45c82b56dcb47cad0aa', {:query => "legal"})
|
45
45
|
tips[:count].should == 1
|
46
46
|
tips.items.first.id.should == "4c94a45c82b56dcb47cad0aa"
|
47
47
|
end
|
48
48
|
|
49
49
|
should "get tips from a venue only with some term case sensitive" do
|
50
|
-
stub_get("https://api.foursquare.com/v2/venues/4c94a45c82b56dcb47cad0aa/tips?oauth_token=#{@client.oauth_token}", "venue_tips.json")
|
50
|
+
stub_get("https://api.foursquare.com/v2/venues/4c94a45c82b56dcb47cad0aa/tips?oauth_token=#{@client.oauth_token}", "venues/venue_tips.json")
|
51
51
|
tips = @client.venue_tips('4c94a45c82b56dcb47cad0aa', {:query => "LEGAL"})
|
52
52
|
|
53
53
|
tips.items.size.should == 1
|
@@ -55,20 +55,20 @@ class TestVenues < Test::Unit::TestCase
|
|
55
55
|
end
|
56
56
|
|
57
57
|
should "no tips from a venue with term lorem" do
|
58
|
-
stub_get("https://api.foursquare.com/v2/venues/4c94a45c82b56dcb47cad0aa/tips?oauth_token=#{@client.oauth_token}", "venue_tips.json")
|
58
|
+
stub_get("https://api.foursquare.com/v2/venues/4c94a45c82b56dcb47cad0aa/tips?oauth_token=#{@client.oauth_token}", "venues/venue_tips.json")
|
59
59
|
tips = @client.venue_tips('4c94a45c82b56dcb47cad0aa', {:query => "lorem"})
|
60
60
|
|
61
61
|
tips[:items].size.should == 0
|
62
62
|
end
|
63
63
|
|
64
64
|
should "allow venues to be explored" do
|
65
|
-
stub_get("https://api.foursquare.com/v2/venues/explore?section=food&ll=40.7%2C-74&oauth_token=#{@client.oauth_token}&limit=2", "explore_venues.json")
|
65
|
+
stub_get("https://api.foursquare.com/v2/venues/explore?section=food&ll=40.7%2C-74&oauth_token=#{@client.oauth_token}&limit=2", "venues/explore_venues.json")
|
66
66
|
venues = @client.explore_venues(:ll => '40.7,-74', :section => 'food', :limit => '2')
|
67
67
|
venues.groups.first.items.count.should == 2
|
68
68
|
end
|
69
69
|
|
70
70
|
should "get links for a venue" do
|
71
|
-
stub_get("https://api.foursquare.com/v2/venues/4b8c3d87f964a520f7c532e3/links?oauth_token=#{@client.oauth_token}", "venue_links.json")
|
71
|
+
stub_get("https://api.foursquare.com/v2/venues/4b8c3d87f964a520f7c532e3/links?oauth_token=#{@client.oauth_token}", "venues/venue_links.json")
|
72
72
|
links = @client.venue_links('4b8c3d87f964a520f7c532e3')
|
73
73
|
links.items.first.linkedId.should == "2513467"
|
74
74
|
links.items.size == links.count
|
@@ -76,7 +76,7 @@ class TestVenues < Test::Unit::TestCase
|
|
76
76
|
end
|
77
77
|
|
78
78
|
should "get photos for a venue" do
|
79
|
-
stub_get("https://api.foursquare.com/v2/venues/4b8c3d87f964a520f7c532e3/photos?group=venue&oauth_token=#{@client.oauth_token}&limit=3", "venue_photos.json")
|
79
|
+
stub_get("https://api.foursquare.com/v2/venues/4b8c3d87f964a520f7c532e3/photos?group=venue&oauth_token=#{@client.oauth_token}&limit=3", "venues/venue_photos.json")
|
80
80
|
photos = @client.venue_photos('4b8c3d87f964a520f7c532e3', { :group => 'venue', :limit => 3 })
|
81
81
|
photos.items.first.id.should == "4edc309e46907c1b44d25ab2"
|
82
82
|
photos['count'].should == 222
|
@@ -84,20 +84,20 @@ class TestVenues < Test::Unit::TestCase
|
|
84
84
|
end
|
85
85
|
|
86
86
|
should "should suggest venues based on passed criteria" do
|
87
|
-
stub_get("https://api.foursquare.com/v2/venues/suggestCompletion?oauth_token=#{@client.oauth_token}&ll=40.7%2C-74&query=coffee", "suggest_completion_venues.json")
|
87
|
+
stub_get("https://api.foursquare.com/v2/venues/suggestCompletion?oauth_token=#{@client.oauth_token}&ll=40.7%2C-74&query=coffee", "venues/suggest_completion_venues.json")
|
88
88
|
venues = @client.suggest_completion_venues(:ll => "40.7,-74", :query => "coffee")
|
89
89
|
venues.minivenues.first.id.should == '44dc96e4f964a520b0361fe3'
|
90
90
|
end
|
91
91
|
|
92
92
|
should "fetch venue for manager" do
|
93
|
-
stub_get("https://api.foursquare.com/v2/venues/managed?oauth_token=#{@client.oauth_token}", "managed_venues.json")
|
93
|
+
stub_get("https://api.foursquare.com/v2/venues/managed?oauth_token=#{@client.oauth_token}", "venues/managed_venues.json")
|
94
94
|
venues = @client.managed_venues()
|
95
95
|
venues.first.name.should == 'Black Founders Startup Ventures'
|
96
96
|
venues.first.location.address.should == '625 2nd St'
|
97
97
|
end
|
98
98
|
|
99
99
|
should "get menus for a venue" do
|
100
|
-
stub_get("https://api.foursquare.com/v2/venues/4b2a544ff964a5204ca724e3/menu?oauth_token=#{@client.oauth_token}", "venue_menus.json")
|
100
|
+
stub_get("https://api.foursquare.com/v2/venues/4b2a544ff964a5204ca724e3/menu?oauth_token=#{@client.oauth_token}", "venues/venue_menus.json")
|
101
101
|
response = @client.venue_menus('4b2a544ff964a5204ca724e3')
|
102
102
|
response.menu.menus.items.count.should == 1
|
103
103
|
response.menu.menus.items.first.name.should == "Main Menu"
|
@@ -105,13 +105,13 @@ class TestVenues < Test::Unit::TestCase
|
|
105
105
|
end
|
106
106
|
|
107
107
|
should "get detailed stats for a venue managed by user" do
|
108
|
-
stub_get("https://api.foursquare.com/v2/venues/4b8c3d87f964a520f7c532e3/stats?oauth_token=#{@client.oauth_token}", "venue_stats.json")
|
108
|
+
stub_get("https://api.foursquare.com/v2/venues/4b8c3d87f964a520f7c532e3/stats?oauth_token=#{@client.oauth_token}", "venues/venue_stats.json")
|
109
109
|
response = @client.managed_venue_stats('4b8c3d87f964a520f7c532e3')
|
110
110
|
response.stats.totalCheckins.should == 1
|
111
111
|
end
|
112
112
|
|
113
113
|
should "get a subset of detailed stats for a venue managed by user when passing in options" do
|
114
|
-
stub_get("https://api.foursquare.com/v2/venues/4b8c3d87f964a520f7c532e3/stats?oauth_token=#{@client.oauth_token}&startAt=1343085269&endAt=1343171627", "venue_stats.json")
|
114
|
+
stub_get("https://api.foursquare.com/v2/venues/4b8c3d87f964a520f7c532e3/stats?oauth_token=#{@client.oauth_token}&startAt=1343085269&endAt=1343171627", "venues/venue_stats.json")
|
115
115
|
response = @client.managed_venue_stats('4b8c3d87f964a520f7c532e3', { :startAt => 1343085269, :endAt => 1343171627})
|
116
116
|
response.stats.totalCheckins.should == 1
|
117
117
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foursquare2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.8.
|
4
|
+
version: 1.8.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,11 +10,11 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-
|
13
|
+
date: 2012-09-01 00:00:00.000000000Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: faraday
|
17
|
-
requirement: &
|
17
|
+
requirement: &70235098690600 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ~>
|
@@ -22,10 +22,10 @@ dependencies:
|
|
22
22
|
version: '0.8'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *70235098690600
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: faraday_middleware
|
28
|
-
requirement: &
|
28
|
+
requirement: &70235098689440 !ruby/object:Gem::Requirement
|
29
29
|
none: false
|
30
30
|
requirements:
|
31
31
|
- - ! '>='
|
@@ -33,10 +33,10 @@ dependencies:
|
|
33
33
|
version: '0.8'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
|
-
version_requirements: *
|
36
|
+
version_requirements: *70235098689440
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: hashie
|
39
|
-
requirement: &
|
39
|
+
requirement: &70235098687800 !ruby/object:Gem::Requirement
|
40
40
|
none: false
|
41
41
|
requirements:
|
42
42
|
- - ~>
|
@@ -44,10 +44,10 @@ dependencies:
|
|
44
44
|
version: '1.0'
|
45
45
|
type: :runtime
|
46
46
|
prerelease: false
|
47
|
-
version_requirements: *
|
47
|
+
version_requirements: *70235098687800
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
49
|
name: awesome_print
|
50
|
-
requirement: &
|
50
|
+
requirement: &70235098686020 !ruby/object:Gem::Requirement
|
51
51
|
none: false
|
52
52
|
requirements:
|
53
53
|
- - ! '>='
|
@@ -55,10 +55,10 @@ dependencies:
|
|
55
55
|
version: '0'
|
56
56
|
type: :development
|
57
57
|
prerelease: false
|
58
|
-
version_requirements: *
|
58
|
+
version_requirements: *70235098686020
|
59
59
|
- !ruby/object:Gem::Dependency
|
60
60
|
name: shoulda
|
61
|
-
requirement: &
|
61
|
+
requirement: &70235098682920 !ruby/object:Gem::Requirement
|
62
62
|
none: false
|
63
63
|
requirements:
|
64
64
|
- - ! '>='
|
@@ -66,10 +66,10 @@ dependencies:
|
|
66
66
|
version: '0'
|
67
67
|
type: :development
|
68
68
|
prerelease: false
|
69
|
-
version_requirements: *
|
69
|
+
version_requirements: *70235098682920
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: bundler
|
72
|
-
requirement: &
|
72
|
+
requirement: &70235098680680 !ruby/object:Gem::Requirement
|
73
73
|
none: false
|
74
74
|
requirements:
|
75
75
|
- - ~>
|
@@ -77,10 +77,10 @@ dependencies:
|
|
77
77
|
version: '1.0'
|
78
78
|
type: :development
|
79
79
|
prerelease: false
|
80
|
-
version_requirements: *
|
80
|
+
version_requirements: *70235098680680
|
81
81
|
- !ruby/object:Gem::Dependency
|
82
82
|
name: jeweler
|
83
|
-
requirement: &
|
83
|
+
requirement: &70235098678820 !ruby/object:Gem::Requirement
|
84
84
|
none: false
|
85
85
|
requirements:
|
86
86
|
- - ~>
|
@@ -88,10 +88,10 @@ dependencies:
|
|
88
88
|
version: '1.5'
|
89
89
|
type: :development
|
90
90
|
prerelease: false
|
91
|
-
version_requirements: *
|
91
|
+
version_requirements: *70235098678820
|
92
92
|
- !ruby/object:Gem::Dependency
|
93
93
|
name: rcov
|
94
|
-
requirement: &
|
94
|
+
requirement: &70235098676620 !ruby/object:Gem::Requirement
|
95
95
|
none: false
|
96
96
|
requirements:
|
97
97
|
- - ! '>='
|
@@ -99,10 +99,10 @@ dependencies:
|
|
99
99
|
version: '0'
|
100
100
|
type: :development
|
101
101
|
prerelease: false
|
102
|
-
version_requirements: *
|
102
|
+
version_requirements: *70235098676620
|
103
103
|
- !ruby/object:Gem::Dependency
|
104
104
|
name: fakeweb
|
105
|
-
requirement: &
|
105
|
+
requirement: &70235098675260 !ruby/object:Gem::Requirement
|
106
106
|
none: false
|
107
107
|
requirements:
|
108
108
|
- - ~>
|
@@ -110,10 +110,10 @@ dependencies:
|
|
110
110
|
version: '1.3'
|
111
111
|
type: :development
|
112
112
|
prerelease: false
|
113
|
-
version_requirements: *
|
113
|
+
version_requirements: *70235098675260
|
114
114
|
- !ruby/object:Gem::Dependency
|
115
115
|
name: jnunemaker-matchy
|
116
|
-
requirement: &
|
116
|
+
requirement: &70235098661440 !ruby/object:Gem::Requirement
|
117
117
|
none: false
|
118
118
|
requirements:
|
119
119
|
- - ~>
|
@@ -121,10 +121,10 @@ dependencies:
|
|
121
121
|
version: '0.4'
|
122
122
|
type: :development
|
123
123
|
prerelease: false
|
124
|
-
version_requirements: *
|
124
|
+
version_requirements: *70235098661440
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: json_pure
|
127
|
-
requirement: &
|
127
|
+
requirement: &70235098660120 !ruby/object:Gem::Requirement
|
128
128
|
none: false
|
129
129
|
requirements:
|
130
130
|
- - ~>
|
@@ -132,10 +132,10 @@ dependencies:
|
|
132
132
|
version: '1.4'
|
133
133
|
type: :development
|
134
134
|
prerelease: false
|
135
|
-
version_requirements: *
|
135
|
+
version_requirements: *70235098660120
|
136
136
|
- !ruby/object:Gem::Dependency
|
137
137
|
name: multi_json
|
138
|
-
requirement: &
|
138
|
+
requirement: &70235098658060 !ruby/object:Gem::Requirement
|
139
139
|
none: false
|
140
140
|
requirements:
|
141
141
|
- - <
|
@@ -146,7 +146,7 @@ dependencies:
|
|
146
146
|
version: 0.0.5
|
147
147
|
type: :development
|
148
148
|
prerelease: false
|
149
|
-
version_requirements: *
|
149
|
+
version_requirements: *70235098658060
|
150
150
|
description: Gives access to all endpoints in version 2 of foursquare's API with syntax
|
151
151
|
that will be familiar to those who used the original foursquare gem by Jeremy Welch.
|
152
152
|
email:
|
@@ -170,6 +170,7 @@ files:
|
|
170
170
|
- lib/foursquare2/campaigns.rb
|
171
171
|
- lib/foursquare2/checkins.rb
|
172
172
|
- lib/foursquare2/client.rb
|
173
|
+
- lib/foursquare2/events.rb
|
173
174
|
- lib/foursquare2/lists.rb
|
174
175
|
- lib/foursquare2/pages.rb
|
175
176
|
- lib/foursquare2/photos.rb
|
@@ -179,48 +180,52 @@ files:
|
|
179
180
|
- lib/foursquare2/users.rb
|
180
181
|
- lib/foursquare2/venues.rb
|
181
182
|
- test/config.rb
|
182
|
-
- test/fixtures/campaign_created.json
|
183
|
-
- test/fixtures/checkin.json
|
183
|
+
- test/fixtures/campaigns/campaign_created.json
|
184
|
+
- test/fixtures/checkins/checkin.json
|
185
|
+
- test/fixtures/checkins/checkin_reply.json
|
186
|
+
- test/fixtures/checkins/friend_checkins.json
|
187
|
+
- test/fixtures/checkins/post_created.json
|
184
188
|
- test/fixtures/error.json
|
185
189
|
- test/fixtures/error_template.json
|
186
|
-
- test/fixtures/
|
187
|
-
- test/fixtures/
|
188
|
-
- test/fixtures/list.json
|
189
|
-
- test/fixtures/list_created.json
|
190
|
-
- test/fixtures/list_followed.json
|
191
|
-
- test/fixtures/list_item.json
|
192
|
-
- test/fixtures/list_moved_item.json
|
193
|
-
- test/fixtures/list_updated.json
|
194
|
-
- test/fixtures/
|
195
|
-
- test/fixtures/
|
196
|
-
- test/fixtures/
|
197
|
-
- test/fixtures/
|
198
|
-
- test/fixtures/
|
199
|
-
- test/fixtures/
|
200
|
-
- test/fixtures/
|
201
|
-
- test/fixtures/search_tips.json
|
202
|
-
- test/fixtures/
|
203
|
-
- test/fixtures/
|
204
|
-
- test/fixtures/
|
205
|
-
- test/fixtures/
|
206
|
-
- test/fixtures/
|
207
|
-
- test/fixtures/
|
208
|
-
- test/fixtures/
|
209
|
-
- test/fixtures/
|
210
|
-
- test/fixtures/
|
211
|
-
- test/fixtures/
|
212
|
-
- test/fixtures/
|
213
|
-
- test/fixtures/
|
214
|
-
- test/fixtures/venue.json
|
215
|
-
- test/fixtures/venue_links.json
|
216
|
-
- test/fixtures/venue_menus.json
|
217
|
-
- test/fixtures/venue_photos.json
|
218
|
-
- test/fixtures/venue_stats.json
|
219
|
-
- test/fixtures/venue_tips.json
|
190
|
+
- test/fixtures/events/event.json
|
191
|
+
- test/fixtures/events/event_categories.json
|
192
|
+
- test/fixtures/lists/list.json
|
193
|
+
- test/fixtures/lists/list_created.json
|
194
|
+
- test/fixtures/lists/list_followed.json
|
195
|
+
- test/fixtures/lists/list_item.json
|
196
|
+
- test/fixtures/lists/list_moved_item.json
|
197
|
+
- test/fixtures/lists/list_updated.json
|
198
|
+
- test/fixtures/pages/page.json
|
199
|
+
- test/fixtures/pages/page_venues.json
|
200
|
+
- test/fixtures/pages/search_pages.json
|
201
|
+
- test/fixtures/photos/photo.json
|
202
|
+
- test/fixtures/specials/search_specials.json
|
203
|
+
- test/fixtures/specials/special.json
|
204
|
+
- test/fixtures/specials/special_created.json
|
205
|
+
- test/fixtures/tips/search_tips.json
|
206
|
+
- test/fixtures/tips/tip.json
|
207
|
+
- test/fixtures/users/search_users.json
|
208
|
+
- test/fixtures/users/user.json
|
209
|
+
- test/fixtures/users/user_lists.json
|
210
|
+
- test/fixtures/users/user_mayorships.json
|
211
|
+
- test/fixtures/users/user_tips.json
|
212
|
+
- test/fixtures/venues/explore_venues.json
|
213
|
+
- test/fixtures/venues/managed_venues.json
|
214
|
+
- test/fixtures/venues/no_venues_by_tip.json
|
215
|
+
- test/fixtures/venues/search_venues.json
|
216
|
+
- test/fixtures/venues/search_venues_by_tip.json
|
217
|
+
- test/fixtures/venues/suggest_completion_venues.json
|
218
|
+
- test/fixtures/venues/venue.json
|
219
|
+
- test/fixtures/venues/venue_links.json
|
220
|
+
- test/fixtures/venues/venue_menus.json
|
221
|
+
- test/fixtures/venues/venue_photos.json
|
222
|
+
- test/fixtures/venues/venue_stats.json
|
223
|
+
- test/fixtures/venues/venue_tips.json
|
220
224
|
- test/helper.rb
|
221
225
|
- test/test_campaigns.rb
|
222
226
|
- test/test_checkins.rb
|
223
227
|
- test/test_client.rb
|
228
|
+
- test/test_events.rb
|
224
229
|
- test/test_lists.rb
|
225
230
|
- test/test_pages.rb
|
226
231
|
- test/test_photos.rb
|
@@ -243,7 +248,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
243
248
|
version: '0'
|
244
249
|
segments:
|
245
250
|
- 0
|
246
|
-
hash:
|
251
|
+
hash: -2014267550921023463
|
247
252
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
248
253
|
none: false
|
249
254
|
requirements:
|