lib/unsplash/photo.rb in unsplash-1.1.0 vs lib/unsplash/photo.rb in unsplash-1.2.0
- old
+ new
@@ -1,9 +1,23 @@
module Unsplash # :nodoc:
# Unsplash Photo operations.
class Photo < Client
+ # Like a photo for the current user.
+ # @return [Boolean] True if successful. Will raise on error.
+ def like!
+ connection.post("/photos/#{id}/like")
+ true
+ end
+
+ # Unlike a photo for the current user.
+ # @return [Boolean] True if successful. Will raise on error.
+ def unlike!
+ connection.delete("/photos/#{id}/like")
+ true
+ end
+
class << self
# Get a photo. Can be cropped or resized using the optional parameters.
# @param id [String] The ID of the photo to retrieve.
# @param width [Integer] Width of customized version of the photo.
\ No newline at end of file