Module: Croudia::API::Friendships
- Included in:
- Client
- Defined in:
- lib/croudia/api/friendships.rb
Instance Method Summary collapse
-
#follow(user, params = {}) ⇒ Croudia::User
Follow a user.
-
#follower_ids(user = current_user, params = {}) ⇒ Croudia::Cursor<Integer>
Follower ids of specified user.
-
#followers(user = current_user, params = {}) ⇒ Croudia::Cursor<Croudia::User>
Followers of specified user.
-
#friend_ids(user = current_user, params = {}) ⇒ Croudia::Cursor<Integer>
Friend ids of specified user.
-
#friends(user = current_user, params = {}) ⇒ Croudia::Cursor<Croudia::User>
Friends of specified user.
-
#friendship(source, target = {}, params = {}) ⇒ Croudia::Relationship
Show relationship between two users.
-
#friendships(*args) ⇒ Array<Croudia::User>
Lookup friendships between the current user and others.
-
#unfollow(user, params = {}) ⇒ Croudia::User
Unfollow a user.
Instance Method Details
#follow(user, params = {}) ⇒ Croudia::User #follow(params = {}) ⇒ Croudia::User
Follow a user
19 20 21 22 23 |
# File 'lib/croudia/api/friendships.rb', line 19 def follow(user, params={}) merge_user!(params, user) resp = post('/friendships/create.json', params) Croudia::User.new(resp) end |
#follower_ids(user = current_user, params = {}) ⇒ Croudia::Cursor<Integer> #follower_ids(params = {}) ⇒ Croudia::Cursor<Integer>
Follower ids of specified user
112 113 114 115 116 |
# File 'lib/croudia/api/friendships.rb', line 112 def follower_ids(user=current_user, params={}) merge_user!(params, user) resp = get('/followers/ids.json', params) Croudia::Cursor.new(:ids, nil, resp) end |
#followers(user = current_user, params = {}) ⇒ Croudia::Cursor<Croudia::User> #followers(params = {}) ⇒ Croudia::Cursor<Croudia::User>
Followers of specified user
154 155 156 157 158 |
# File 'lib/croudia/api/friendships.rb', line 154 def followers(user=current_user, params={}) merge_user!(params, user) resp = get('/followers/list.json', params) Croudia::Cursor.new(:users, Croudia::User, resp) end |
#friend_ids(user = current_user, params = {}) ⇒ Croudia::Cursor<Integer> #friend_ids(params = {}) ⇒ Croudia::Cursor<Integer>
Friend ids of specified user
93 94 95 96 97 |
# File 'lib/croudia/api/friendships.rb', line 93 def friend_ids(user=current_user, params={}) merge_user!(params, user) resp = get('/friends/ids.json', params) Croudia::Cursor.new(:ids, nil, resp) end |
#friends(user = current_user, params = {}) ⇒ Croudia::Cursor<Croudia::User> #friends(params = {}) ⇒ Croudia::Cursor<Croudia::User>
Friends of specified user
133 134 135 136 137 |
# File 'lib/croudia/api/friendships.rb', line 133 def friends(user=current_user, params={}) merge_user!(params, user) resp = get('/friends/list.json', params) Croudia::Cursor.new(:users, Croudia::User, resp) end |
#friendship(source, target, params = {}) ⇒ Croudia::Relationship #friendship(params = {}) ⇒ Croudia::Relationship
Show relationship between two users
56 57 58 59 60 61 |
# File 'lib/croudia/api/friendships.rb', line 56 def friendship(source, target={}, params={}) merge_user!(params, source, :source_screen_name, :source_id) merge_user!(params, target, :target_screen_name, :target_id) resp = get('/friendships/show.json', params) Croudia::Relationship.new(resp) end |
#friendships(*users, params = {}) ⇒ Array<Croudia::User> #friendships(params = {}) ⇒ Array<Croudia::User>
Lookup friendships between the current user and others
74 75 76 77 78 |
# File 'lib/croudia/api/friendships.rb', line 74 def friendships(*args) merge_users!(params = {}, args) resp = get('/friendships/lookup.json', params) objects(Croudia::User, resp) end |
#unfollow(user, params = {}) ⇒ Croudia::User #unfollow(params = {}) ⇒ Croudia::User
Unfollow a user
36 37 38 39 40 |
# File 'lib/croudia/api/friendships.rb', line 36 def unfollow(user, params={}) merge_user!(params, user) resp = post('/friendships/destroy.json', params) Croudia::User.new(resp) end |