Class: Upcoming::User
Class Method Summary collapse
-
.friends_events(token, per_page = 100, page = 1) ⇒ Object
Retrieve the events being watched/attended by a user’s friends.
-
.info(user_id) ⇒ Object
Retrieve the details about a user.
-
.info_by_email(email) ⇒ Object
Retrieve the details about a user by email.
-
.info_by_username(username) ⇒ Object
Retrieve the details about a user by username/screenname.
-
.metro_list(token) ⇒ Object
Retrieve a list of metros for a particular user.
-
.watchlist(user_id, show = 'upcoming', token = nil) ⇒ Object
Gets all events in the watchlist for a user.
Methods included from Defaults
Class Method Details
.friends_events(token, per_page = 100, page = 1) ⇒ Object
Retrieve the events being watched/attended by a user’s friends. These events can either be public or created by a person who calls the user a friend.
token
(Required) An authentication token required to see the user’s friends events.
per_page
(Numeric, Optional, Default = 100) Number of results to return per page. Max is 100 per page.
page
(Numeric, Optional, Default = 1) The page number of results to return.
76 77 78 79 80 |
# File 'lib/upcoming/user.rb', line 76 def self.friends_events(token, per_page=100, page=1) token = Upcoming::Auth.token_code(token) query = {:method => 'user.getMyFriendsEvents', :per_page => per_page, :page => page} Mash.new(self.get('/', :query => query.merge(Upcoming.))).rsp.event end |
.info(user_id) ⇒ Object
Retrieve the details about a user.
user_id
(Required) The user_id number of the user to look within. To run getInfo on multiple users, simply pass a comma-separated list of user_id numbers.
10 11 12 13 |
# File 'lib/upcoming/user.rb', line 10 def self.info(user_id) user_id = user_id.join(',') if user_id.is_a?(Array) Mash.new(self.get('/', :query => {:method => 'user.getInfo', :user_id => user_id}.merge(Upcoming.))).rsp.user end |
.info_by_email(email) ⇒ Object
Retrieve the details about a user by email
email
(Required) The email of the user to look within. To run getInfoByEmail on multiple addresses, simply pass a comma-separated list of valid email addresses.
30 31 32 33 |
# File 'lib/upcoming/user.rb', line 30 def self.info_by_email(email) email = email.join(',') if email.is_a?(Array) Mash.new(self.get('/', :query => {:method => 'user.getInfoByEmail', :email => email}.merge(Upcoming.))).rsp.user end |
.info_by_username(username) ⇒ Object
Retrieve the details about a user by username/screenname.
username
(Required) The username (or screen name) of the user to look within. To run getInfoByUsername on multiple users, simply pass a comma-separated list of username strings.
20 21 22 23 |
# File 'lib/upcoming/user.rb', line 20 def self.info_by_username(username) username = username.join(',') if username.is_a?(Array) Mash.new(self.get('/', :query => {:method => 'user.getInfoByUsername', :username => username}.merge(Upcoming.))).rsp.user end |
.metro_list(token) ⇒ Object
Retrieve a list of metros for a particular user.
token
(Required) An authentication token.
39 40 41 42 |
# File 'lib/upcoming/user.rb', line 39 def self.metro_list(token) token = Upcoming::Auth.token_code(token) Mash.new(self.get('/', :query => {:method => 'user.getMetroList', :token => token}.merge(Upcoming.))).rsp.metro end |
.watchlist(user_id, show = 'upcoming', token = nil) ⇒ Object
Gets all events in the watchlist for a user. You may optionally pass authentication parameters for this function to get back private events from people who have authenticated user as a friend. The ‘username’ returned is the username of the watchlist owner. It also returns either status=“attend” or status=“watch”. Watchlists for personal events that are created by friends of the user authenticated are shown.
In other words, you pass a username and password. Naturally, you’ll have access to see any events created by others who have you as a friend. If the user_id you query has any of those specific personal events as an item in their watchlist, they will show up in this function.
Additionally, by default, user.getWatchlist only returns events with a start date >= today, or upcoming events. To get all events ever in a user’s watchlist, or to get past events only, pass the “show” parameter.
token
(Optional) An authentication token.
user_id
(Required) The user_id requested.
show
(Optional, Default: ‘upcoming’) May be ‘upcoming’, ‘all’, or ‘past’ to retrieve corresponding events.
59 60 61 62 63 64 |
# File 'lib/upcoming/user.rb', line 59 def self.watchlist(user_id, show='upcoming', token=nil) token = Upcoming::Auth.token_code(token) query = {:method => 'user.getWatchlist', :show => show} query.merge!(:token => token) if token Mash.new(self.get('/', :query => query.merge(Upcoming.))).rsp.event end |