Module: AngellistApi::Client::Paths

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

Overview

Defines methods related to path resources (social connections)

Instance Method Summary collapse

Instance Method Details

#get_paths(options = {}) ⇒ Object

TODO:

This is a great case for a 2.0 version of our lib that has some real OOP abstraction – the results of this as a dumb hash are pretty disgusting to work with.

Show paths between you and given user/startup ids.

Additional notes:

  • for each user/startup up to 10 different paths will show up

  • up to 20 ids per request are allowed

  • do not use user_ids and startup_ids at the same time

Parameters:

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

    A customizable set of options.

Options Hash (options):

  • :user_ids (Array<Integer>)

    Show paths between you and these users

  • :startup_ids (Array<Integer>)

    Show paths between you and these startups

  • :direction (string)

    “following” or “followed”



28
29
30
31
32
33
34
35
36
# File 'lib/angellist_api/client/paths.rb', line 28

def get_paths(options={})
  user_ids = options.delete(:user_ids) { [] }
  startup_ids = options.delete(:startup_ids) { [] }

  options.merge!(:user_ids => user_ids.join(',')) if user_ids.any?
  options.merge!(:startup_ids => startup_ids.join(',')) if startup_ids.any?

  get('1/paths', options)
end