Module: Foursquare2::Pages

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

Instance Method Summary collapse

Instance Method Details

#managed_pages(options = {}) ⇒ Object

Returns a list of managed pages.



57
58
59
60
61
62
# File 'lib/foursquare2/pages.rb', line 57

def managed_pages(options={})
  response = connection.get do |req|
    req.url "pages/managing", options
  end
  return_error_or_body(response, response.body.response.managing)
end

#page(user_id, options = {}) ⇒ Object

Get information about a page.

/!\ A page is considered by Foursquare as a user.

Parameters:

  • user_id (Integer)
    • Page to get information for.



9
10
11
12
13
14
# File 'lib/foursquare2/pages.rb', line 9

def page(user_id, options={})
  response = connection.get do |req|
    req.url "pages/#{user_id}", options
  end
  return_error_or_body(response, response.body.response.user)
end

#page_venues(page_id, options = {}) ⇒ Object

Get all venues for a given page.

Parameters:

  • page_id (String)
    • The page to retrieve venues for.

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

    a customizable set of options

Options Hash (options):

  • Integer (Object)

    :limit

  • Integer (Object)

    :offset - For paging through results

  • String (Object)

    :ll - Latitude and longitude in format LAT,LON - Limit results to venues near this latitude and longitude. NOT VALID with NE or SW (see after).



43
44
45
46
47
48
49
50
# File 'lib/foursquare2/pages.rb', line 43

def page_venues(page_id, options={})
  response = connection.get do |req|
    req.url "pages/#{page_id}/venues", options
  end
  venues = return_error_or_body(response, response.body.response.venues)
  venues = Foursquare2.filter(venues, options[:query]) if options.has_key? :query
  venues
end

#search_pages(options = {}) ⇒ Object

Search for pages.

Parameters:

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

Options Hash (options):

  • String (Object)

    :twitter - Match on twitter username

  • String (Object)

    :fbid - Match on facebook id.

  • String (Object)

    :name - Match on name



24
25
26
27
28
29
# File 'lib/foursquare2/pages.rb', line 24

def search_pages(options={})
  response = connection.get do |req|
    req.url "pages/search", options
  end
  return_error_or_body(response, response.body.response)
end