Module: AngellistApi::Client::Follows

Included in:
AngellistApi::Client
Defined in:
lib/angellist_api/client/follows.rb

Overview

Defines methods related to URLs

Instance Method Summary collapse

Instance Method Details

#delete_follow(options = {}) ⇒ Object

Makes the authenticated user stop following the specified item. Returns the deleted follow on success, or an error on failure.

Examples:

Make the authenticated user stop following a startup.

AngellistApi.delete_follow(:type => :startup, :id => 12345)

Parameters:

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

    A customizable set of options.

Options Hash (options):

  • :type (String)

    Must be either user or startup.

  • :id (Integer)

    The id of the user or startup to start following.



33
34
35
# File 'lib/angellist_api/client/follows.rb', line 33

def delete_follow(options={})
  delete("1/follows", options)
end

#get_follows(ids) ⇒ Object

Returns the follower and followed information based on comma-separated follow ids, such as those from the activity feed.

Examples:

Get follower and followed information for a batch of follows.

AngellistApi.get_follows([1, 2, 3])

Parameters:

  • ids (Array)

    IDs of the follows to fetch.



47
48
49
50
# File 'lib/angellist_api/client/follows.rb', line 47

def get_follows(ids)
  params = { :ids => ids.join(',') }
  get("1/follows/batch", params)
end

#get_startup_follower_ids(id, options = {}) ⇒ Object

Returns the ids of the given startup’s followers, paginated and ordered by most recent follower first. Responds like GET /users/:id/followers.

Examples:

Get IDs of followers of startup with ID 1234.

AngellistApi.get_startup_follower_ids(1234)

Parameters:

  • id (Integer)

    The id of the given user.

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

    A customizable set of options.



143
144
145
# File 'lib/angellist_api/client/follows.rb', line 143

def get_startup_follower_ids(id, options={})
  get("1/startups/#{id}/followers/ids", options)
end

#get_startup_followers(id, options = {}) ⇒ Object

Returns the given startup’s followers, paginated and ordered by most recent follower first. Responds like GET /users/:id/followers.

Examples:

Get followers of startup with ID 1234.

AngellistApi.get_startup_followers(1234)

Parameters:

  • id (Integer)

    The id of the given startup.

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

    A customizable set of options.



128
129
130
# File 'lib/angellist_api/client/follows.rb', line 128

def get_startup_followers(id, options={})
  get("1/startups/#{id}/followers", options)
end

#get_user_follower_ids(id, options = {}) ⇒ Object

Return the ids of the given user’s followers, paginated and ordered by most recent follower first.

Examples:

Get IDs of the followers of user with ID 12345.

AngellistApi.get_user_follower_ids(12345)

Parameters:

  • id (Integer)

    The id of the given user.

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

    A customizable set of options.



78
79
80
# File 'lib/angellist_api/client/follows.rb', line 78

def get_user_follower_ids(id, options={})
  get("1/users/#{id}/followers/ids", options)
end

#get_user_followers(id, options = {}) ⇒ Object

Return the given user’s followers, paginated and ordered by most recent follower first.

Examples:

Get followers of user with ID 12345.

AngellistApi.get_user_followers(12345)

Parameters:

  • id (Integer)

    The id of the given user.

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

    A customizable set of options.



63
64
65
# File 'lib/angellist_api/client/follows.rb', line 63

def get_user_followers(id, options={})
  get("1/users/#{id}/followers", options)
end

#get_user_following(id, options = {}) ⇒ Object

Return objects that the given user is following, paginated and ordered by most recent follow first. See the type parameter to specify which class of objects to return.

Examples:

Get startups that user with ID 1234 is following.

AngellistApi.get_user_following(1234, :type => :startup)

Parameters:

  • id (Integer)

    The id of the given user.

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

    A customizable set of options.

Options Hash (options):

  • :type (String) — default: 'user'

    Must be either user or startup.



95
96
97
# File 'lib/angellist_api/client/follows.rb', line 95

def get_user_following(id, options={})
  get("1/users/#{id}/following", options)
end

#get_user_following_ids(id, options = {}) ⇒ Object

Return ids of objects that the given user is following, paginated and ordered by most recent follow first. See the type parameter to specify which class of objects to return. Responds like GET /users/:id/followers/ids.

Examples:

Get IDs of startups that user with ID 1234 is following.

AngellistApi.get_user_following_ids(1234, :type => :startup)

Parameters:

  • id (Integer)

    The id of the given user.

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

    A customizable set of options.

Options Hash (options):

  • :type (String) — default: 'user'

    Must be either user or startup.



113
114
115
# File 'lib/angellist_api/client/follows.rb', line 113

def get_user_following_ids(id, options={})
  get("1/users/#{id}/following/ids", options)
end

#new_follow(options = {}) ⇒ Object

Makes the authenticated user follow the specified item. Returns the new follow on success, or an error on failure.

Examples:

Follow a startup with the authenticated user.

AngellistApi.new_follow(:type => :startup, :id => 12345)

Parameters:

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

    A customizable set of options.

Options Hash (options):

  • :type (String)

    Must be either user or startup.

  • :id (Integer)

    The id of the user or startup to start following.



18
19
20
# File 'lib/angellist_api/client/follows.rb', line 18

def new_follow(options={})
  post("1/follows", options)
end