Module: Foursquare2::Photos

Included in:
Client
Defined in:
lib/foursquare2/photos.rb

Instance Method Summary collapse

Instance Method Details

#add_photo(options = {}) ⇒ Object

Add a photo

Parameters:

  • options (Hash) (defaults to: {})

Options Hash (options):

  • UploadIO (Object)

    :photo - the photo. Like Faraday::UploadIO.new(‘pic_path’, ‘image/jpeg’)

  • String (Object)

    :checkinId - the ID of a checkin owned by the user

  • String (Object)

    :tipId - the ID of a tip owned by the user

  • String (Object)

    :venueId - the ID of a venue

  • String (Object)

    :broadcast - Required, one or more of private,public,facebook,twitter. Comma-separated.

  • String (Object)

    :ll - Latitude and longitude in format LAT,LON

  • Integer (Object)

    :llAcc - Accuracy of the lat/lon in meters.

  • Integer (Object)

    :alt - Altitude in meters

  • Integer (Object)

    :altAcc - Accuracy of the altitude in meters



27
28
29
30
# File 'lib/foursquare2/photos.rb', line 27

def add_photo(options={})
  response = connection.post('photos/add', options)
  return_error_or_body(response, response.body.response.photo)
end

#photo(photo_id, options = {}) ⇒ Object

Retrieve a photo



8
9
10
11
12
13
# File 'lib/foursquare2/photos.rb', line 8

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

#venue_photos(venue_id, options = {:group => 'venue'}) ⇒ Object

Retrieve photos for a venue

Parameters:

  • options (Hash) (defaults to: {:group => 'venue'})

Options Hash (options):

  • String (Object)

    :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

  • Integer (Object)

    :limit - Number of results to return, up to 500.

  • Integer (Object)

    :offset - Used to page through results.



39
40
41
42
43
44
# File 'lib/foursquare2/photos.rb', line 39

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