Sha256: 58f658573b7674f2c0decf85adc7276123a23322c7ae079d89bc99ac425f729a

Contents?: true

Size: 1.39 KB

Versions: 3

Compression:

Stored size: 1.39 KB

Contents

module AngellistApi
  class Client
    # Defines methods related to path resources (social connections)
    #
    # @see http://angel.co/api/spec/paths
    module Paths
      # 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
      #
      # @requires_authentication Yes
      # @paginated No
      #
      # @param options [Hash] A customizable set of options.
      # @option options [Array<Integer>] :user_ids Show paths between you and
      #   these users
      # @option options [Array<Integer>] :startup_ids Show paths between you
      #   and these startups
      # @option options [string] :direction "following" or "followed"
      #
      # @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.
      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
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
angellist_api-1.1.0 lib/angellist_api/client/paths.rb
angellist_api-1.0.7 lib/angellist_api/client/paths.rb
angellist_api-1.0.6 lib/angellist_api/client/paths.rb