foursquare2 1.3.0 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Readme.md CHANGED
@@ -100,6 +100,8 @@ See [the documentation](http://rubydoc.info/gems/foursquare2/frames) or [foursqu
100
100
  client.user_set_friend_pings
101
101
  client.venue
102
102
  client.venue_tips
103
+ client.venue_links
104
+ client.venue_photos
103
105
  client.search_venues
104
106
  client.search_venues_by_tip
105
107
  client.venue_categories
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.3.0
1
+ 1.3.1
data/foursquare2.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{foursquare2}
8
- s.version = "1.3.0"
8
+ s.version = "1.3.1"
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 = %q{2011-11-30}
12
+ s.date = %q{2011-12-05}
13
13
  s.description = %q{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 = [
@@ -54,6 +54,8 @@ Gem::Specification.new do |s|
54
54
  "test/fixtures/user_tips.json",
55
55
  "test/fixtures/user_tips_empty.json",
56
56
  "test/fixtures/venue.json",
57
+ "test/fixtures/venue_links.json",
58
+ "test/fixtures/venue_photos.json",
57
59
  "test/fixtures/venue_tips.json",
58
60
  "test/helper.rb",
59
61
  "test/test_checkins.rb",
@@ -27,6 +27,20 @@ module Foursquare2
27
27
  return_error_or_body(response, response.body.response.photo)
28
28
  end
29
29
 
30
+ # Retrieve photos for a venue
31
+ #
32
+ # @params [String] venue_id - The ID of the venue
33
+ # @param [Hash] options
34
+ # @option options String :group - Pass checkin for photos added by friends (including on their recent checkins). Pass venue for public photos added to the venue by non-friends. Use multi to fetch both. Default - venue
35
+ # @option options Integer :limit - Number of results to return, up to 500.
36
+ # @option options Integer :offset - Used to page through results.
37
+ def venue_photos(venue_id, options = {:group => 'venue'})
38
+ response = connection.get do |req|
39
+ req.url "venues/#{venue_id}/photos", options
40
+ end
41
+ return_error_or_body(response, response.body.response.photos)
42
+ end
43
+
30
44
  end
31
45
  end
32
46
 
@@ -52,6 +52,13 @@ module Foursquare2
52
52
  response = connection.get("venues/categories")
53
53
  return_error_or_body(response, response.body.response.categories)
54
54
  end
55
+
56
+ # Retrieve links for a venue.
57
+
58
+ def venue_links(venue_id)
59
+ response = connection.get("venues/#{venue_id}/links")
60
+ return_error_or_body(response, response.body.response.links)
61
+ end
55
62
 
56
63
  # Add a venue
57
64
  # @param [Hash] options
@@ -0,0 +1,22 @@
1
+ {
2
+ "meta":{"code":200}, "response":{
3
+ "links":{
4
+ "count":2,
5
+ "items":[
6
+ {
7
+ "provider":{
8
+ "id":"voiceplaces"
9
+ },
10
+ "linkedId":"2513467",
11
+ "url":"http:\/\/www.voiceplaces.com\/bridgestone-arena-voice-places-2513467-l\/"
12
+ },
13
+ {
14
+ "provider":{
15
+ "id":"sk"
16
+ },
17
+ "linkedId":"883686"
18
+ }
19
+ ]
20
+ }
21
+ }
22
+ }
@@ -0,0 +1,139 @@
1
+ {
2
+ "meta":{"code":200},
3
+ "response":{
4
+ "photos":{
5
+ "count":222,
6
+ "items":[
7
+ {
8
+ "id":"4edc309e46907c1b44d25ab2",
9
+ "createdAt":1323053214,
10
+ "url":"https:\/\/img-s.foursquare.com\/pix\/YXBAGZFK2OCGY2DU25LMZJTIM3VYCFE52MWSKEJNUTTAYDSI.jpg",
11
+ "sizes":{
12
+ "count":4,
13
+ "items":[
14
+ {
15
+ "url":"https:\/\/img-s.foursquare.com\/pix\/YXBAGZFK2OCGY2DU25LMZJTIM3VYCFE52MWSKEJNUTTAYDSI.jpg",
16
+ "width":460,
17
+ "height":345
18
+ },
19
+ {
20
+ "url":"https:\/\/img-s.foursquare.com\/derived_pix\/YXBAGZFK2OCGY2DU25LMZJTIM3VYCFE52MWSKEJNUTTAYDSI_300x300.jpg",
21
+ "width":300,
22
+ "height":300
23
+ },
24
+ {
25
+ "url":"https:\/\/img-s.foursquare.com\/derived_pix\/YXBAGZFK2OCGY2DU25LMZJTIM3VYCFE52MWSKEJNUTTAYDSI_100x100.jpg",
26
+ "width":100,
27
+ "height":100
28
+ },
29
+ {
30
+ "url":"https:\/\/img-s.foursquare.com\/derived_pix\/YXBAGZFK2OCGY2DU25LMZJTIM3VYCFE52MWSKEJNUTTAYDSI_36x36.jpg",
31
+ "width":36,
32
+ "height":36
33
+ }
34
+ ]
35
+ },
36
+ "source":{
37
+ "name":"foursquare for BlackBerry",
38
+ "url":"https:\/\/foursquare.com\/download\/#\/blackberry"
39
+ },
40
+ "user":{
41
+ "id":"6348125",
42
+ "firstName":"Jeff",
43
+ "lastName":"L.",
44
+ "photo":"https:\/\/img-s.foursquare.com\/userpix_thumbs\/GKLL2MA3KC1TOZSC.jpg",
45
+ "gender":"male",
46
+ "homeCity":"Nashville, TN"
47
+ },
48
+ "visibility":"public"
49
+ },
50
+ {
51
+ "id":"4edc29218b8173160e770d60",
52
+ "createdAt":1323051297,
53
+ "url":"https:\/\/img-s.foursquare.com\/pix\/MEFDPWAYCFGYIB1LUD34ZMNKLBUWGCOC5OENJ40R4XGRPOJO.jpg",
54
+ "sizes":{
55
+ "count":4,
56
+ "items":[
57
+ {
58
+ "url":"https:\/\/img-s.foursquare.com\/pix\/MEFDPWAYCFGYIB1LUD34ZMNKLBUWGCOC5OENJ40R4XGRPOJO.jpg",
59
+ "width":720,
60
+ "height":540
61
+ },
62
+ {
63
+ "url":"https:\/\/img-s.foursquare.com\/derived_pix\/MEFDPWAYCFGYIB1LUD34ZMNKLBUWGCOC5OENJ40R4XGRPOJO_300x300.jpg",
64
+ "width":300,
65
+ "height":300
66
+ },
67
+ {
68
+ "url":"https:\/\/img-s.foursquare.com\/derived_pix\/MEFDPWAYCFGYIB1LUD34ZMNKLBUWGCOC5OENJ40R4XGRPOJO_100x100.jpg",
69
+ "width":100,
70
+ "height":100
71
+ },
72
+ {
73
+ "url":"https:\/\/img-s.foursquare.com\/derived_pix\/MEFDPWAYCFGYIB1LUD34ZMNKLBUWGCOC5OENJ40R4XGRPOJO_36x36.jpg",
74
+ "width":36,
75
+ "height":36
76
+ }
77
+ ]
78
+ },
79
+ "source":{
80
+ "name":"foursquare for Android",
81
+ "url":"https:\/\/foursquare.com\/download\/#\/android"
82
+ },
83
+ "user":{
84
+ "id":"14546146",
85
+ "firstName":"Nicole",
86
+ "lastName":"B.",
87
+ "photo":"https:\/\/img-s.foursquare.com\/userpix_thumbs\/BZUIVUD5TFOUZD1C.jpg",
88
+ "gender":"female",
89
+ "homeCity":"Mannheim, Germany"
90
+ },
91
+ "visibility":"public"
92
+ },
93
+ {
94
+ "id":"4edaee1746907c1b435d2e27",
95
+ "createdAt":1322970647,
96
+ "url":"https:\/\/img-s.foursquare.com\/pix\/KPWJVHJGOXCA4NUBRZSYUBMEJS5JT3I0PLFAV4YIKD43NHBR.jpg",
97
+ "sizes":{
98
+ "count":4,
99
+ "items":[
100
+ {
101
+ "url":"https:\/\/img-s.foursquare.com\/pix\/KPWJVHJGOXCA4NUBRZSYUBMEJS5JT3I0PLFAV4YIKD43NHBR.jpg",
102
+ "width":720,
103
+ "height":406
104
+ },
105
+ {
106
+ "url":"https:\/\/img-s.foursquare.com\/derived_pix\/KPWJVHJGOXCA4NUBRZSYUBMEJS5JT3I0PLFAV4YIKD43NHBR_300x300.jpg",
107
+ "width":300,
108
+ "height":300
109
+ },
110
+ {
111
+ "url":"https:\/\/img-s.foursquare.com\/derived_pix\/KPWJVHJGOXCA4NUBRZSYUBMEJS5JT3I0PLFAV4YIKD43NHBR_100x100.jpg",
112
+ "width":100,
113
+ "height":100
114
+ },
115
+ {
116
+ "url":"https:\/\/img-s.foursquare.com\/derived_pix\/KPWJVHJGOXCA4NUBRZSYUBMEJS5JT3I0PLFAV4YIKD43NHBR_36x36.jpg",
117
+ "width":36,
118
+ "height":36
119
+ }
120
+ ]
121
+ },
122
+ "source":{
123
+ "name":"foursquare for Android",
124
+ "url":"https:\/\/foursquare.com\/download\/#\/android"
125
+ },
126
+ "user":{
127
+ "id":"159907",
128
+ "firstName":"Nik",
129
+ "lastName":"S.",
130
+ "photo":"https:\/\/img-s.foursquare.com\/userpix_thumbs\/TLGVGD3GW1TTKKSB.jpg",
131
+ "gender":"male",
132
+ "homeCity":""
133
+ },
134
+ "visibility":"public"
135
+ }
136
+ ]
137
+ }
138
+ }
139
+ }
data/test/test_venues.rb CHANGED
@@ -65,7 +65,22 @@ class TestVenues < Test::Unit::TestCase
65
65
  venues = @client.explore_venues(:ll => '40.7,-74', :section => 'food', :limit => '2')
66
66
  venues.groups.first.items.count.should == 2
67
67
  end
68
-
68
+
69
+ should "get links for a venue" do
70
+ stub_get("https://api.foursquare.com/v2/venues/4b8c3d87f964a520f7c532e3/links?oauth_token=#{@client.oauth_token}", "venue_links.json")
71
+ links = @client.venue_links('4b8c3d87f964a520f7c532e3')
72
+ links.items.first.linkedId.should == "2513467"
73
+ links.items.size == links.count
74
+ links.items.size.should == 2
75
+ end
76
+
77
+ should "get photos for a venue" do
78
+ stub_get("https://api.foursquare.com/v2/venues/4b8c3d87f964a520f7c532e3/photos?group=venue&oauth_token=#{@client.oauth_token}&limit=3", "venue_photos.json")
79
+ photos = @client.venue_photos('4b8c3d87f964a520f7c532e3', { :group => 'venue', :limit => 3 })
80
+ photos.items.first.id.should == "4edc309e46907c1b44d25ab2"
81
+ photos['count'].should == 222
82
+ photos.items.size.should == 3
83
+ end
69
84
 
70
85
  end
71
86
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foursquare2
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 3
9
- - 0
10
- version: 1.3.0
9
+ - 1
10
+ version: 1.3.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Matt Mueller
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2011-11-30 00:00:00 -06:00
19
+ date: 2011-12-05 00:00:00 -06:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
@@ -254,6 +254,8 @@ files:
254
254
  - test/fixtures/user_tips.json
255
255
  - test/fixtures/user_tips_empty.json
256
256
  - test/fixtures/venue.json
257
+ - test/fixtures/venue_links.json
258
+ - test/fixtures/venue_photos.json
257
259
  - test/fixtures/venue_tips.json
258
260
  - test/helper.rb
259
261
  - test/test_checkins.rb