foursquare2 1.8.1 → 1.8.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. data/Readme.md +2 -0
  2. data/VERSION +1 -1
  3. data/foursquare2.gemspec +43 -38
  4. data/lib/foursquare2/checkins.rb +29 -0
  5. data/lib/foursquare2/client.rb +1 -0
  6. data/lib/foursquare2/events.rb +21 -0
  7. data/lib/foursquare2/venues.rb +0 -2
  8. data/lib/foursquare2.rb +1 -0
  9. data/test/fixtures/{campaign_created.json → campaigns/campaign_created.json} +0 -0
  10. data/test/fixtures/{checkin.json → checkins/checkin.json} +0 -0
  11. data/test/fixtures/checkins/checkin_reply.json +30 -0
  12. data/test/fixtures/{friend_checkins.json → checkins/friend_checkins.json} +0 -0
  13. data/test/fixtures/checkins/post_created.json +30 -0
  14. data/test/fixtures/events/event.json +53 -0
  15. data/test/fixtures/events/event_categories.json +153 -0
  16. data/test/fixtures/{list.json → lists/list.json} +0 -0
  17. data/test/fixtures/{list_created.json → lists/list_created.json} +0 -0
  18. data/test/fixtures/{list_followed.json → lists/list_followed.json} +0 -0
  19. data/test/fixtures/{list_item.json → lists/list_item.json} +0 -0
  20. data/test/fixtures/{list_moved_item.json → lists/list_moved_item.json} +0 -0
  21. data/test/fixtures/{list_updated.json → lists/list_updated.json} +0 -0
  22. data/test/fixtures/{page.json → pages/page.json} +0 -0
  23. data/test/fixtures/{page_venues.json → pages/page_venues.json} +0 -0
  24. data/test/fixtures/{search_pages.json → pages/search_pages.json} +0 -0
  25. data/test/fixtures/{photo.json → photos/photo.json} +0 -0
  26. data/test/fixtures/{search_specials.json → specials/search_specials.json} +0 -0
  27. data/test/fixtures/{special.json → specials/special.json} +0 -0
  28. data/test/fixtures/{special_created.json → specials/special_created.json} +0 -0
  29. data/test/fixtures/{search_tips.json → tips/search_tips.json} +0 -0
  30. data/test/fixtures/{tip.json → tips/tip.json} +0 -0
  31. data/test/fixtures/{search_users.json → users/search_users.json} +0 -0
  32. data/test/fixtures/{user.json → users/user.json} +0 -0
  33. data/test/fixtures/{user_lists.json → users/user_lists.json} +0 -0
  34. data/test/fixtures/{user_mayorships.json → users/user_mayorships.json} +0 -0
  35. data/test/fixtures/{user_tips.json → users/user_tips.json} +0 -0
  36. data/test/fixtures/{explore_venues.json → venues/explore_venues.json} +0 -0
  37. data/test/fixtures/{managed_venues.json → venues/managed_venues.json} +0 -0
  38. data/test/fixtures/{no_venues_by_tip.json → venues/no_venues_by_tip.json} +0 -0
  39. data/test/fixtures/{search_venues.json → venues/search_venues.json} +0 -0
  40. data/test/fixtures/{search_venues_by_tip.json → venues/search_venues_by_tip.json} +0 -0
  41. data/test/fixtures/{suggest_completion_venues.json → venues/suggest_completion_venues.json} +0 -0
  42. data/test/fixtures/{venue.json → venues/venue.json} +0 -0
  43. data/test/fixtures/{venue_links.json → venues/venue_links.json} +0 -0
  44. data/test/fixtures/{venue_menus.json → venues/venue_menus.json} +0 -0
  45. data/test/fixtures/{venue_photos.json → venues/venue_photos.json} +0 -0
  46. data/test/fixtures/{venue_stats.json → venues/venue_stats.json} +0 -0
  47. data/test/fixtures/{venue_tips.json → venues/venue_tips.json} +0 -0
  48. data/test/test_campaigns.rb +1 -1
  49. data/test/test_checkins.rb +14 -2
  50. data/test/test_client.rb +1 -1
  51. data/test/test_events.rb +23 -0
  52. data/test/test_lists.rb +8 -8
  53. data/test/test_pages.rb +3 -3
  54. data/test/test_photos.rb +1 -1
  55. data/test/test_specials.rb +3 -3
  56. data/test/test_tips.rb +2 -2
  57. data/test/test_users.rb +9 -9
  58. data/test/test_venues.rb +16 -16
  59. metadata +68 -63
  60. data/test/fixtures/user_tips_empty.json +0 -11
data/Readme.md CHANGED
@@ -72,6 +72,8 @@ See [the documentation](http://rubydoc.info/gems/foursquare2/frames) or [foursqu
72
72
  client.recent_checkins
73
73
  client.add_checkin
74
74
  client.add_checkin_comment
75
+ client.add_checkin_post
76
+ client.add_checkin_reply
75
77
  client.delete_checkin_comment
76
78
  client.photo
77
79
  client.add_photo
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.8.1
1
+ 1.8.2
data/foursquare2.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "foursquare2"
8
- s.version = "1.8.1"
8
+ s.version = "1.8.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Matt Mueller", "Marco Moura"]
12
- s.date = "2012-08-19"
12
+ s.date = "2012-09-01"
13
13
  s.description = "Gives access to all endpoints in version 2 of foursquare's API with syntax that will be familiar to those who used the original foursquare gem by Jeremy Welch."
14
14
  s.email = ["muellermr@gmail.com", "email@marcomoura.com"]
15
15
  s.extra_rdoc_files = [
@@ -29,6 +29,7 @@ Gem::Specification.new do |s|
29
29
  "lib/foursquare2/campaigns.rb",
30
30
  "lib/foursquare2/checkins.rb",
31
31
  "lib/foursquare2/client.rb",
32
+ "lib/foursquare2/events.rb",
32
33
  "lib/foursquare2/lists.rb",
33
34
  "lib/foursquare2/pages.rb",
34
35
  "lib/foursquare2/photos.rb",
@@ -38,48 +39,52 @@ Gem::Specification.new do |s|
38
39
  "lib/foursquare2/users.rb",
39
40
  "lib/foursquare2/venues.rb",
40
41
  "test/config.rb",
41
- "test/fixtures/campaign_created.json",
42
- "test/fixtures/checkin.json",
42
+ "test/fixtures/campaigns/campaign_created.json",
43
+ "test/fixtures/checkins/checkin.json",
44
+ "test/fixtures/checkins/checkin_reply.json",
45
+ "test/fixtures/checkins/friend_checkins.json",
46
+ "test/fixtures/checkins/post_created.json",
43
47
  "test/fixtures/error.json",
44
48
  "test/fixtures/error_template.json",
45
- "test/fixtures/explore_venues.json",
46
- "test/fixtures/friend_checkins.json",
47
- "test/fixtures/list.json",
48
- "test/fixtures/list_created.json",
49
- "test/fixtures/list_followed.json",
50
- "test/fixtures/list_item.json",
51
- "test/fixtures/list_moved_item.json",
52
- "test/fixtures/list_updated.json",
53
- "test/fixtures/managed_venues.json",
54
- "test/fixtures/no_venues_by_tip.json",
55
- "test/fixtures/page.json",
56
- "test/fixtures/page_venues.json",
57
- "test/fixtures/photo.json",
58
- "test/fixtures/search_pages.json",
59
- "test/fixtures/search_specials.json",
60
- "test/fixtures/search_tips.json",
61
- "test/fixtures/search_users.json",
62
- "test/fixtures/search_venues.json",
63
- "test/fixtures/search_venues_by_tip.json",
64
- "test/fixtures/special.json",
65
- "test/fixtures/special_created.json",
66
- "test/fixtures/suggest_completion_venues.json",
67
- "test/fixtures/tip.json",
68
- "test/fixtures/user.json",
69
- "test/fixtures/user_lists.json",
70
- "test/fixtures/user_mayorships.json",
71
- "test/fixtures/user_tips.json",
72
- "test/fixtures/user_tips_empty.json",
73
- "test/fixtures/venue.json",
74
- "test/fixtures/venue_links.json",
75
- "test/fixtures/venue_menus.json",
76
- "test/fixtures/venue_photos.json",
77
- "test/fixtures/venue_stats.json",
78
- "test/fixtures/venue_tips.json",
49
+ "test/fixtures/events/event.json",
50
+ "test/fixtures/events/event_categories.json",
51
+ "test/fixtures/lists/list.json",
52
+ "test/fixtures/lists/list_created.json",
53
+ "test/fixtures/lists/list_followed.json",
54
+ "test/fixtures/lists/list_item.json",
55
+ "test/fixtures/lists/list_moved_item.json",
56
+ "test/fixtures/lists/list_updated.json",
57
+ "test/fixtures/pages/page.json",
58
+ "test/fixtures/pages/page_venues.json",
59
+ "test/fixtures/pages/search_pages.json",
60
+ "test/fixtures/photos/photo.json",
61
+ "test/fixtures/specials/search_specials.json",
62
+ "test/fixtures/specials/special.json",
63
+ "test/fixtures/specials/special_created.json",
64
+ "test/fixtures/tips/search_tips.json",
65
+ "test/fixtures/tips/tip.json",
66
+ "test/fixtures/users/search_users.json",
67
+ "test/fixtures/users/user.json",
68
+ "test/fixtures/users/user_lists.json",
69
+ "test/fixtures/users/user_mayorships.json",
70
+ "test/fixtures/users/user_tips.json",
71
+ "test/fixtures/venues/explore_venues.json",
72
+ "test/fixtures/venues/managed_venues.json",
73
+ "test/fixtures/venues/no_venues_by_tip.json",
74
+ "test/fixtures/venues/search_venues.json",
75
+ "test/fixtures/venues/search_venues_by_tip.json",
76
+ "test/fixtures/venues/suggest_completion_venues.json",
77
+ "test/fixtures/venues/venue.json",
78
+ "test/fixtures/venues/venue_links.json",
79
+ "test/fixtures/venues/venue_menus.json",
80
+ "test/fixtures/venues/venue_photos.json",
81
+ "test/fixtures/venues/venue_stats.json",
82
+ "test/fixtures/venues/venue_tips.json",
79
83
  "test/helper.rb",
80
84
  "test/test_campaigns.rb",
81
85
  "test/test_checkins.rb",
82
86
  "test/test_client.rb",
87
+ "test/test_events.rb",
83
88
  "test/test_lists.rb",
84
89
  "test/test_pages.rb",
85
90
  "test/test_photos.rb",
@@ -73,6 +73,35 @@ module Foursquare2
73
73
  return_error_or_body(response, response.body.response)
74
74
  end
75
75
 
76
+ # Add a post to a checkin.
77
+ #
78
+ # @param [String] checkin_id the ID of the checkin.
79
+ # @param [Hash] options
80
+ # @option options String :text - The text of the post, up to 200 characters.
81
+ # @option options String :url - Link for more details. This page will be opened in an embedded web view in the foursquare application, unless contentId is specified and a native link handler is registered and present. We support the following URL schemes: http, https, foursquare, mailto, tel, and sms.
82
+ # @option options String :contentId - Identifier for the post to be used in a native link, up to 50 characters. A url must also be specified in the request.
83
+
84
+ def add_checkin_post(checkin_id, options={})
85
+ response = connection.post do |req|
86
+ req.url "checkins/#{checkin_id}/addpost", options
87
+ end
88
+ return_error_or_body(response, response.body.response.post)
89
+ end
90
+
91
+ # Add a reply to a checkin.
92
+ #
93
+ # @param [String] checkin_id the ID of the checkin.
94
+ # @param [Hash] options
95
+ # @option options String :text - The text of the post, up to 200 characters.
96
+ # @option options String :url - Link for more details. This page will be opened in an embedded web view in the foursquare application, unless contentId is specified and a native link handler is registered and present. We support the following URL schemes: http, https, foursquare, mailto, tel, and sms.
97
+ # @option options String :contentId - Identifier for the post to be used in a native link, up to 50 characters. A url must also be specified in the request.
98
+
99
+ def add_checkin_reply(checkin_id, options={})
100
+ response = connection.post do |req|
101
+ req.url "checkins/#{checkin_id}/reply", options
102
+ end
103
+ return_error_or_body(response, response.body.response.reply)
104
+ end
76
105
  end
77
106
  end
78
107
 
@@ -21,6 +21,7 @@ module Foursquare2
21
21
  include Pages
22
22
  include Campaigns
23
23
  include Lists
24
+ include Events
24
25
 
25
26
  attr_reader :client_id, :client_secret, :oauth_token, :api_version
26
27
 
@@ -0,0 +1,21 @@
1
+ module Foursquare2
2
+ module Events
3
+
4
+ # Retrieve information about an event
5
+ #
6
+ # param [String] event_id The ID of the event
7
+
8
+ def event(event_id)
9
+ response = connection.get("events/#{event_id}")
10
+ return_error_or_body(response, response.body.response.event)
11
+ end
12
+
13
+ # Retrieve information about all event categories.
14
+
15
+ def event_categories
16
+ response = connection.get("events/categories")
17
+ return_error_or_body(response, response.body.response.categories)
18
+ end
19
+
20
+ end
21
+ end
@@ -47,8 +47,6 @@ module Foursquare2
47
47
  end
48
48
 
49
49
  # Retrieve information about all venue categories.
50
- #
51
- # param [String] venue_id The ID of the venue
52
50
 
53
51
  def venue_categories
54
52
  response = connection.get("venues/categories")
data/lib/foursquare2.rb CHANGED
@@ -28,6 +28,7 @@ module Foursquare2
28
28
  require 'foursquare2/venues'
29
29
  require 'foursquare2/pages'
30
30
  require 'foursquare2/lists'
31
+ require 'foursquare2/events'
31
32
  require 'foursquare2/client'
32
33
  require 'foursquare2/api_error'
33
34
 
@@ -0,0 +1,30 @@
1
+ {
2
+ "meta": {
3
+ "code": 200,
4
+ "errorDetail": "Please provide an API version to avoid future errors.See http://bit.ly/vywCav",
5
+ "errorType": "deprecated"
6
+ },
7
+ "notifications": [
8
+ {
9
+ "item": {
10
+ "unreadCount": -1
11
+ },
12
+ "type": "notificationTray"
13
+ }
14
+ ],
15
+ "response": {
16
+ "reply": {
17
+ "createdAt": 1346497989,
18
+ "id": "5041edc5e4b09ae79babd551",
19
+ "source": {
20
+ "detailUrl": "https://foursquare.com/device/app/SDDBI1SDSDEGVP3YUJGAJC0TRNCKCPA5WABTMYQ5OFBVDOLJ",
21
+ "icon": "https://foursquare.com/img/blank_app_16.png",
22
+ "id": "SDDBI1SDSDEGVP3YUJGAJC0TRNCKCPA5WABTMYQ5OFBVDOLJ",
23
+ "name": "Foursquare API documentation",
24
+ "photo": "https://foursquare.com/img/blank_app.png",
25
+ "url": "https://developer.foursquare.com"
26
+ },
27
+ "text": "Test"
28
+ }
29
+ }
30
+ }
@@ -0,0 +1,30 @@
1
+ {
2
+ "meta": {
3
+ "code": 200,
4
+ "errorDetail": "Please provide an API version to avoid future errors.See http://bit.ly/vywCav",
5
+ "errorType": "deprecated"
6
+ },
7
+ "notifications": [
8
+ {
9
+ "item": {
10
+ "unreadCount": -1
11
+ },
12
+ "type": "notificationTray"
13
+ }
14
+ ],
15
+ "response": {
16
+ "post": {
17
+ "createdAt": 1346497204,
18
+ "id": "5041eab4e4b05127f7e64be6",
19
+ "source": {
20
+ "detailUrl": "https://foursquare.com/device/app/SDDBI1SDSDEGVP3YUJGAJC0TRNCKCPA5WABTMYQ5OFBVDOLJ",
21
+ "icon": "https://foursquare.com/img/blank_app_16.png",
22
+ "id": "SDDBI1SDSDEGVP3YUJGAJC0TRNCKCPA5WABTMYQ5OFBVDOLJ",
23
+ "name": "Foursquare API documentation",
24
+ "photo": "https://foursquare.com/img/blank_app.png",
25
+ "url": "https://developer.foursquare.com"
26
+ },
27
+ "text": "Test"
28
+ }
29
+ }
30
+ }
@@ -0,0 +1,53 @@
1
+ {
2
+ "meta": {
3
+ "code": 200
4
+ },
5
+ "notifications": [{
6
+ "type": "notificationTray",
7
+ "item": {
8
+ "unreadCount": -1
9
+ }
10
+ }],
11
+ "response": {
12
+ "event": {
13
+ "venueId": "4b108b9ef964a5208f7223e3",
14
+ "id": "4f98d496f6903e7ae2a3628c",
15
+ "name": "Marvel's The Avengers",
16
+ "foreignIds": {
17
+ "count": 0,
18
+ "items": []
19
+ },
20
+ "categories": [{
21
+ "id": "4dfb90c6bd413dd705e8f897",
22
+ "name": "Movies",
23
+ "pluralName": "Movies",
24
+ "shortName": "Movie",
25
+ "icon": {
26
+ "prefix": "https:\/\/foursquare.com\/img\/categories_v2\/arts_entertainment\/movietheater_",
27
+ "suffix": ".png"
28
+ },
29
+ "primary": true
30
+ }],
31
+ "hereNow": {
32
+ "count": 0,
33
+ "groups": [{
34
+ "type": "friends",
35
+ "name": "Friends here",
36
+ "count": 0,
37
+ "items": []
38
+ }, {
39
+ "type": "others",
40
+ "name": "Other people here",
41
+ "count": 0,
42
+ "items": []
43
+ }]
44
+ },
45
+ "allDay": true,
46
+ "date": 1336021200,
47
+ "stats": {
48
+ "checkinsCount": 128,
49
+ "usersCount": 125
50
+ }
51
+ }
52
+ }
53
+ }
@@ -0,0 +1,153 @@
1
+ {
2
+ "meta": {
3
+ "code": 200
4
+ },
5
+ "response": {
6
+ "categories": [
7
+ {
8
+ "id": "4dfb90c6bd413dd705e8f897",
9
+ "name": "Movies",
10
+ "pluralName": "Movies",
11
+ "shortName": "Movie",
12
+ "icon": {
13
+ "prefix": "https://foursquare.com/img/categories_v2/arts_entertainment/movietheater_",
14
+ "suffix": ".png"
15
+ },
16
+ "categories": []
17
+ },
18
+ {
19
+ "id": "4e0a4b91bd41eda0d6092f89",
20
+ "name": "Music",
21
+ "pluralName": "Music",
22
+ "shortName": "Music",
23
+ "icon": {
24
+ "prefix": "https://foursquare.com/img/categories_v2/arts_entertainment/musicvenue_",
25
+ "suffix": ".png"
26
+ },
27
+ "categories": []
28
+ },
29
+ {
30
+ "id": "4e458e3bbd41d66894dbdecc",
31
+ "name": "Other",
32
+ "pluralName": "Other",
33
+ "shortName": "Other",
34
+ "icon": {
35
+ "prefix": "https://foursquare.com/img/categories_v2/event/default_",
36
+ "suffix": ".png"
37
+ },
38
+ "categories": []
39
+ },
40
+ {
41
+ "id": "4f59477b33bdcd006285c0e4",
42
+ "name": "Panels",
43
+ "pluralName": "Panels",
44
+ "shortName": "Panel",
45
+ "icon": {
46
+ "prefix": "https://foursquare.com/img/categories_v2/event/default_",
47
+ "suffix": ".png"
48
+ },
49
+ "categories": []
50
+ },
51
+ {
52
+ "id": "4e09f7a5bd41dc571bc3b1dc",
53
+ "name": "Sporting Events",
54
+ "pluralName": "Sporting Events",
55
+ "shortName": "Sport",
56
+ "icon": {
57
+ "prefix": "https://foursquare.com/img/categories_v2/event/default_",
58
+ "suffix": ".png"
59
+ },
60
+ "categories": [
61
+ {
62
+ "id": "4e132f48bd41026cd50e8f8e",
63
+ "name": "Baseball Games",
64
+ "pluralName": "Baseball Games",
65
+ "shortName": "Baseball",
66
+ "icon": {
67
+ "prefix": "https://foursquare.com/img/categories_v2/arts_entertainment/stadium_baseball_",
68
+ "suffix": ".png"
69
+ },
70
+ "categories": []
71
+ },
72
+ {
73
+ "id": "4e132f48bd41026cd50e8f91",
74
+ "name": "Basketball Games",
75
+ "pluralName": "Basketball Games",
76
+ "shortName": "Basketball",
77
+ "icon": {
78
+ "prefix": "https://foursquare.com/img/categories_v2/arts_entertainment/stadium_basketball_",
79
+ "suffix": ".png"
80
+ },
81
+ "categories": []
82
+ },
83
+ {
84
+ "id": "4e132f48bd41026cd50e8f8f",
85
+ "name": "Football Game",
86
+ "pluralName": "Football Game",
87
+ "shortName": "Football",
88
+ "icon": {
89
+ "prefix": "https://foursquare.com/img/categories_v2/arts_entertainment/stadium_football_",
90
+ "suffix": ".png"
91
+ },
92
+ "categories": []
93
+ },
94
+ {
95
+ "id": "4e1ca351bd4159e7d88bd90c",
96
+ "name": "Golf Tournaments",
97
+ "pluralName": "Golf Tournaments",
98
+ "shortName": "Golf",
99
+ "icon": {
100
+ "prefix": "https://foursquare.com/img/categories_v2/parks_outdoors/golfcourse_",
101
+ "suffix": ".png"
102
+ },
103
+ "categories": []
104
+ },
105
+ {
106
+ "id": "4e132f48bd41026cd50e8f90",
107
+ "name": "Hockey Games",
108
+ "pluralName": "Hockey Games",
109
+ "shortName": "Hockey",
110
+ "icon": {
111
+ "prefix": "https://foursquare.com/img/categories_v2/arts_entertainment/stadium_hockey_",
112
+ "suffix": ".png"
113
+ },
114
+ "categories": []
115
+ },
116
+ {
117
+ "id": "4e1dbf8dbd4146b989a9d9ee",
118
+ "name": "Races",
119
+ "pluralName": "Races",
120
+ "shortName": "Racing",
121
+ "icon": {
122
+ "prefix": "https://foursquare.com/img/categories_v2/arts_entertainment/racetrack_",
123
+ "suffix": ".png"
124
+ },
125
+ "categories": []
126
+ },
127
+ {
128
+ "id": "4e173846bd41c6d19e8dd5a3",
129
+ "name": "Soccer Matches",
130
+ "pluralName": "Soccer Matches",
131
+ "shortName": "Soccer",
132
+ "icon": {
133
+ "prefix": "https://foursquare.com/img/categories_v2/arts_entertainment/stadium_soccer_",
134
+ "suffix": ".png"
135
+ },
136
+ "categories": []
137
+ },
138
+ {
139
+ "id": "4e29cd20bd41a4ce124ac881",
140
+ "name": "Tennis Matches",
141
+ "pluralName": "Tennis Matches",
142
+ "shortName": "Tennis",
143
+ "icon": {
144
+ "prefix": "https://foursquare.com/img/categories_v2/arts_entertainment/stadium_tennis_",
145
+ "suffix": ".png"
146
+ },
147
+ "categories": []
148
+ }
149
+ ]
150
+ }
151
+ ]
152
+ }
153
+ }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -8,7 +8,7 @@ class TestCampaigns < Test::Unit::TestCase
8
8
  end
9
9
 
10
10
  should "add a campaign" do
11
- stub_post("https://api.foursquare.com/v2/campaigns/add?oauth_token=#{@client.oauth_token}&specialId=4bd876f886ba62b58a6e88b3", "campaign_created.json")
11
+ stub_post("https://api.foursquare.com/v2/campaigns/add?oauth_token=#{@client.oauth_token}&specialId=4bd876f886ba62b58a6e88b3", "campaigns/campaign_created.json")
12
12
  campaign = @client.add_campaign(:specialId => '4bd876f886ba62b58a6e88b3')
13
13
  campaign.special.id == "4bd876f886ba62b58a6e88b3"
14
14
  end
@@ -8,19 +8,31 @@ class TestCheckins < Test::Unit::TestCase
8
8
  end
9
9
 
10
10
  should "fetch info for a single checkin" do
11
- stub_get("https://api.foursquare.com/v2/checkins/4d572bcc9e508cfab975189b?oauth_token=#{@client.oauth_token}", "checkin.json")
11
+ stub_get("https://api.foursquare.com/v2/checkins/4d572bcc9e508cfab975189b?oauth_token=#{@client.oauth_token}", "checkins/checkin.json")
12
12
  checkin = @client.checkin('4d572bcc9e508cfab975189b')
13
13
  checkin.venue.name.should == 'Bridgestone Arena'
14
14
  checkin.user.firstName.should == 'Matt'
15
15
  end
16
16
 
17
17
  should "fetch recent checkins from friends"do
18
- stub_get("https://api.foursquare.com/v2/checkins/recent?oauth_token=#{@client.oauth_token}&limit=2", "friend_checkins.json")
18
+ stub_get("https://api.foursquare.com/v2/checkins/recent?oauth_token=#{@client.oauth_token}&limit=2", "checkins/friend_checkins.json")
19
19
  checkins = @client.recent_checkins(:limit => 2)
20
20
  checkins.count.should == 2
21
21
  checkins.first.venue.name.should == 'Buffalo Billiards'
22
22
  checkins.last.user.firstName.should == 'David'
23
23
  end
24
+
25
+ should "add a post to an existing checkin" do
26
+ stub_post("https://api.foursquare.com/v2/checkins/5041335de4b08d95c1591453/addpost?oauth_token=#{@client.oauth_token}&text=Test", "checkins/post_created.json")
27
+ post = @client.add_checkin_post('5041335de4b08d95c1591453', :text => "Test")
28
+ post.text.should == "Test"
29
+ end
30
+
31
+ should "add a reply to an existing checkin" do
32
+ stub_post("https://api.foursquare.com/v2/checkins/5041eda9e4b0133020c2292c/reply?oauth_token=#{@client.oauth_token}&text=Test", "checkins/checkin_reply.json")
33
+ reply = @client.add_checkin_reply('5041eda9e4b0133020c2292c', :text => "Test")
34
+ reply.text.should == "Test"
35
+ end
24
36
  end
25
37
 
26
38
  end
data/test/test_client.rb CHANGED
@@ -51,7 +51,7 @@ class TestClient < Test::Unit::TestCase
51
51
 
52
52
  context "When returning a successful response" do
53
53
  should "return the response body as a Hash." do
54
- response = Faraday::Response.new(:body => fixture_file('search_venues.json', :parse => true))
54
+ response = Faraday::Response.new(:body => fixture_file('venues/search_venues.json', :parse => true))
55
55
  client = Foursquare2::Client.new
56
56
 
57
57
  subject = client.return_error_or_body(response, response.body.response)