angellist_api 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENSE +20 -0
- data/README.rdoc +3 -0
- data/Rakefile +37 -0
- data/lib/angellist_api.rb +28 -0
- data/lib/angellist_api/api.rb +24 -0
- data/lib/angellist_api/authentication.rb +25 -0
- data/lib/angellist_api/client.rb +27 -0
- data/lib/angellist_api/client/follows.rb +96 -0
- data/lib/angellist_api/client/reviews.rb +17 -0
- data/lib/angellist_api/client/startup_roles.rb +18 -0
- data/lib/angellist_api/client/startups.rb +28 -0
- data/lib/angellist_api/client/status_updates.rb +40 -0
- data/lib/angellist_api/client/tags.rb +47 -0
- data/lib/angellist_api/client/users.rb +37 -0
- data/lib/angellist_api/configuration.rb +90 -0
- data/lib/angellist_api/connection.rb +48 -0
- data/lib/angellist_api/error.rb +59 -0
- data/lib/angellist_api/request.rb +43 -0
- data/lib/angellist_api/version.rb +3 -0
- data/lib/tasks/angellist_api_tasks.rake +4 -0
- data/test/angellist_api_test.rb +7 -0
- data/test/dummy/Rakefile +7 -0
- data/test/dummy/app/assets/javascripts/application.js +9 -0
- data/test/dummy/app/assets/stylesheets/application.css +7 -0
- data/test/dummy/app/controllers/application_controller.rb +3 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/config/application.rb +42 -0
- data/test/dummy/config/boot.rb +10 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +27 -0
- data/test/dummy/config/environments/production.rb +51 -0
- data/test/dummy/config/environments/test.rb +39 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/inflections.rb +10 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/secret_token.rb +7 -0
- data/test/dummy/config/initializers/session_store.rb +8 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +5 -0
- data/test/dummy/config/routes.rb +58 -0
- data/test/dummy/public/404.html +26 -0
- data/test/dummy/public/422.html +26 -0
- data/test/dummy/public/500.html +26 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/script/rails +6 -0
- data/test/test_helper.rb +10 -0
- metadata +136 -0
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2011 YOURNAME
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
begin
|
3
|
+
require 'bundler/setup'
|
4
|
+
rescue LoadError
|
5
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
6
|
+
end
|
7
|
+
begin
|
8
|
+
require 'rdoc/task'
|
9
|
+
rescue LoadError
|
10
|
+
require 'rdoc/rdoc'
|
11
|
+
require 'rake/rdoctask'
|
12
|
+
RDoc::Task = Rake::RDocTask
|
13
|
+
end
|
14
|
+
|
15
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
16
|
+
rdoc.rdoc_dir = 'rdoc'
|
17
|
+
rdoc.title = 'AngellistApi'
|
18
|
+
rdoc.options << '--line-numbers'
|
19
|
+
rdoc.rdoc_files.include('README.rdoc')
|
20
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
Bundler::GemHelper.install_tasks
|
26
|
+
|
27
|
+
require 'rake/testtask'
|
28
|
+
|
29
|
+
Rake::TestTask.new(:test) do |t|
|
30
|
+
t.libs << 'lib'
|
31
|
+
t.libs << 'test'
|
32
|
+
t.pattern = 'test/**/*_test.rb'
|
33
|
+
t.verbose = false
|
34
|
+
end
|
35
|
+
|
36
|
+
|
37
|
+
task :default => :test
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'angellist_api/api'
|
2
|
+
require 'angellist_api/base'
|
3
|
+
require 'angellist_api/client'
|
4
|
+
require 'angellist_api/configuration'
|
5
|
+
require 'angellist_api/error'
|
6
|
+
require 'angellist_api/search'
|
7
|
+
|
8
|
+
module AngellistApi
|
9
|
+
extend Configuration
|
10
|
+
class << self
|
11
|
+
# Alias for AngellistApi::Client.new
|
12
|
+
#
|
13
|
+
# @return [AngellistApi::Client]
|
14
|
+
def new(options={})
|
15
|
+
AngellistApi::Client.new(options)
|
16
|
+
end
|
17
|
+
|
18
|
+
# Delegate to AngellistApi::Client
|
19
|
+
def method_missing(method, *args, &block)
|
20
|
+
return super unless new.respond_to?(method)
|
21
|
+
new.send(method, *args, &block)
|
22
|
+
end
|
23
|
+
|
24
|
+
def respond_to?(method, include_private = false)
|
25
|
+
new.respond_to?(method, include_private) || super(method, include_private)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'angellist_api/authentication'
|
2
|
+
require 'angellist_api/configuration'
|
3
|
+
require 'angellist_api/connection'
|
4
|
+
require 'angellist_api/request'
|
5
|
+
|
6
|
+
module AngellistApi
|
7
|
+
# @private
|
8
|
+
class API
|
9
|
+
include Connection
|
10
|
+
include Request
|
11
|
+
include Authentication
|
12
|
+
|
13
|
+
# @private
|
14
|
+
attr_accessor *Configuration::VALID_OPTIONS_KEYS
|
15
|
+
|
16
|
+
# Creates a new API
|
17
|
+
def initialize(options={})
|
18
|
+
options = AngellistApi.options.merge(options)
|
19
|
+
Configuration::VALID_OPTIONS_KEYS.each do |key|
|
20
|
+
send("#{key}=", options[key])
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module AngellistApi
|
2
|
+
# @private
|
3
|
+
module Authentication
|
4
|
+
private
|
5
|
+
|
6
|
+
# Authentication hash
|
7
|
+
#
|
8
|
+
# @return [Hash]
|
9
|
+
def authentication
|
10
|
+
{
|
11
|
+
:consumer_key => consumer_key,
|
12
|
+
:consumer_secret => consumer_secret,
|
13
|
+
:token => oauth_token,
|
14
|
+
:token_secret => oauth_token_secret,
|
15
|
+
}
|
16
|
+
end
|
17
|
+
|
18
|
+
# Check whether user is authenticated
|
19
|
+
#
|
20
|
+
# @return [Boolean]
|
21
|
+
def authenticated?
|
22
|
+
authentication.values.all?
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module AngellistApi
|
2
|
+
# Wrapper for the AngellistApi REST API
|
3
|
+
#
|
4
|
+
# @note All methods have been separated into modules and follow the same grouping used in {http://angel.co/api the Angellist API Documentation}.
|
5
|
+
class Client < API
|
6
|
+
# Require client method modules after initializing the Client class in
|
7
|
+
# order to avoid a superclass mismatch error, allowing those modules to be
|
8
|
+
# Client-namespaced.
|
9
|
+
require 'angellist_api/client/follows'
|
10
|
+
require 'angellist_api/client/reviews'
|
11
|
+
require 'angellist_api/client/startups'
|
12
|
+
require 'angellist_api/client/startup_roles'
|
13
|
+
require 'angellist_api/client/status_updates'
|
14
|
+
require 'angellist_api/client/tags'
|
15
|
+
require 'angellist_api/client/users'
|
16
|
+
|
17
|
+
alias :api_endpoint :endpoint
|
18
|
+
|
19
|
+
include AngellistApi::Client::Follows
|
20
|
+
include AngellistApi::Client::Reviews
|
21
|
+
include AngellistApi::Client::Startups
|
22
|
+
include AngellistApi::Client::StartupRoles
|
23
|
+
include AngellistApi::Client::StatusUpdates
|
24
|
+
include AngellistApi::Client::Tags
|
25
|
+
include AngellistApi::Client::Users
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,96 @@
|
|
1
|
+
module AngellistApi
|
2
|
+
class Client
|
3
|
+
# Defines methods related to URLs
|
4
|
+
module Follows
|
5
|
+
# Makes the authenticated user follow the specified item. Returns the new follow on success, or an error on failure.
|
6
|
+
# @requires_authentication Yes
|
7
|
+
# @response_format `json`
|
8
|
+
# @param options [Hash] A customizable set of options.
|
9
|
+
# @option options [String] :type Must be either user or startup.
|
10
|
+
# @option options [Integer] :id The id of the user or startup to start following.
|
11
|
+
# @example Makes the authenticated user follow the specified item. Returns the new follow on success, or an error on failure.
|
12
|
+
# AngellistApi.new_follow
|
13
|
+
def new_follow(options={})
|
14
|
+
post("/follows", options, :format => :json, :phoenix => true)
|
15
|
+
end
|
16
|
+
|
17
|
+
# Makes the authenticated user stop following the specified item. Returns the deleted follow on success, or an error on failure.
|
18
|
+
# @requires_authentication Yes
|
19
|
+
# @response_format `json`
|
20
|
+
# @param options [Hash] A customizable set of options.
|
21
|
+
# @option options [String] :type Must be either user or startup.
|
22
|
+
# @option options [Integer] :id The id of the user or startup to start following.
|
23
|
+
# @example Makes the authenticated user stop following the specified item. Returns the deleted follow on success, or an error on failure.
|
24
|
+
# AngellistApi.delete_follow
|
25
|
+
def delete_follow(options={})
|
26
|
+
delete("/follows", options, :format => :json, :phoenix => true)
|
27
|
+
end
|
28
|
+
|
29
|
+
# Return the given user's followers, paginated and ordered by most recent follower first.
|
30
|
+
# @requires_authentication No
|
31
|
+
# @response_format `json`
|
32
|
+
# @param options [Integer] The id of the given user.
|
33
|
+
# @example Return the given user's followers, paginated and ordered by most recent follower first.
|
34
|
+
# AngellistApi.get_user_followers
|
35
|
+
def get_user_followers(id)
|
36
|
+
get("/users/#{id}/followers", :format => :json, :phoenix => true)
|
37
|
+
end
|
38
|
+
|
39
|
+
# Return the ids of the given user's followers, paginated and ordered by most recent follower first.
|
40
|
+
# @requires_authentication No
|
41
|
+
# @response_format `json`
|
42
|
+
# @param options [Integer] The id of the given user.
|
43
|
+
# @example Return the ids of the given user's followers, paginated and ordered by most recent follower first.
|
44
|
+
# AngellistApi.get_user_follower_ids
|
45
|
+
def get_user_follower_ids(id)
|
46
|
+
get("/users/#{id}/followers/ids", :format => :json, :phoenix => true)
|
47
|
+
end
|
48
|
+
|
49
|
+
# 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.
|
50
|
+
# @requires_authentication Optional
|
51
|
+
# @response_format `json`
|
52
|
+
# @param id [Integer] The id of the given user.
|
53
|
+
# @param options [Hash] A customizable set of options.
|
54
|
+
# @option options [String] :type Must be either user or startup.
|
55
|
+
# @example 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.
|
56
|
+
# AngellistApi.get_user_following
|
57
|
+
def get_user_following(id, options={})
|
58
|
+
get("/users/#{id}/following ", options, :format => :json, :phoenix => true)
|
59
|
+
end
|
60
|
+
|
61
|
+
# 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.
|
62
|
+
# @requires_authentication Optional
|
63
|
+
# @response_format `json`
|
64
|
+
# @param id [Integer] The id of the given user.
|
65
|
+
# @param options [Hash] A customizable set of options.
|
66
|
+
# @option options [String] :type Must be either user or startup.
|
67
|
+
# @example 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.
|
68
|
+
# AngellistApi.get_user_following_ids
|
69
|
+
def get_user_following_ids(id, options={})
|
70
|
+
get("/users/#{id}/following/ids ", options, :format => :json, :phoenix => true)
|
71
|
+
end
|
72
|
+
|
73
|
+
# Returns the given startup's followers, paginated and ordered by most recent follower first. Responds like GET /users/:id/followers.
|
74
|
+
# @requires_authentication Optional
|
75
|
+
# @response_format `json`
|
76
|
+
# @param id [Integer] The id of the given user.
|
77
|
+
# @param options [Hash] A customizable set of options.
|
78
|
+
# @example Returns the given startup's followers, paginated and ordered by most recent follower first. Responds like GET /users/:id/followers.
|
79
|
+
# AngellistApi.get_startup_followers
|
80
|
+
def get_startup_followers(id)
|
81
|
+
get("/startups/#{id}/followers", :format => :json, :phoenix => true)
|
82
|
+
end
|
83
|
+
|
84
|
+
# Returns the ids of the given startup's followers, paginated and ordered by most recent follower first. Responds like GET /users/:id/followers.
|
85
|
+
# @requires_authentication Optional
|
86
|
+
# @response_format `json`
|
87
|
+
# @param id [Integer] The id of the given user.
|
88
|
+
# @param options [Hash] A customizable set of options.
|
89
|
+
# @example Returns the ids of the given startup's followers, paginated and ordered by most recent follower first. Responds like GET /users/:id/followers.
|
90
|
+
# AngellistApi.get_startup_follower_ids
|
91
|
+
def get_startup_follower_ids(id)
|
92
|
+
get("/startups/#{id}/followers/ids", :format => :json, :phoenix => true)
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module AngellistApi
|
2
|
+
class Client
|
3
|
+
# Defines methods related to URLs
|
4
|
+
module Reviews
|
5
|
+
# Return reviews for the given user. If no user given, the authenticated user is used. Reviews are paginated and ordered by most recent first. Also returns the total count of positive reviews.
|
6
|
+
# @requires_authentication Optional
|
7
|
+
# @response_format `json`
|
8
|
+
# @param options [Hash] A customizable set of options.
|
9
|
+
# @option options [Integer] :user_id user_id of the desired user. If none given, defaults to the authenticated user.
|
10
|
+
# @example Return reviews for the given user. If no user given, the authenticated user is used. Reviews are paginated and ordered by most recent first. Also returns the total count of positive reviews.
|
11
|
+
# AngellistApi.get_reviews
|
12
|
+
def get_reviews(options={})
|
13
|
+
get("/reviews", options, :format => :json, :phoenix => true)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module AngellistApi
|
2
|
+
class Client
|
3
|
+
# Defines methods related to URLs
|
4
|
+
module StartupRoles
|
5
|
+
# Given a startup_id, returns the users involved in that startup. Given a user_id, returns the startups that user is involved in. If neither parameter is given, the authenticated user is used. Possible roles include team_member, past_investor, advisor and referrer. Roles are paginated and ordered by most recently declared first.
|
6
|
+
# @requires_authentication Optional
|
7
|
+
# @response_format `json`
|
8
|
+
# @param options [Hash] A customizable set of options.
|
9
|
+
# @option options [Integer] :user_id The user who's startup relationships you want to view.
|
10
|
+
# @option options [Integer] :startup_id The startup who's user relationships you want to view.
|
11
|
+
# @example Given a startup_id, returns the users involved in that startup. Given a user_id, returns the startups that user is involved in. If neither parameter is given, the authenticated user is used. Possible roles include team_member, past_investor, advisor and referrer. Roles are paginated and ordered by most recently declared first.
|
12
|
+
# AngellistApi.get_startup_roles
|
13
|
+
def get_startup_roles(options={})
|
14
|
+
get("/startup_roles", options, :format => :json, :phoenix => true)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module AngellistApi
|
2
|
+
class Client
|
3
|
+
# Defines methods related to URLs
|
4
|
+
module Startups
|
5
|
+
# Get a startup's information given an id.
|
6
|
+
# @requires_authentication Optional
|
7
|
+
# @response_format `json`
|
8
|
+
# @param id [Integer] :id id of the desired startup.
|
9
|
+
# @example Get a startup's information given an id.
|
10
|
+
# AngellistApi.get_startup
|
11
|
+
def get_startup(id)
|
12
|
+
get("/startups/#{id}", :format => :json, :phoenix => true)
|
13
|
+
end
|
14
|
+
|
15
|
+
# Search for a startup given a URL slug. Responds like GET /startups/:id.
|
16
|
+
# @requires_authentication Optional
|
17
|
+
# @response_format `json`
|
18
|
+
# @param options [Hash] A customizable set of options.
|
19
|
+
# @option options [String] :slug The URL slug of the desired startup.
|
20
|
+
# @option options [String] :domain The domain of the desired startup. Subdomains are not allowed. Keep in mind that startups can list any domain as their own. The startup with the most followers will be returned in the case of multiple hits.
|
21
|
+
# @example Search for a startup given a URL slug. Responds like GET /startups/:id.
|
22
|
+
# AngellistApi.startup_search
|
23
|
+
def startup_search(options={})
|
24
|
+
get("/startups/search", options, :format => :json, :phoenix => true)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module AngellistApi
|
2
|
+
class Client
|
3
|
+
# Defines methods related to URLs
|
4
|
+
module StatusUpdates
|
5
|
+
# Return status updates from the given user or startup. If neither is specified, the authenticated user is used. Status updates are paginated and ordered by most recent first.
|
6
|
+
# @requires_authentication Optional
|
7
|
+
# @response_format `json`
|
8
|
+
# @param options [Hash] A customizable set of options.
|
9
|
+
# @option options [Integer] :user_id id of the desired user.
|
10
|
+
# @option options [Integer] :startup_id id of the desired startup.
|
11
|
+
# @example Return status updates from the given user or startup. If neither is specified, the authenticated user is used. Status updates are paginated and ordered by most recent first.
|
12
|
+
# AngellistApi.get_status_updates
|
13
|
+
def get_status_updates(options={})
|
14
|
+
get("/status_updates", options, :format => :json, :phoenix => true)
|
15
|
+
end
|
16
|
+
|
17
|
+
# Creates a status update for the authenticated user or for a startup the authenticated user is a team member of. Returns the new status update on success, or an error on failure.
|
18
|
+
# @requires_authentication Yes
|
19
|
+
# @response_format `json`
|
20
|
+
# @param options [Hash] A customizable set of options.
|
21
|
+
# @option options [String] :message The new status. Must be between 1 and 140 characters.
|
22
|
+
# @option options [Integer] :startup_id id of the startup whose status you want to update. If unspecified, the authenticated user's status is updated.
|
23
|
+
# @example Creates a status update for the authenticated user or for a startup the authenticated user is a team member of. Returns the new status update on success, or an error on failure.
|
24
|
+
# AngellistApi.post_status_updates
|
25
|
+
def post_status_updates(options={})
|
26
|
+
post("/status_updates", options, :format => :json, :phoenix => true)
|
27
|
+
end
|
28
|
+
|
29
|
+
# Destroys the specified status update belonging to the authenticated user or to a startup the authenticated user is a team member of. Returns the destroyed status update on success, or an error on failure.
|
30
|
+
# @requires_authentication Yes
|
31
|
+
# @response_format `json`
|
32
|
+
# @param id [Integer] id of the desired status message.
|
33
|
+
# @example Destroys the specified status update belonging to the authenticated user or to a startup the authenticated user is a team member of. Returns the destroyed status update on success, or an error on failure.
|
34
|
+
# AngellistApi.delete_status_updates
|
35
|
+
def delete_status_updates(id)
|
36
|
+
delete("/status_updates/#{id}", :format => :json, :phoenix => true)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module AngellistApi
|
2
|
+
class Client
|
3
|
+
# Defines methods related to URLs
|
4
|
+
module Tags
|
5
|
+
# Get information on a tag
|
6
|
+
# @requires_authentication No
|
7
|
+
# @response_format `json`
|
8
|
+
# @param id [Integer] id of the desired tag.
|
9
|
+
# @example Get information on a tag
|
10
|
+
# AngellistApi.get_tag
|
11
|
+
def get_tag(id)
|
12
|
+
get("/tags/#{id}", :format => :json, :phoenix => true)
|
13
|
+
end
|
14
|
+
|
15
|
+
# Returns children of the given tag. Market and location tags form a Directed Acyclic Graph. Results are paginated and ordered by id descending.
|
16
|
+
# @requires_authentication No
|
17
|
+
# @response_format `json`
|
18
|
+
# @param id [Integer] The id of the desired tag. Currently only works for tags of type MarketTag or LocationTag.
|
19
|
+
# @example Returns children of the given tag. Market and location tags form a Directed Acyclic Graph. Results are paginated and ordered by id descending.
|
20
|
+
# AngellistApi.get_tag_children
|
21
|
+
def get_tag_children(id)
|
22
|
+
get("/tags/#{id}/children", :format => :json, :phoenix => true)
|
23
|
+
end
|
24
|
+
|
25
|
+
# Returns parents of the given tag. For more details, see the documentation for GET /tags/:id/children.
|
26
|
+
# @requires_authentication No
|
27
|
+
# @response_format `json`
|
28
|
+
# @param id [Integer] The id of the desired tag. Currently only works for tags of type MarketTag or LocationTag.
|
29
|
+
# @example Returns parents of the given tag. For more details, see the documentation for GET /tags/:id/children.
|
30
|
+
# AngellistApi.get_tag_parents
|
31
|
+
def get_tag_parents(id)
|
32
|
+
get("/tags/#{id}/parents", :format => :json, :phoenix => true)
|
33
|
+
end
|
34
|
+
|
35
|
+
# Returns startups that are tagged with the given tag or a child of the given tag. Results are paginated and ordered according to the order parameter.
|
36
|
+
# @requires_authentication Optional
|
37
|
+
# @response_format `json`
|
38
|
+
# @param options [Hash] A customizable set of options.
|
39
|
+
# @option options [String] :order May be one of popularity, asc or desc. Startups will be ordered by number of followers, ascending id or descending id, respectively. Defaults to desc
|
40
|
+
# @example Returns Returns startups that are tagged with the given tag or a child of the given tag. Results are paginated and ordered according to the order parameter.
|
41
|
+
# AngellistApi.get_tag_startups
|
42
|
+
def get_tag_startups(options = {})
|
43
|
+
get("/tags/#{id}/startups", options, :format => :json, :phoenix => true)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module AngellistApi
|
2
|
+
class Client
|
3
|
+
# Defines methods related to URLs
|
4
|
+
module Users
|
5
|
+
# Get a user's information given an id.
|
6
|
+
# @requires_authentication No
|
7
|
+
# @response_format `json`
|
8
|
+
# @param id [Integer] :id id of the desired user.
|
9
|
+
# @example Get a user's information given an id.
|
10
|
+
# AngellistApi.get_user
|
11
|
+
def get_user(id)
|
12
|
+
get("/users/#{id}", :format => :json, :phoenix => true)
|
13
|
+
end
|
14
|
+
|
15
|
+
# Search for a user given a URL slug. Responds like GET /users/:id.
|
16
|
+
# @requires_authentication No
|
17
|
+
# @response_format `json`
|
18
|
+
# @param options [Hash] A customizable set of options.
|
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 desired user.
|
21
|
+
# @example Search for a user given a URL slug or md5 hash of an email address. Responds like GET /users/:id.
|
22
|
+
# AngellistApi.user_search
|
23
|
+
def user_search(options={})
|
24
|
+
get("/users/search", options, :format => :json, :phoenix => true)
|
25
|
+
end
|
26
|
+
|
27
|
+
# Get the current user's information. Responds like GET /users/:id.
|
28
|
+
# @requires_authentication Yes
|
29
|
+
# @response_format `json`
|
30
|
+
# @example Get the current user's information. Responds like GET /users/:id.
|
31
|
+
# AngellistApi.user_search
|
32
|
+
def me
|
33
|
+
get("/me", :format => :json, :phoenix => true)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|