angellist_api 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.md +15 -0
- data/README.md +11 -6
- data/Rakefile +9 -0
- data/lib/angellist_api.rb +1 -3
- data/lib/angellist_api/api.rb +2 -4
- data/lib/angellist_api/authentication.rb +0 -1
- data/lib/angellist_api/client.rb +9 -1
- data/lib/angellist_api/client/activity_feeds.rb +29 -8
- data/lib/angellist_api/client/follows.rb +105 -63
- data/lib/angellist_api/client/jobs.rb +72 -0
- data/lib/angellist_api/client/reviews.rb +17 -6
- data/lib/angellist_api/client/search.rb +31 -0
- data/lib/angellist_api/client/startup_roles.rb +23 -8
- data/lib/angellist_api/client/startups.rb +49 -13
- data/lib/angellist_api/client/status_updates.rb +45 -24
- data/lib/angellist_api/client/tags.rb +52 -30
- data/lib/angellist_api/client/users.rb +39 -17
- data/lib/angellist_api/configuration.rb +24 -29
- data/lib/angellist_api/connection.rb +27 -29
- data/lib/angellist_api/core_ext/hash.rb +19 -0
- data/lib/angellist_api/error.rb +9 -32
- data/lib/angellist_api/error/bad_gateway.rb +7 -0
- data/lib/angellist_api/error/bad_request.rb +7 -0
- data/lib/angellist_api/error/enhance_your_calm.rb +13 -0
- data/lib/angellist_api/error/forbidden.rb +7 -0
- data/lib/angellist_api/error/internal_server_error.rb +7 -0
- data/lib/angellist_api/error/not_acceptable.rb +7 -0
- data/lib/angellist_api/error/not_found.rb +7 -0
- data/lib/angellist_api/error/service_unavailable.rb +7 -0
- data/lib/angellist_api/error/unauthorized.rb +7 -0
- data/lib/angellist_api/request.rb +11 -18
- data/lib/angellist_api/request/angellist_api_oauth.rb +16 -0
- data/lib/angellist_api/request/gateway.rb +18 -0
- data/lib/angellist_api/request/multipart_with_file.rb +36 -0
- data/lib/angellist_api/response/raise_client_error.rb +51 -0
- data/lib/angellist_api/response/raise_server_error.rb +27 -0
- data/lib/angellist_api/version.rb +1 -1
- data/spec/fixtures/cassettes/activity_feeds.yml +273 -0
- data/spec/fixtures/cassettes/follows.yml +1722 -0
- data/spec/fixtures/cassettes/jobs.yml +2052 -0
- data/spec/fixtures/cassettes/reviews.yml +93 -0
- data/spec/fixtures/cassettes/search.yml +169 -0
- data/spec/fixtures/cassettes/startup_roles.yml +1481 -0
- data/spec/fixtures/cassettes/startups.yml +532 -0
- data/spec/fixtures/cassettes/status_updates.yml +125 -0
- data/spec/fixtures/cassettes/tags.yml +762 -0
- data/spec/fixtures/cassettes/users.yml +275 -0
- data/spec/integration/activity_feeds_spec.rb +29 -0
- data/spec/integration/follows_spec.rb +60 -0
- data/spec/integration/jobs_spec.rb +36 -0
- data/spec/integration/reviews_spec.rb +15 -0
- data/spec/integration/search_spec.rb +27 -0
- data/spec/integration/startup_roles_spec.rb +25 -0
- data/spec/integration/startups_spec.rb +36 -0
- data/spec/integration/status_updates_spec.rb +18 -0
- data/spec/integration/tags_spec.rb +29 -0
- data/spec/integration/users_spec.rb +23 -0
- data/spec/spec_helper.rb +5 -2
- data/spec/support/vcr.rb +12 -0
- data/spec/{lib → unit/lib}/angellist_api/api_spec.rb +13 -15
- data/spec/unit/lib/angellist_api/authentication_spec.rb +49 -0
- data/spec/unit/lib/angellist_api/client/activity_feeds_spec.rb +22 -0
- data/spec/unit/lib/angellist_api/client/follows_spec.rb +82 -0
- data/spec/unit/lib/angellist_api/client/jobs_spec.rb +39 -0
- data/spec/unit/lib/angellist_api/client/reviews_spec.rb +14 -0
- data/spec/unit/lib/angellist_api/client/search_spec.rb +15 -0
- data/spec/unit/lib/angellist_api/client/startup_roles_spec.rb +14 -0
- data/spec/unit/lib/angellist_api/client/startups_spec.rb +40 -0
- data/spec/unit/lib/angellist_api/client/status_updates_spec.rb +30 -0
- data/spec/unit/lib/angellist_api/client/tags_spec.rb +39 -0
- data/spec/unit/lib/angellist_api/client/users_spec.rb +39 -0
- data/spec/{lib → unit/lib}/angellist_api/configuration_spec.rb +12 -11
- data/spec/unit/lib/angellist_api/error_spec.rb +124 -0
- data/spec/unit/lib/angellist_api/request_spec.rb +32 -0
- data/spec/unit/lib/angellist_api_spec.rb +42 -0
- metadata +128 -71
- data/lib/faraday/request/angellist_api_oauth.rb +0 -14
- data/lib/faraday/request/gateway.rb +0 -18
- data/lib/faraday/request/multipart_with_file.rb +0 -36
- data/lib/faraday/request/phoenix.rb +0 -18
- data/lib/faraday/response/raise_http_4xx.rb +0 -45
- data/lib/faraday/response/raise_http_5xx.rb +0 -24
- data/spec/lib/angellist_api/authentication_spec.rb +0 -53
- data/spec/lib/angellist_api/client/activity_feeds_spec.rb +0 -16
- data/spec/lib/angellist_api/client/follows_spec.rb +0 -74
- data/spec/lib/angellist_api/client/reviews_spec.rb +0 -16
- data/spec/lib/angellist_api/client/startup_roles_spec.rb +0 -16
- data/spec/lib/angellist_api/client/startups_spec.rb +0 -23
- data/spec/lib/angellist_api/client/status_updates_spec.rb +0 -32
- data/spec/lib/angellist_api/client/tags_spec.rb +0 -40
- data/spec/lib/angellist_api/client/users_spec.rb +0 -30
- data/spec/lib/angellist_api/error_spec.rb +0 -126
- data/spec/lib/angellist_api/request_spec.rb +0 -51
- data/spec/lib/angellist_api_spec.rb +0 -38
|
@@ -1,17 +1,28 @@
|
|
|
1
1
|
module AngellistApi
|
|
2
2
|
class Client
|
|
3
3
|
# Defines methods related to URLs
|
|
4
|
+
#
|
|
5
|
+
# @see http://angel.co/api/spec/reviews
|
|
4
6
|
module Reviews
|
|
5
|
-
# Return reviews for the given user. If no user given, the authenticated
|
|
7
|
+
# Return reviews for the given user. If no user given, the authenticated
|
|
8
|
+
# user is used. Reviews are paginated and ordered by most recent first.
|
|
9
|
+
# Also returns the total count of positive reviews.
|
|
10
|
+
#
|
|
6
11
|
# @requires_authentication Optional
|
|
7
|
-
#
|
|
8
|
-
# @param
|
|
9
|
-
# @option options [Integer] :user_id user_id of the desired user. If none
|
|
10
|
-
#
|
|
12
|
+
#
|
|
13
|
+
# @param [Hash] options A customizable set of options.
|
|
14
|
+
# @option options [Integer] :user_id user_id of the desired user. If none
|
|
15
|
+
# given, defaults to the authenticated user.
|
|
16
|
+
#
|
|
17
|
+
# @example Get reviews for the authenticated user.
|
|
11
18
|
# AngellistApi.get_reviews
|
|
19
|
+
#
|
|
20
|
+
# @example Get reviews for a given user ID.
|
|
21
|
+
# AngellistApi.get_reviews(:user_id => 1234)
|
|
12
22
|
def get_reviews(options={})
|
|
13
|
-
get("1/reviews", options
|
|
23
|
+
get("1/reviews", options)
|
|
14
24
|
end
|
|
15
25
|
end
|
|
16
26
|
end
|
|
17
27
|
end
|
|
28
|
+
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
module AngellistApi
|
|
2
|
+
class Client
|
|
3
|
+
# Defines methods related to URLs
|
|
4
|
+
#
|
|
5
|
+
# @see http://angel.co/api/spec/search
|
|
6
|
+
module Search
|
|
7
|
+
# Search for Startups, Users, MarketTags and LocationTags, optionally
|
|
8
|
+
# narrowing the results by type. Results are sorted by a mix of match and
|
|
9
|
+
# popularity.
|
|
10
|
+
#
|
|
11
|
+
# @requires_authentication No
|
|
12
|
+
# @paginated No
|
|
13
|
+
#
|
|
14
|
+
# @param query [String] The search query. Will be URI-escaped.
|
|
15
|
+
# @param options [Hash] A customizable set of options.
|
|
16
|
+
# @option options [String] :type A scope for the query. Can be one of
|
|
17
|
+
# 'User', 'Startup', 'MarketTag' or 'LocationTag'.
|
|
18
|
+
#
|
|
19
|
+
# @example Search all data types.
|
|
20
|
+
# AngellistApi.search('machine learning')
|
|
21
|
+
#
|
|
22
|
+
# @example Search locations.
|
|
23
|
+
# AngellistApi.search('springfield', :type => 'LocationTag')
|
|
24
|
+
def search(query, options={})
|
|
25
|
+
options.merge!(:query => CGI.escape(query))
|
|
26
|
+
get("1/search", options)
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
@@ -1,18 +1,33 @@
|
|
|
1
1
|
module AngellistApi
|
|
2
2
|
class Client
|
|
3
3
|
# Defines methods related to URLs
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
#
|
|
5
|
+
# @see http://angel.co/api/spec/startup_roles
|
|
6
|
+
module StartupRoles
|
|
7
|
+
# Given a startup_id, returns the users involved in that startup. Given a
|
|
8
|
+
# user_id, returns the startups that user is involved in. If neither
|
|
9
|
+
# parameter is given, the authenticated user is used. Possible roles
|
|
10
|
+
# include founder, employee, past_investor, advisor, incubator and
|
|
11
|
+
# referrer. Roles are paginated and ordered by most recently declared
|
|
12
|
+
# first.
|
|
13
|
+
#
|
|
6
14
|
# @requires_authentication Optional
|
|
7
|
-
#
|
|
8
|
-
# @param
|
|
9
|
-
# @option options [Integer] :user_id The user
|
|
10
|
-
#
|
|
11
|
-
# @
|
|
15
|
+
#
|
|
16
|
+
# @param [Hash] options A customizable set of options.
|
|
17
|
+
# @option options [Integer] :user_id The user whose startup relationships
|
|
18
|
+
# you want to view.
|
|
19
|
+
# @option options [Integer] :startup_id The startup whose user
|
|
20
|
+
# relationships you want to view.
|
|
21
|
+
#
|
|
22
|
+
# @example Get info about authenticated user's startups and roles.
|
|
12
23
|
# AngellistApi.get_startup_roles
|
|
24
|
+
#
|
|
25
|
+
# @example Get users involved in startup with ID 1234, and their roles.
|
|
26
|
+
# AngellistApi.get_startup_roles(:startup_id => 1234)
|
|
13
27
|
def get_startup_roles(options={})
|
|
14
|
-
get("1/startup_roles", options
|
|
28
|
+
get("1/startup_roles", options)
|
|
15
29
|
end
|
|
16
30
|
end
|
|
17
31
|
end
|
|
18
32
|
end
|
|
33
|
+
|
|
@@ -1,28 +1,64 @@
|
|
|
1
1
|
module AngellistApi
|
|
2
2
|
class Client
|
|
3
3
|
# Defines methods related to URLs
|
|
4
|
+
#
|
|
5
|
+
# @see http://angel.co/api/spec/startups
|
|
4
6
|
module Startups
|
|
5
|
-
# Get a startup's information given an
|
|
7
|
+
# Get a startup's information given an ID.
|
|
8
|
+
#
|
|
6
9
|
# @requires_authentication Optional
|
|
7
|
-
#
|
|
8
|
-
# @param
|
|
9
|
-
#
|
|
10
|
-
#
|
|
10
|
+
#
|
|
11
|
+
# @param [Integer] id ID of the desired startup.
|
|
12
|
+
#
|
|
13
|
+
# @example Get a startup's information given an ID.
|
|
14
|
+
# AngellistApi.get_startup(1234)
|
|
11
15
|
def get_startup(id)
|
|
12
|
-
get("1/startups/#{id}"
|
|
16
|
+
get("1/startups/#{id}")
|
|
13
17
|
end
|
|
14
|
-
|
|
18
|
+
|
|
19
|
+
# Returns the comments on the given startup.
|
|
20
|
+
#
|
|
21
|
+
# @requires_authentication Optional
|
|
22
|
+
# @paginated No
|
|
23
|
+
#
|
|
24
|
+
# @param id [Integer] ID of the desired startup.
|
|
25
|
+
#
|
|
26
|
+
# @example Get comments left about a startup with ID 1234.
|
|
27
|
+
# AngellistApi.startup_comments(1234)
|
|
28
|
+
def startup_comments(id)
|
|
29
|
+
get("1/startups/#{id}/comments")
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# Returns up to 50 startups at a time, given an Array of ids.
|
|
33
|
+
#
|
|
34
|
+
# @requires_authentication Optional
|
|
35
|
+
#
|
|
36
|
+
# @param ids [Array] IDs of the startups to fetch.
|
|
37
|
+
#
|
|
38
|
+
# @example Get information for a batch of startups.
|
|
39
|
+
# AngellistApi.get_startups([1, 2, 3])
|
|
40
|
+
def get_startups(ids)
|
|
41
|
+
params = { :ids => ids.join(',') }
|
|
42
|
+
get("1/startups/batch", params)
|
|
43
|
+
end
|
|
44
|
+
|
|
15
45
|
# Search for a startup given a URL slug. Responds like GET /startups/:id.
|
|
46
|
+
#
|
|
16
47
|
# @requires_authentication Optional
|
|
17
|
-
#
|
|
18
|
-
# @param
|
|
19
|
-
# @option options [String] :slug The URL slug of the desired startup.
|
|
20
|
-
# @option options [String] :domain The domain of the desired startup.
|
|
48
|
+
#
|
|
49
|
+
# @param [Hash] options A customizable set of options.
|
|
50
|
+
# @option options [String] :slug The URL slug of the desired startup.
|
|
51
|
+
# @option options [String] :domain The domain of the desired startup.
|
|
52
|
+
# Subdomains are not allowed. Keep in mind that startups can list any
|
|
53
|
+
# domain as their own. The startup with the most followers will be
|
|
54
|
+
# returned in the case of multiple hits.
|
|
55
|
+
#
|
|
21
56
|
# @example Search for a startup given a URL slug. Responds like GET /startups/:id.
|
|
22
|
-
# AngellistApi.startup_search
|
|
57
|
+
# AngellistApi.startup_search(:slug => '500-startups-fund')
|
|
23
58
|
def startup_search(options={})
|
|
24
|
-
get("1/startups/search", options
|
|
59
|
+
get("1/startups/search", options)
|
|
25
60
|
end
|
|
26
61
|
end
|
|
27
62
|
end
|
|
28
63
|
end
|
|
64
|
+
|
|
@@ -1,40 +1,61 @@
|
|
|
1
1
|
module AngellistApi
|
|
2
2
|
class Client
|
|
3
3
|
# Defines methods related to URLs
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
#
|
|
5
|
+
# @see http://angel.co/api/spec/status_updates
|
|
6
|
+
module StatusUpdates
|
|
7
|
+
# Return status updates from the given user or startup. If neither is
|
|
8
|
+
# specified, the authenticated user is used. Status updates are paginated
|
|
9
|
+
# and ordered by most recent first.
|
|
10
|
+
#
|
|
6
11
|
# @requires_authentication Optional
|
|
7
|
-
#
|
|
8
|
-
# @param
|
|
9
|
-
# @option options [Integer] :user_id id of the desired user.
|
|
10
|
-
# @option options [Integer] :startup_id id of the desired startup.
|
|
11
|
-
#
|
|
12
|
+
#
|
|
13
|
+
# @param [Hash] options A customizable set of options.
|
|
14
|
+
# @option options [Integer] :user_id id of the desired user.
|
|
15
|
+
# @option options [Integer] :startup_id id of the desired startup.
|
|
16
|
+
#
|
|
17
|
+
# @example Get status updates for the authenticated user.
|
|
12
18
|
# AngellistApi.get_status_updates
|
|
19
|
+
#
|
|
20
|
+
# @example Get status updates for the startup with ID 1234.
|
|
21
|
+
# AngellistApi.get_status_updates(:startup_id => 1234)
|
|
13
22
|
def get_status_updates(options={})
|
|
14
|
-
get("1/status_updates", options
|
|
23
|
+
get("1/status_updates", options)
|
|
15
24
|
end
|
|
16
|
-
|
|
17
|
-
# Creates a status update for the authenticated user or for a startup the
|
|
25
|
+
|
|
26
|
+
# Creates a status update for the authenticated user or for a startup the
|
|
27
|
+
# authenticated user is a team member of. Returns the new status update
|
|
28
|
+
# on success, or an error on failure.
|
|
29
|
+
#
|
|
18
30
|
# @requires_authentication Yes
|
|
19
|
-
#
|
|
20
|
-
# @param
|
|
21
|
-
# @option options [String] :message The new status. Must be between 1 and
|
|
22
|
-
#
|
|
23
|
-
# @
|
|
24
|
-
#
|
|
31
|
+
#
|
|
32
|
+
# @param [Hash] options A customizable set of options.
|
|
33
|
+
# @option options [String] :message The new status. Must be between 1 and
|
|
34
|
+
# 140 characters.
|
|
35
|
+
# @option options [Integer] :startup_id id of the startup whose status
|
|
36
|
+
# you want to update. If unspecified, the authenticated user's status
|
|
37
|
+
# is updated.
|
|
38
|
+
#
|
|
39
|
+
# @example Update the authenticated user's status.
|
|
40
|
+
# AngellistApi.post_status_updates(:message => "Startup advice: Don't fuck up.")
|
|
25
41
|
def post_status_updates(options={})
|
|
26
|
-
post("1/status_updates", options
|
|
42
|
+
post("1/status_updates", options)
|
|
27
43
|
end
|
|
28
|
-
|
|
29
|
-
# Destroys the specified status update belonging to the authenticated
|
|
44
|
+
|
|
45
|
+
# Destroys the specified status update belonging to the authenticated
|
|
46
|
+
# user or to a startup the authenticated user is a team member of.
|
|
47
|
+
# Returns the destroyed status update on success, or an error on failure.
|
|
48
|
+
#
|
|
30
49
|
# @requires_authentication Yes
|
|
31
|
-
#
|
|
32
|
-
# @param
|
|
33
|
-
#
|
|
34
|
-
#
|
|
50
|
+
#
|
|
51
|
+
# @param [Integer] id ID of the desired status message.
|
|
52
|
+
#
|
|
53
|
+
# @example Destroys specified status update belonging to authenticated user.
|
|
54
|
+
# AngellistApi.delete_status_updates(1234)
|
|
35
55
|
def delete_status_updates(id)
|
|
36
|
-
delete("1/status_updates/#{id}"
|
|
56
|
+
delete("1/status_updates/#{id}")
|
|
37
57
|
end
|
|
38
58
|
end
|
|
39
59
|
end
|
|
40
60
|
end
|
|
61
|
+
|
|
@@ -1,47 +1,69 @@
|
|
|
1
1
|
module AngellistApi
|
|
2
2
|
class Client
|
|
3
|
-
# Defines methods related to URLs
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
# Defines methods related to URLs.
|
|
4
|
+
#
|
|
5
|
+
# @see http://angel.co/api/spec/tags
|
|
6
|
+
module Tags
|
|
7
|
+
# Get information on a tag.
|
|
8
|
+
#
|
|
6
9
|
# @requires_authentication No
|
|
7
|
-
#
|
|
8
|
-
# @param
|
|
9
|
-
#
|
|
10
|
-
#
|
|
10
|
+
#
|
|
11
|
+
# @param [Integer] id ID of the desired tag.
|
|
12
|
+
#
|
|
13
|
+
# @example Get information on a tag.
|
|
14
|
+
# AngellistApi.get_tag(1654)
|
|
11
15
|
def get_tag(id)
|
|
12
|
-
get("1/tags/#{id}"
|
|
16
|
+
get("1/tags/#{id}")
|
|
13
17
|
end
|
|
14
|
-
|
|
15
|
-
# Returns children of the given tag. Market and location tags form a
|
|
18
|
+
|
|
19
|
+
# Returns children of the given tag. Market and location tags form a
|
|
20
|
+
# Directed Acyclic Graph. Results are paginated and ordered by id
|
|
21
|
+
# descending.
|
|
22
|
+
#
|
|
16
23
|
# @requires_authentication No
|
|
17
|
-
#
|
|
18
|
-
# @param
|
|
19
|
-
#
|
|
20
|
-
#
|
|
24
|
+
#
|
|
25
|
+
# @param [Integer] id The id of the desired tag. Currently only works for
|
|
26
|
+
# tags of type MarketTag or LocationTag.
|
|
27
|
+
#
|
|
28
|
+
# @example Get children of a tag.
|
|
29
|
+
# AngellistApi.get_tag_children(1654)
|
|
21
30
|
def get_tag_children(id)
|
|
22
|
-
get("1/tags/#{id}/children"
|
|
31
|
+
get("1/tags/#{id}/children")
|
|
23
32
|
end
|
|
24
|
-
|
|
25
|
-
# Returns parents of the given tag. For more details, see the
|
|
33
|
+
|
|
34
|
+
# Returns parents of the given tag. For more details, see the
|
|
35
|
+
# documentation for GET /tags/:id/children.
|
|
36
|
+
#
|
|
26
37
|
# @requires_authentication No
|
|
27
|
-
#
|
|
28
|
-
# @param
|
|
29
|
-
#
|
|
30
|
-
#
|
|
38
|
+
#
|
|
39
|
+
# @param [Integer] id The id of the desired tag. Currently only works for
|
|
40
|
+
# tags of type MarketTag or LocationTag.
|
|
41
|
+
#
|
|
42
|
+
# @example Get parents of a tag.
|
|
43
|
+
# AngellistApi.get_tag_parents(1654)
|
|
31
44
|
def get_tag_parents(id)
|
|
32
|
-
get("1/tags/#{id}/parents"
|
|
45
|
+
get("1/tags/#{id}/parents")
|
|
33
46
|
end
|
|
34
|
-
|
|
35
|
-
# Returns startups that are tagged with the given tag or a child of the
|
|
47
|
+
|
|
48
|
+
# Returns startups that are tagged with the given tag or a child of the
|
|
49
|
+
# given tag. Results are paginated and ordered according to the order
|
|
50
|
+
# parameter.
|
|
51
|
+
#
|
|
36
52
|
# @requires_authentication Optional
|
|
37
|
-
#
|
|
38
|
-
# @param
|
|
39
|
-
# @option options [String] :order May be one of popularity, asc or desc.
|
|
40
|
-
#
|
|
41
|
-
#
|
|
53
|
+
#
|
|
54
|
+
# @param [Hash] options A customizable set of options.
|
|
55
|
+
# @option options [String] :order May be one of popularity, asc or desc.
|
|
56
|
+
# Startups will be ordered by number of followers, ascending id or
|
|
57
|
+
# descending id, respectively. Defaults to desc
|
|
58
|
+
#
|
|
59
|
+
# @example Get startups tagged with tag ID or its children.
|
|
60
|
+
# AngellistApi.get_tag_startups(1654)
|
|
61
|
+
#
|
|
62
|
+
# @see http://angel.co/api/spec/startups
|
|
42
63
|
def get_tag_startups(id, options = {})
|
|
43
|
-
get("1/tags/#{id}/startups", options
|
|
64
|
+
get("1/tags/#{id}/startups", options)
|
|
44
65
|
end
|
|
45
66
|
end
|
|
46
67
|
end
|
|
47
68
|
end
|
|
69
|
+
|
|
@@ -1,37 +1,59 @@
|
|
|
1
1
|
module AngellistApi
|
|
2
2
|
class Client
|
|
3
3
|
# Defines methods related to URLs
|
|
4
|
+
#
|
|
5
|
+
# @see http://angel.co/api/spec/users
|
|
4
6
|
module Users
|
|
5
7
|
# Get a user's information given an id.
|
|
8
|
+
#
|
|
6
9
|
# @requires_authentication No
|
|
7
|
-
#
|
|
8
|
-
# @param
|
|
10
|
+
#
|
|
11
|
+
# @param [Integer] id ID of the desired user.
|
|
12
|
+
#
|
|
9
13
|
# @example Get a user's information given an id.
|
|
10
|
-
# AngellistApi.get_user
|
|
14
|
+
# AngellistApi.get_user(1234)
|
|
11
15
|
def get_user(id)
|
|
12
|
-
get("1/users/#{id}"
|
|
16
|
+
get("1/users/#{id}")
|
|
13
17
|
end
|
|
14
|
-
|
|
18
|
+
|
|
19
|
+
# Get information for a batch of up to 50 users given a list of user IDs.
|
|
20
|
+
#
|
|
21
|
+
# @requires_authentication No
|
|
22
|
+
#
|
|
23
|
+
# @param [Array] ids IDs of the users to fetch.
|
|
24
|
+
#
|
|
25
|
+
# @example Get information for a batch of users.
|
|
26
|
+
# AngellistApi.get_users([1, 2, 3])
|
|
27
|
+
def get_users(ids)
|
|
28
|
+
params = { :ids => ids.join(',') }
|
|
29
|
+
get("1/users/batch", params)
|
|
30
|
+
end
|
|
31
|
+
|
|
15
32
|
# Search for a user given a URL slug. Responds like GET /users/:id.
|
|
33
|
+
#
|
|
16
34
|
# @requires_authentication No
|
|
17
|
-
#
|
|
18
|
-
# @param
|
|
19
|
-
# @option options [String] :slug The URL slug of the desired user.
|
|
20
|
-
# @option options [String] :md5 An md5 hash of the email address of the
|
|
21
|
-
#
|
|
22
|
-
#
|
|
35
|
+
#
|
|
36
|
+
# @param [Hash] options A customizable set of options.
|
|
37
|
+
# @option options [String] :slug The URL slug of the desired user.
|
|
38
|
+
# @option options [String] :md5 An md5 hash of the email address of the
|
|
39
|
+
# desired user.
|
|
40
|
+
#
|
|
41
|
+
# @example Search for a user by URL slug.
|
|
42
|
+
# AngellistApi.user_search(:slug => '500startups')
|
|
23
43
|
def user_search(options={})
|
|
24
|
-
get("1/users/search", options
|
|
44
|
+
get("1/users/search", options)
|
|
25
45
|
end
|
|
26
|
-
|
|
46
|
+
|
|
27
47
|
# Get the current user's information. Responds like GET /users/:id.
|
|
48
|
+
#
|
|
28
49
|
# @requires_authentication Yes
|
|
29
|
-
#
|
|
30
|
-
# @example Get the
|
|
31
|
-
# AngellistApi.
|
|
50
|
+
#
|
|
51
|
+
# @example Get the authenticated user's information.
|
|
52
|
+
# AngellistApi.me
|
|
32
53
|
def me
|
|
33
|
-
get("1/me"
|
|
54
|
+
get("1/me")
|
|
34
55
|
end
|
|
35
56
|
end
|
|
36
57
|
end
|
|
37
58
|
end
|
|
59
|
+
|