Method: Unsplash::Photo.find

Defined in:
lib/unsplash/photo.rb

.find(id) ⇒ Unsplash::Photo

Get a photo. Can be cropped or resized using the optional parameters.

Parameters:

  • id (String)

    The ID of the photo to retrieve.

Returns:



42
43
44
45
46
# File 'lib/unsplash/photo.rb', line 42

def find(id)
  photo = Unsplash::Photo.new JSON.parse(connection.get("/photos/#{id}").body)
  photo.user = Unsplash::User.new photo.user
  photo
end