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



78
79
80
81
82
83
# File 'lib/foursquare2/lists.rb', line 78

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) ⇒ 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



90
91
92
93
94
95
# File 'lib/foursquare2/lists.rb', line 90

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

#follow_list(list_id) ⇒ Object

Parameters:

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



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

def follow_list(list_id)
  response = connection.post "lists/#{list_id}/follow"
  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



105
106
107
108
109
110
# File 'lib/foursquare2/lists.rb', line 105

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) ⇒ Object

Parameters:

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



46
47
48
49
# File 'lib/foursquare2/lists.rb', line 46

def unfollow_list(list_id)
  response = connection.post "lists/#{list_id}/unfollow"
  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.



60
61
62
63
64
65
# File 'lib/foursquare2/lists.rb', line 60

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