Module: Foursquare2::Lists

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

Instance Method Summary collapse

Instance Method Details

#add_list(options = {}) ⇒ Object

Parameters:

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

Options Hash (options):

  • String (Object)

    :name - (required) The name of the list

  • String (Object)

    :description - The description of the list.

  • Boolean (Object)

    :collaborative - Boolean indicating if this list can be edited by friends.

  • String (Object)

    :photoId - The id of a photo that should be set as the list photo.



26
27
28
29
30
31
# File 'lib/foursquare2/lists.rb', line 26

def add_list(options={})
  response = connection.post do |req|
    req.url "lists/add", options
  end
    return_error_or_body(response, response.body.response.list)
end

#add_list_item(list_id, options = {}) ⇒ Object

Parameters:

  • list_id (String)
    • The id of the list to update

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

    (all optional)

Options Hash (options):

  • String (Object)

    :venueId - A venue to add to the list.

  • String (Object)

    :text - text to add to item

  • String (Object)

    :url - associate a url with the tip

  • String (Object)

    :tipId - Used to add a tip to a list

  • String (Object)

    :listId - Used with itemId to copy item from a list

  • String (Object)

    :itemId - Used with listId to copy item from a list



82
83
84
85
86
87
# File 'lib/foursquare2/lists.rb', line 82

def add_list_item(list_id, options={})
  response = connection.post do |req|
    req.url "lists/#{list_id}/additem", options
  end
    return_error_or_body(response, response.body.response.item)
end

#delete_list_item(list_id, item_id, options = {}) ⇒ Object

Parameters:

  • list_id (String)
    • The id of the list to delete item from

  • item_id (String)

    The id of the item to delete from list



94
95
96
97
98
99
# File 'lib/foursquare2/lists.rb', line 94

def delete_list_item(list_id, item_id, options={})
  response = connection.post do |req|
    req.url "lists/#{list_id}/deleteitem", {:itemId => item_id}.merge(options)
  end
  return_error_or_body(response, response.body.response.item)
end

#follow_list(list_id, options = {}) ⇒ Object

Parameters:

  • list_id (String)
    • The id of the list to follow.



37
38
39
40
41
42
# File 'lib/foursquare2/lists.rb', line 37

def follow_list(list_id, options={})
  response = connection.post do |req|
    req.url "lists/#{list_id}/follow", options
  end
  return_error_or_body(response, response.body.response.list)
end

#list(list_id, options = {}) ⇒ Object

Retrieve information about a list.

Parameters:

  • list_id (String)
    • The id of the list to retrieve.

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

Options Hash (options):

  • Integer (Object)

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

  • Integer (Object)

    :offset - The number of results to skip. Used to page through results.



11
12
13
14
15
16
# File 'lib/foursquare2/lists.rb', line 11

def list(list_id, options={})
  response = connection.get do |req|
    req.url "lists/#{list_id}", options
  end
  return_error_or_body(response, response.body.response.list)
end

#move_list_item(list_id, item_id, options = {}) ⇒ Object

Parameters:

  • list_id (String)
    • The id of the list on which the item is moved

  • item_id (String)

    The id of the item to move

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

Options Hash (options):

  • String (Object)

    :beforeId - (optional) move itemId before beforeId

  • String (Object)

    :afterId - (optional) move itemId after afterId



109
110
111
112
113
114
# File 'lib/foursquare2/lists.rb', line 109

def move_list_item(list_id, item_id, options={})
  response = connection.post do |req|
    req.url "lists/#{list_id}/moveitem", {:itemId => item_id}.merge(options)
  end
  return_error_or_body(response, response.body.response.list)
end

#unfollow_list(list_id, options = {}) ⇒ Object

Parameters:

  • list_id (String)
    • The id of the list to unfollow.



48
49
50
51
52
53
# File 'lib/foursquare2/lists.rb', line 48

def unfollow_list(list_id, options={})
  response = connection.post do |req|
    req.url "lists/#{list_id}/unfollow", options
  end
  return_error_or_body(response, response.body.response.list)
end

#update_list(list_id, options = {}) ⇒ Object

Parameters:

  • list_id (String)
    • The id of the list to update

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

Options Hash (options):

  • String (Object)

    :name - The name of the list

  • String (Object)

    :description - The description of the list.

  • Boolean (Object)

    :collaborative - Boolean indicating if this list can be edited by friends.

  • String (Object)

    :photoId - The id of a photo that should be set as the list photo.



64
65
66
67
68
69
# File 'lib/foursquare2/lists.rb', line 64

def update_list(list_id, options={})
  response = connection.post do |req|
    req.url "lists/#{list_id}/update", options
  end
    return_error_or_body(response, response.body.response.list)
end