Sha256: 76d4723f7f84457c6362b8da4562e3c50dc4a8c4097e2fc398d63f665a45c56a

Contents?: true

Size: 1.96 KB

Versions: 3

Compression:

Stored size: 1.96 KB

Contents

module Foursquare2
  module Photos

    # Retrieve a photo
    #
    # @params [String] photo_id - The ID of the photo

    def photo(photo_id, options={})
      response = connection.get do |req|
        req.url "photos/#{photo_id}", options
      end
      return_error_or_body(response, response.body.response.photo)
    end

    # Add a photo
    #
    # @param [Hash] options
    # @option options UploadIO :photo - the photo. Like Faraday::UploadIO.new('pic_path', 'image/jpeg')
    # @option options String :checkinId - the ID of a checkin owned by the user
    # @option options String :tipId - the ID of a tip owned by the user
    # @option options String :venueId - the ID of a venue
    # @option options String :broadcast - Required, one or more of private,public,facebook,twitter. Comma-separated.
    # @option options String :ll - Latitude and longitude in format LAT,LON
    # @option options Integer :llAcc - Accuracy of the lat/lon in meters.
    # @option options Integer :alt - Altitude in meters
    # @option options Integer :altAcc - Accuracy of the altitude in meters
    def add_photo(options={})
      response = connection.post('photos/add', options)
      return_error_or_body(response, response.body.response.photo)
    end

    # Retrieve photos for a venue
    #
    # @params [String] venue_id - The ID of the venue
    # @param [Hash] options
    # @option options String :group - Pass checkin for photos added by friends (including on their recent checkins). Pass venue for public photos added to the venue by non-friends. Use multi to fetch both. Default - venue
    # @option options Integer :limit - Number of results to return, up to 500.
    # @option options Integer :offset - Used to page through results.
    def venue_photos(venue_id, options = {:group => 'venue'})
      response = connection.get do |req|
        req.url "venues/#{venue_id}/photos", options
      end
      return_error_or_body(response, response.body.response.photos)
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
foursquare2-2.0.2 lib/foursquare2/photos.rb
foursquare2-2.0.1 lib/foursquare2/photos.rb
foursquare2-2.0.0 lib/foursquare2/photos.rb