Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
--color
--format documentation
6 changes: 6 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
source :rubygems
gemspec

group :development do
gem 'rspec'
end
30 changes: 30 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
PATH
remote: .
specs:
quimby (0.4.4)
json
typhoeus

GEM
remote: http://rubygems.org/
specs:
diff-lcs (1.1.2)
json (1.6.1)
mime-types (1.17.2)
rspec (2.5.0)
rspec-core (~> 2.5.0)
rspec-expectations (~> 2.5.0)
rspec-mocks (~> 2.5.0)
rspec-core (2.5.1)
rspec-expectations (2.5.0)
diff-lcs (~> 1.1.2)
rspec-mocks (2.5.0)
typhoeus (0.3.2)
mime-types

PLATFORMS
ruby

DEPENDENCIES
quimby!
rspec
10 changes: 10 additions & 0 deletions lib/foursquare/list.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,25 @@ def following?
@json["following"]
end

def followers?
@json["followers"]["count"] != 0
end

def followers
return [] unless followers?
fetch if @json["followers"]["items"].blank?

@json["followers"]["items"].map do |user|
Foursquare::User.new(@foursquare, user)
end
end

def collaborators?
@json["collaborators"]["count"] != 0
end

def collaborators
return [] unless collaborators?
fetch if @json["collaborators"]["items"].blank?

@json["collaborators"]["items"].map do |user|
Expand Down
4 changes: 3 additions & 1 deletion spec/THERE_ARENT_ANY
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
My bad. Whatevz.
My bad. Whatevz.

LULZ =)
1 change: 1 addition & 0 deletions spec/fixtures/item_example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"id":"t4bccde3770c603bb947898b4","venue":{"id":"4ba2aa53f964a5200e0e38e3","name":"Libre Sens","contact":{},"location":{"address":"33 rue marboeuf","lat":48.869435,"lng":2.305048,"postalCode":"75008","city":"Paris","state":"Ile-de-France"},"categories":[{"id":"4bf58dd8d48988d10c941735","name":"French Restaurant","pluralName":"French Restaurants","shortName":"French","icon":"https://foursquare.com/img/categories/food/french.png","parents":["Food"],"primary":true},{"id":"4bf58dd8d48988d1f4941735","name":"Design Studio","pluralName":"Design Studios","shortName":"Design","icon":"https://foursquare.com/img/categories/shops/default.png","parents":["Shops & Services"]},{"id":"4bf58dd8d48988d116941735","name":"Bar","pluralName":"Bars","shortName":"Bar","icon":"https://foursquare.com/img/categories/nightlife/bar.png","parents":["Nightlife Spots"]}],"verified":false,"stats":{"checkinsCount":64,"usersCount":45,"tipCount":6}},"createdAt":1271717431,"todo":false,"done":true,"visitedCount":0,"tip":{"id":"4bccde3770c603bb947898b4","createdAt":1271717431,"text":"Go there for dinner with some friends and ask for the central table in front of the Dj.","status":"done","todo":{"count":2},"done":{"count":3},"user":{"id":"703332","firstName":"Vincent","lastName":"Coste","photo":"https://playfoursquare.s3.amazonaws.com/userpix_thumbs/AB5K14C5NQP3KJNV.jpg","gender":"male","homeCity":"Paris, Ile-de-France","relationship":"self"}},"listed":{"count":0,"items":[]}}
1 change: 1 addition & 0 deletions spec/fixtures/list_item_example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"id":"703332/tips","name":"My Tips","description":"","user":{"id":"703332","firstName":"Vincent","lastName":"Coste","photo":"https://playfoursquare.s3.amazonaws.com/userpix_thumbs/AB5K14C5NQP3KJNV.jpg","gender":"male","homeCity":"Paris, Ile-de-France","relationship":"self"},"editable":false,"public":false,"collaborative":false,"url":"https://foursquare.com/user/703332/list/tips","canonicalUrl":"https://foursquare.com/user/703332/list/tips","doneCount":2,"visitedCount":1,"venueCount":2,"following":false,"followers":{"count":0},"collaborators":{"count":0,"items":[]},"listItems":{"count":2,"items":[{"id":"t4bccde3770c603bb947898b4","venue":{"id":"4ba2aa53f964a5200e0e38e3","name":"Libre Sens","contact":{},"location":{"address":"33 rue marboeuf","lat":48.869435,"lng":2.305048,"postalCode":"75008","city":"Paris","state":"Ile-de-France"},"categories":[{"id":"4bf58dd8d48988d10c941735","name":"French Restaurant","pluralName":"French Restaurants","shortName":"French","icon":"https://foursquare.com/img/categories/food/french.png","parents":["Food"],"primary":true},{"id":"4bf58dd8d48988d1f4941735","name":"Design Studio","pluralName":"Design Studios","shortName":"Design","icon":"https://foursquare.com/img/categories/shops/default.png","parents":["Shops & Services"]},{"id":"4bf58dd8d48988d116941735","name":"Bar","pluralName":"Bars","shortName":"Bar","icon":"https://foursquare.com/img/categories/nightlife/bar.png","parents":["Nightlife Spots"]}],"verified":false,"stats":{"checkinsCount":64,"usersCount":45,"tipCount":6}},"createdAt":1271717431,"todo":false,"done":true,"visitedCount":0,"tip":{"id":"4bccde3770c603bb947898b4","createdAt":1271717431,"text":"Go there for dinner with some friends and ask for the central table in front of the Dj.","status":"done","todo":{"count":2},"done":{"count":3},"user":{"id":"703332","firstName":"Vincent","lastName":"Coste","photo":"https://playfoursquare.s3.amazonaws.com/userpix_thumbs/AB5K14C5NQP3KJNV.jpg","gender":"male","homeCity":"Paris, Ile-de-France","relationship":"self"}},"listed":{"count":0,"items":[]}},{"id":"t4bccdd6970c603bb7f7898b4","venue":{"id":"4adcda07f964a5201f3321e3","name":"Social Club","contact":{"twitter":"ParisSocialClub"},"location":{"address":"142 Rue Montmartre","lat":48.868949291982865,"lng":2.3430919647216797,"postalCode":"75002","city":"Paris","state":"Île de France","country":"France"},"categories":[{"id":"4bf58dd8d48988d11f941735","name":"Nightclub","pluralName":"Nightclubs","shortName":"Nightclub / Discotheque","icon":"https://foursquare.com/img/categories/nightlife/danceparty.png","parents":["Nightlife Spots"],"primary":true},{"id":"4bf58dd8d48988d116941735","name":"Bar","pluralName":"Bars","shortName":"Bar","icon":"https://foursquare.com/img/categories/nightlife/bar.png","parents":["Nightlife Spots"]},{"id":"4bf58dd8d48988d1da941735","name":"Concert Hall","pluralName":"Concert Halls","shortName":"Concert Hall","icon":"https://foursquare.com/img/categories/nightlife/musicvenue.png","parents":["Nightlife Spots","Music Venues"]}],"verified":false,"stats":{"checkinsCount":1261,"usersCount":706,"tipCount":26},"url":"http://parissocialclub.com"},"createdAt":1271717225,"todo":false,"done":true,"visitedCount":4,"tip":{"id":"4bccdd6970c603bb7f7898b4","createdAt":1271717225,"text":"Just go there and enjoy some good electro music!","status":"done","todo":{"count":2},"done":{"count":4},"user":{"id":"703332","firstName":"Vincent","lastName":"Coste","photo":"https://playfoursquare.s3.amazonaws.com/userpix_thumbs/AB5K14C5NQP3KJNV.jpg","gender":"male","homeCity":"Paris, Ile-de-France","relationship":"self"}},"listed":{"count":0,"items":[]}}]}}
1 change: 1 addition & 0 deletions spec/fixtures/user_example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"id":"703332","firstName":"Vincent","lastName":"Coste","photo":"https://playfoursquare.s3.amazonaws.com/userpix_thumbs/AB5K14C5NQP3KJNV.jpg","gender":"male","homeCity":"Paris, Ile-de-France","relationship":"self","type":"user","pings":false,"contact":{"email":"coste.vincent@gmail.com","twitter":"patothon","facebook":"591628902"},"badges":{"count":11},"mayorships":{"count":3,"items":[]},"checkins":{"count":233,"items":[{"id":"4e74bd3045ddd4323f6823c4","createdAt":1316273456,"type":"checkin","timeZone":"Europe/Paris","venue":{"id":"4c8a35721eafb1f780017835","name":"Le Camping","contact":{},"location":{"address":"Place de la Bourse","lat":48.869280981712926,"lng":2.3417186737060547,"postalCode":"75002","city":"Paris","state":"Ile-de-France"},"categories":[{"id":"4bf58dd8d48988d125941735","name":"Tech Startup","pluralName":"Tech Startups","shortName":"Tech Startup","icon":"https://foursquare.com/img/categories/building/default.png","parents":["Professional & Other Places","Offices"],"primary":true},{"id":"4bf58dd8d48988d174941735","name":"Coworking Space","pluralName":"Coworking Spaces","shortName":"Coworking Space","icon":"https://foursquare.com/img/categories/building/default.png","parents":["Professional & Other Places","Offices"]}],"verified":false,"stats":{"checkinsCount":812,"usersCount":261,"tipCount":4}},"event":{"id":"4e74b20c1fc77084d10c53cd","name":"foursquare global hackathon","foreignIds":{"count":0,"items":[]}}}]},"friends":{"count":39,"groups":[{"type":"others","name":"Other friends","count":39,"items":[]}]},"following":{"count":0},"requests":{"count":2},"tips":{"count":2},"todos":{"count":3},"scores":{"recent":68,"max":91,"checkinsCount":16}}
1 change: 1 addition & 0 deletions spec/fixtures/user_lists_example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"lists":{"groups":[{"type":"todos","count":1,"items":[{"id":"703332/todos","name":"My To-Do List","description":"","user":{"id":"703332","firstName":"Vincent","lastName":"Coste","photo":"https://playfoursquare.s3.amazonaws.com/userpix_thumbs/AB5K14C5NQP3KJNV.jpg","gender":"male","homeCity":"Paris, Ile-de-France","relationship":"self"},"editable":false,"public":false,"collaborative":false,"url":"https://foursquare.com/user/703332/list/todos","canonicalUrl":"https://foursquare.com/user/703332/list/todos","followers":{"count":0},"listItems":{"count":3}}]},{"type":"created","name":"Lists I created","count":1,"items":[{"id":"4e7632de1838f9188a2dfe78","name":"date spots","description":"","user":{"id":"703332","firstName":"Vincent","lastName":"Coste","photo":"https://playfoursquare.s3.amazonaws.com/userpix_thumbs/AB5K14C5NQP3KJNV.jpg","gender":"male","homeCity":"Paris, Ile-de-France","relationship":"self"},"editable":true,"public":true,"collaborative":false,"url":"https://foursquare.com/patothon/list/date-spots","canonicalUrl":"https://foursquare.com/patothon/list/date-spots","createdAt":1316369118,"updatedAt":1316369126,"followers":{"count":0},"listItems":{"count":1}}]},{"type":"edited","name":"Lists I am helping friends make","count":1,"items":[{"id":"4e661678c65b2dc8a1270a73","name":"burgers in Paris","description":"Some places to eat good burgers in Paris","user":{"id":"162808","firstName":"Olivier","lastName":"Desmoulin","photo":"https://playfoursquare.s3.amazonaws.com/userpix_thumbs/BY5Q0DA1PIG5YALV.png","gender":"male","homeCity":"Paris, France","relationship":"friend"},"editable":true,"public":true,"collaborative":true,"url":"https://foursquare.com/odesmoulin/list/burgers-in-paris","canonicalUrl":"https://foursquare.com/odesmoulin/list/burgers-in-paris","createdAt":1315313272,"updatedAt":1316253363,"photo":{"id":"4d4be13f38bc2da13ad33573","createdAt":1296818495,"url":"https://playfoursquare.s3.amazonaws.com/pix/YZ0SATBBB0YF34C0FYCENELJQKTLEEXFDKLEEPTBDPSQ2VRJ.jpg","sizes":{"count":4,"items":[{"url":"https://playfoursquare.s3.amazonaws.com/pix/YZ0SATBBB0YF34C0FYCENELJQKTLEEXFDKLEEPTBDPSQ2VRJ.jpg","width":537,"height":720},{"url":"https://playfoursquare.s3.amazonaws.com/derived_pix/YZ0SATBBB0YF34C0FYCENELJQKTLEEXFDKLEEPTBDPSQ2VRJ_300x300.jpg","width":300,"height":300},{"url":"https://playfoursquare.s3.amazonaws.com/derived_pix/YZ0SATBBB0YF34C0FYCENELJQKTLEEXFDKLEEPTBDPSQ2VRJ_100x100.jpg","width":100,"height":100},{"url":"https://playfoursquare.s3.amazonaws.com/derived_pix/YZ0SATBBB0YF34C0FYCENELJQKTLEEXFDKLEEPTBDPSQ2VRJ_36x36.jpg","width":36,"height":36}]},"user":{"id":"422771","firstName":"Herve","lastName":"P.","photo":"https://playfoursquare.s3.amazonaws.com/userpix_thumbs/4QX3SF0QTPKPQM3H.jpg","gender":"male","homeCity":"Paris, France"},"visibility":"public"},"followers":{"count":12},"listItems":{"count":10}}]},{"type":"followed","name":"Lists I follow","count":1,"items":[{"id":"4e661678c65b2dc8a1270a73","name":"burgers in Paris","description":"Some places to eat good burgers in Paris","user":{"id":"162808","firstName":"Olivier","lastName":"Desmoulin","photo":"https://playfoursquare.s3.amazonaws.com/userpix_thumbs/BY5Q0DA1PIG5YALV.png","gender":"male","homeCity":"Paris, France","relationship":"friend"},"editable":true,"public":true,"collaborative":true,"url":"https://foursquare.com/odesmoulin/list/burgers-in-paris","canonicalUrl":"https://foursquare.com/odesmoulin/list/burgers-in-paris","createdAt":1315313272,"updatedAt":1316253363,"photo":{"id":"4d4be13f38bc2da13ad33573","createdAt":1296818495,"url":"https://playfoursquare.s3.amazonaws.com/pix/YZ0SATBBB0YF34C0FYCENELJQKTLEEXFDKLEEPTBDPSQ2VRJ.jpg","sizes":{"count":4,"items":[{"url":"https://playfoursquare.s3.amazonaws.com/pix/YZ0SATBBB0YF34C0FYCENELJQKTLEEXFDKLEEPTBDPSQ2VRJ.jpg","width":537,"height":720},{"url":"https://playfoursquare.s3.amazonaws.com/derived_pix/YZ0SATBBB0YF34C0FYCENELJQKTLEEXFDKLEEPTBDPSQ2VRJ_300x300.jpg","width":300,"height":300},{"url":"https://playfoursquare.s3.amazonaws.com/derived_pix/YZ0SATBBB0YF34C0FYCENELJQKTLEEXFDKLEEPTBDPSQ2VRJ_100x100.jpg","width":100,"height":100},{"url":"https://playfoursquare.s3.amazonaws.com/derived_pix/YZ0SATBBB0YF34C0FYCENELJQKTLEEXFDKLEEPTBDPSQ2VRJ_36x36.jpg","width":36,"height":36}]},"user":{"id":"422771","firstName":"Herve","lastName":"P.","photo":"https://playfoursquare.s3.amazonaws.com/userpix_thumbs/4QX3SF0QTPKPQM3H.jpg","gender":"male","homeCity":"Paris, France"},"visibility":"public"},"followers":{"count":12},"listItems":{"count":10}}]},{"type":"suggested","name":"Suggested Lists","items":[{"id":"4e3022b6922e47c929276721","name":"Architecture in NYC","description":"buildings that make me love New York. friends will make the magic happens also (with tips and photos, because they are good friends).","user":{"id":"21366","firstName":"Pierre","lastName":"Valade","photo":"https://playfoursquare.s3.amazonaws.com/userpix_thumbs/GS4IUGRUPJRTXWRB.jpg","gender":"male","homeCity":"paris, France","relationship":"friend"},"editable":true,"public":true,"collaborative":true,"url":"https://foursquare.com/pierrevalade/list/architecture-in-nyc","canonicalUrl":"https://foursquare.com/pierrevalade/list/architecture-in-nyc","createdAt":1311777462,"updatedAt":1313940672,"photo":{"id":"4e237313628469a5742ac817","createdAt":1310946067,"url":"https://playfoursquare.s3.amazonaws.com/pix/YTIA1KC2LZFDSDQAXIJQQWSC4XO3LVHJIUAC4FSQHAN312NJ.jpg","sizes":{"count":4,"items":[{"url":"https://playfoursquare.s3.amazonaws.com/pix/YTIA1KC2LZFDSDQAXIJQQWSC4XO3LVHJIUAC4FSQHAN312NJ.jpg","width":612,"height":612},{"url":"https://playfoursquare.s3.amazonaws.com/derived_pix/YTIA1KC2LZFDSDQAXIJQQWSC4XO3LVHJIUAC4FSQHAN312NJ_300x300.jpg","width":300,"height":300},{"url":"https://playfoursquare.s3.amazonaws.com/derived_pix/YTIA1KC2LZFDSDQAXIJQQWSC4XO3LVHJIUAC4FSQHAN312NJ_100x100.jpg","width":100,"height":100},{"url":"https://playfoursquare.s3.amazonaws.com/derived_pix/YTIA1KC2LZFDSDQAXIJQQWSC4XO3LVHJIUAC4FSQHAN312NJ_36x36.jpg","width":36,"height":36}]},"user":{"id":"21366","firstName":"Pierre","lastName":"Valade","photo":"https://playfoursquare.s3.amazonaws.com/userpix_thumbs/GS4IUGRUPJRTXWRB.jpg","gender":"male","homeCity":"paris, France","relationship":"friend"},"visibility":"public"},"followers":{"count":33},"listItems":{"count":34}},{"id":"4e05359b8877394591d81808","name":"NYC Bars","description":"","user":{"id":"21366","firstName":"Pierre","lastName":"Valade","photo":"https://playfoursquare.s3.amazonaws.com/userpix_thumbs/GS4IUGRUPJRTXWRB.jpg","gender":"male","homeCity":"paris, France","relationship":"friend"},"editable":false,"public":true,"collaborative":false,"url":"https://foursquare.com/pierrevalade/list/nyc-bars","canonicalUrl":"https://foursquare.com/pierrevalade/list/nyc-bars","createdAt":1308964251,"updatedAt":1313692771,"photo":{"id":"4defa43840a3b72344411729","createdAt":1307550776,"url":"https://playfoursquare.s3.amazonaws.com/pix/1TKUACMVUQ2KDQFQODNCSUW2WTSVWLJPBTWSGF5P0GELJK3E.jpg","sizes":{"count":4,"items":[{"url":"https://playfoursquare.s3.amazonaws.com/pix/1TKUACMVUQ2KDQFQODNCSUW2WTSVWLJPBTWSGF5P0GELJK3E.jpg","width":480,"height":720},{"url":"https://playfoursquare.s3.amazonaws.com/derived_pix/1TKUACMVUQ2KDQFQODNCSUW2WTSVWLJPBTWSGF5P0GELJK3E_300x300.jpg","width":300,"height":300},{"url":"https://playfoursquare.s3.amazonaws.com/derived_pix/1TKUACMVUQ2KDQFQODNCSUW2WTSVWLJPBTWSGF5P0GELJK3E_100x100.jpg","width":100,"height":100},{"url":"https://playfoursquare.s3.amazonaws.com/derived_pix/1TKUACMVUQ2KDQFQODNCSUW2WTSVWLJPBTWSGF5P0GELJK3E_36x36.jpg","width":36,"height":36}]},"user":{"id":"564266","firstName":"Robert","lastName":"R.","photo":"https://playfoursquare.s3.amazonaws.com/userpix_thumbs/AZX2XBEKBGUHMIKD.png","gender":"male","homeCity":"Palo Alto, CA"},"visibility":"public"},"followers":{"count":5},"listItems":{"count":22}},{"id":"4e307e1a52b1a638f0ff5757","name":"No Reservations","description":"Travel tips from No Reservations, hosted by Anthony Bourdain on Travel Channel.","user":{"id":"4579353","firstName":"Travel Channel","photo":"https://playfoursquare.s3.amazonaws.com/userpix_thumbs/LJL3OPUPJLS2MALA.png","gender":"none","homeCity":"Everywhere, United States"},"editable":false,"public":true,"collaborative":false,"url":"https://foursquare.com/travelchannel/list/no-reservations","canonicalUrl":"https://foursquare.com/travelchannel/list/no-reservations","createdAt":1311800858,"updatedAt":1312493413,"photo":{"id":"4e3b0f2b3151eaa7c4399da3","createdAt":1312493355,"url":"https://playfoursquare.s3.amazonaws.com/pix/NV3VQVDFJZLUJVCWF13DJAN1JGZ4I400SQ1Z2BVETFIXG2TP.jpg","sizes":{"count":4,"items":[{"url":"https://playfoursquare.s3.amazonaws.com/pix/NV3VQVDFJZLUJVCWF13DJAN1JGZ4I400SQ1Z2BVETFIXG2TP.jpg","width":596,"height":334},{"url":"https://playfoursquare.s3.amazonaws.com/derived_pix/NV3VQVDFJZLUJVCWF13DJAN1JGZ4I400SQ1Z2BVETFIXG2TP_300x300.jpg","width":300,"height":300},{"url":"https://playfoursquare.s3.amazonaws.com/derived_pix/NV3VQVDFJZLUJVCWF13DJAN1JGZ4I400SQ1Z2BVETFIXG2TP_100x100.jpg","width":100,"height":100},{"url":"https://playfoursquare.s3.amazonaws.com/derived_pix/NV3VQVDFJZLUJVCWF13DJAN1JGZ4I400SQ1Z2BVETFIXG2TP_36x36.jpg","width":36,"height":36}]},"user":{"id":"4579353","firstName":"Travel Channel","photo":"https://playfoursquare.s3.amazonaws.com/userpix_thumbs/LJL3OPUPJLS2MALA.png","gender":"none","homeCity":"Everywhere, United States"},"visibility":"public"},"followers":{"count":913},"listItems":{"count":34}}]},{"type":"dones","count":2,"items":[{"id":"703332/tips","name":"My Tips","description":"","user":{"id":"703332","firstName":"Vincent","lastName":"Coste","photo":"https://playfoursquare.s3.amazonaws.com/userpix_thumbs/AB5K14C5NQP3KJNV.jpg","gender":"male","homeCity":"Paris, Ile-de-France","relationship":"self"},"editable":false,"public":false,"collaborative":false,"url":"https://foursquare.com/user/703332/list/tips","canonicalUrl":"https://foursquare.com/user/703332/list/tips","followers":{"count":0},"listItems":{"count":2}},{"id":"703332/dones","name":"My \"done\" List","description":"","user":{"id":"703332","firstName":"Vincent","lastName":"Coste","photo":"https://playfoursquare.s3.amazonaws.com/userpix_thumbs/AB5K14C5NQP3KJNV.jpg","gender":"male","homeCity":"Paris, Ile-de-France","relationship":"self"},"editable":false,"public":false,"collaborative":false,"url":"https://foursquare.com/user/703332/list/dones","canonicalUrl":"https://foursquare.com/user/703332/list/dones","followers":{"count":0},"listItems":{"count":14}}]}]}}
Loading