Module: Foursquared::Pages

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

Overview

Pages module

Instance Method Summary collapse

Instance Method Details

#like_page(page_id, options = {}) ⇒ Foursquared::Response::User

Like or unlike a page

Parameters:

  • page_id (String)

    ID of the page to like or unlike.

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

Options Hash (options):

  • :set (Integer)

    If 1, like this page. If 0 unlike (un-do a previous like) it. Default value is 1.

Returns:



43
44
45
46
# File 'lib/foursquared/pages.rb', line 43

def like_page page_id, options={}
  response = post("/pages/#{page_id}/like",options)["response"]
  @page = Foursquared::Response::User.new(self, response["user"])
end

#page(page_id) ⇒ FOursquared::Response::User

Return the page with the given ID

Parameters:

  • page_id (String)

    ID of the page

Returns:

  • (FOursquared::Response::User)


7
8
9
10
# File 'lib/foursquared/pages.rb', line 7

def page page_id
  response  = get("/pages/#{page_id}")["response"]
  @page = Foursquared::Response::User.new(self, response["user"])
end

#page_search(options = {}) ⇒ Object

Search Pages

Parameters:

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

Options Hash (options):

  • :name (String)

    A search term to be applied against page names.

  • :twitter (String)

    A comma-delimited list of Twitter handles to look for.

  • :fbid (String)

    A comma-delimited list of Facebook ID’s to look for.



17
18
19
20
# File 'lib/foursquared/pages.rb', line 17

def page_search options={}
  response = get("/pages/search",options)["response"]
  @pages = response.collect{|result| Foursquared::Response::User.new(self, result)}
end

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

Returns the page’s venues.

Parameters:

  • page_id (String)

    ID of the page

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

Options Hash (options):

  • :ll (String)

    Not valid with ne or sw. Limits results to venues near this latitude and longitude within an optional radius.

  • :radius (String)

    Not valid with ne or sw. Limit results to venues within this many meters of the specified ll

  • :sw (String)

    With ne, limits results to the bounding quadrangle defined by the latitude and longitude given by sw as its south-west corner, and ne as its north-east corner.

  • :ne (String)

    See sw

  • :offset (Integer)

    The offset of which venues to return. Defaults to 0.

  • :limit (String)

    The number of venues to return. Defaults to 20, max of 100.

Returns:

  • (Hash)

    Count and items of venues



32
33
34
35
36
# File 'lib/foursquared/pages.rb', line 32

def page_venues page_id, options={}
  @venues = get("/pages/#{page_id}/venues", options)["response"]["venues"]
  @venues["items"].map!{|item| Foursquared::Response::Venue.new(self, item)}
  @venues
end