lib/gowalla/client.rb in gowalla-0.2.1 vs lib/gowalla/client.rb in gowalla-0.3.0
- old
+ new
@@ -85,10 +85,33 @@
# @return [Hashie::Mash] Spot info
def spot_items(spot_id)
connection.get("/spots/#{spot_id}/items").body.items
end
+ # Retrieve a list of flags for a particular spot
+ #
+ # @param [Integer] spot_id Spot ID
+ # @return [Hashie::Mash] Array of Flags
+ def spot_flags(spot_id)
+ connection.get("/spots/#{spot_id}/flags").body.flags
+ end
+
+ # Retrieve a list of flags
+ #
+ # @return [<Hashie::Mash>] Flag info
+ def list_flags(options={})
+ connection.get("/flags").body.flags
+ end
+
+ # Retrieve information about a particular flag
+ #
+ # @param [Integer] flag_id Flag ID
+ # @return [Hashie::Mash] Flag info
+ def flag(flag_id)
+ connection.get("/flags/#{flag_id}").body
+ end
+
# Retrieve a list of spots within a specified distance of a location
#
# @option options [Float] :latitude Latitude of search location
# @option options [Float] :longitude Longitude of search location
# @option options [Integer] :radius Search radius (in meters)
@@ -126,9 +149,35 @@
#
# @param [Integer] id Category ID
# @return [Hashie::Mash] category info
def category(id)
connection.get("/categories/#{id}").body
+ end
+
+ # Fetch info for a checkin
+ #
+ # @param [Integer] id Checkin ID
+ # @return [Hashie::Mash] checkin info
+ def checkin_info(id)
+ connection.get("/checkins/#{id}").body
+ end
+
+ # Check in at a spot
+ #
+ # @option details [Integer] :spot_id Spot ID
+ # @option details [Float] :lat Latitude of spot
+ # @option details [Float] :lng Longitude of spot
+ # @option details [String] :comment Checkin comment
+ # @option details [Boolean] :post_to_twitter Post Checkin to Twitter
+ # @option details [Boolean] :post_to_facebook Post Checkin to Facebook
+ def checkin(details={})
+ checkin_path = "/checkins"
+ checkin_path += "/test" if Gowalla.test_mode?
+ response = connection.post do |req|
+ req.url checkin_path
+ req.body = details
+ end
+ response.body
end
# Check for missing access token
#
# @return [Boolean] whether or not to redirect to get an access token
\ No newline at end of file