From eee86e2e276671fcd787c6568933a04740bc94b5 Mon Sep 17 00:00:00 2001 From: Jeremy Clemenson Date: Mon, 19 Sep 2011 11:20:22 -0400 Subject: [PATCH 1/3] access tips by venue --- lib/foursquare/venue.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/foursquare/venue.rb b/lib/foursquare/venue.rb index 6c0eea3..c9a2827 100644 --- a/lib/foursquare/venue.rb +++ b/lib/foursquare/venue.rb @@ -101,5 +101,11 @@ def here_now_checkins(options={:limit => "50"}) end end + # https://developer.foursquare.com/docs/venues/tips.html + def tips + @foursquare.get("venues/#{id}/tips")["tips"]["items"].map do |item| + Foursquare::Tip.new(@foursquare, item) + end + end end end From 0dede4a69f39e743c3aefaceba34ddcc3ab3f9a6 Mon Sep 17 00:00:00 2001 From: Jeremy Clemenson Date: Mon, 19 Sep 2011 11:21:46 -0400 Subject: [PATCH 2/3] enable tip search --- lib/foursquare/base.rb | 4 ++++ lib/foursquare/tip_proxy.rb | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 lib/foursquare/tip_proxy.rb diff --git a/lib/foursquare/base.rb b/lib/foursquare/base.rb index ee7049c..5f43120 100644 --- a/lib/foursquare/base.rb +++ b/lib/foursquare/base.rb @@ -24,6 +24,10 @@ def checkins def venues Foursquare::VenueProxy.new(self) end + + def tips + Foursquare::TipProxy.new(self) + end def settings @settings ||= Foursquare::Settings.new(self) diff --git a/lib/foursquare/tip_proxy.rb b/lib/foursquare/tip_proxy.rb new file mode 100644 index 0000000..f0c1950 --- /dev/null +++ b/lib/foursquare/tip_proxy.rb @@ -0,0 +1,18 @@ +module Foursquare + class TipProxy + def initialize(foursquare) + @foursquare = foursquare + end + + def find(id) + Foursquare::Venue.new(@foursquare, @foursquare.get("tips/#{id}")["tip"]) + end + + def search(options={}) + raise ArgumentError, "You must include :ll" unless options[:ll] + @foursquare.get("tips/search", options)["tips"].map do |json| + Foursquare::Tip.new(@foursquare, json) + end + end + end +end \ No newline at end of file From a05269234b7e808db26b0f7a0794bf5b9c0f19d5 Mon Sep 17 00:00:00 2001 From: Jeremy Clemenson Date: Mon, 19 Sep 2011 11:30:56 -0400 Subject: [PATCH 3/3] tips branch --- lib/foursquare/base.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/foursquare/base.rb b/lib/foursquare/base.rb index 5f43120..68be080 100644 --- a/lib/foursquare/base.rb +++ b/lib/foursquare/base.rb @@ -28,7 +28,7 @@ def venues def tips Foursquare::TipProxy.new(self) end - + def settings @settings ||= Foursquare::Settings.new(self) end