diff --git a/lib/foursquare/base.rb b/lib/foursquare/base.rb index ee7049c..68be080 100644 --- a/lib/foursquare/base.rb +++ b/lib/foursquare/base.rb @@ -24,7 +24,11 @@ def checkins def venues Foursquare::VenueProxy.new(self) end - + + def tips + Foursquare::TipProxy.new(self) + end + def settings @settings ||= Foursquare::Settings.new(self) end 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 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