angellist_api 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe AngellistApi::Client::StartupRoles do
|
4
|
+
let(:client) { AngellistApi::Client.new }
|
5
|
+
|
6
|
+
describe "#get_startup_roles" do
|
7
|
+
it "gets to 1/follows" do
|
8
|
+
options = { :some => "options" }
|
9
|
+
client.should_receive(:get).with("1/startup_roles", options).and_return("success")
|
10
|
+
client.get_startup_roles(options).should == "success"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe AngellistApi::Client::Startups do
|
4
|
+
let(:client) { AngellistApi::Client.new }
|
5
|
+
|
6
|
+
describe "#get_startup" do
|
7
|
+
it "gets 1/startups/<id>" do
|
8
|
+
id = "123"
|
9
|
+
client.should_receive(:get).with("1/startups/#{id}").and_return("success")
|
10
|
+
client.get_startup(id).should == "success"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
describe '#startup_comments' do
|
15
|
+
it 'gets 1/startups/<id>/comments' do
|
16
|
+
id = 123
|
17
|
+
client.should_receive(:get).with("1/startups/#{id}/comments").and_return('success')
|
18
|
+
client.startup_comments(id).should eq 'success'
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
describe '#get_startups' do
|
23
|
+
it 'gets 1/startups/batch' do
|
24
|
+
ids = [1, 2, 3]
|
25
|
+
client.should_receive(:get).
|
26
|
+
with('1/startups/batch', { :ids => ids.join(',') }).
|
27
|
+
and_return('success')
|
28
|
+
client.get_startups(ids).should == 'success'
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
describe "#startup_search" do
|
33
|
+
it "gets 1/startups/search" do
|
34
|
+
options = { :some => "options" }
|
35
|
+
client.should_receive(:get).with("1/startups/search", options).and_return("success")
|
36
|
+
client.startup_search(options).should == "success"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe AngellistApi::Client::StatusUpdates do
|
4
|
+
let(:client) { AngellistApi::Client.new }
|
5
|
+
|
6
|
+
describe "#get_status_updates" do
|
7
|
+
it "gets 1/status_updates" do
|
8
|
+
options = { :some => "options" }
|
9
|
+
client.should_receive(:get).with("1/status_updates", options).and_return("success")
|
10
|
+
client.get_status_updates(options).should == "success"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
describe "#post_status_updates" do
|
15
|
+
it "posts to 1/status_updates" do
|
16
|
+
options = { :some => "options" }
|
17
|
+
client.should_receive(:post).with("1/status_updates", options).and_return("success")
|
18
|
+
client.post_status_updates(options).should == "success"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
describe "#delete_status_updates" do
|
23
|
+
it "deletes 1/status_updates/<id>" do
|
24
|
+
id = "123"
|
25
|
+
client.should_receive(:delete).with("1/status_updates/#{id}").and_return("success")
|
26
|
+
client.delete_status_updates(id).should == "success"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe AngellistApi::Client::Tags do
|
4
|
+
let(:client) { AngellistApi::Client.new }
|
5
|
+
|
6
|
+
describe "#get_tag" do
|
7
|
+
it "gets 1/tags/<id>" do
|
8
|
+
id = "123"
|
9
|
+
client.should_receive(:get).with("1/tags/#{id}").and_return("success")
|
10
|
+
client.get_tag(id).should == "success"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
describe "#get_tag_children" do
|
15
|
+
it "gets 1/tags/<id>/children" do
|
16
|
+
id = "123"
|
17
|
+
client.should_receive(:get).with("1/tags/#{id}/children").and_return("success")
|
18
|
+
client.get_tag_children(id).should == "success"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
describe "#get_tag_parents" do
|
23
|
+
it "gets 1/tags/<id>/parents" do
|
24
|
+
id = "123"
|
25
|
+
client.should_receive(:get).with("1/tags/#{id}/parents").and_return("success")
|
26
|
+
client.get_tag_parents(id).should == "success"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
describe "#get_tag_startups" do
|
31
|
+
it "gets 1/tags/<id>/startups" do
|
32
|
+
id = "123"
|
33
|
+
options = { :some => "options" }
|
34
|
+
client.should_receive(:get).with("1/tags/#{id}/startups", options).and_return("success")
|
35
|
+
client.get_tag_startups(id, options).should == "success"
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe AngellistApi::Client::Users do
|
4
|
+
let(:client) { AngellistApi::Client.new }
|
5
|
+
|
6
|
+
describe "#get_user" do
|
7
|
+
it "gets 1/users/<id>" do
|
8
|
+
id = "123"
|
9
|
+
client.should_receive(:get).with("1/users/#{id}").and_return("success")
|
10
|
+
client.get_user(id).should == "success"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
describe '#get_users' do
|
15
|
+
it 'gets 1/users/batch?ids=<ids>' do
|
16
|
+
ids = [1, 2, 3]
|
17
|
+
client.should_receive(:get).
|
18
|
+
with('1/users/batch', { :ids => ids.join(',') }).
|
19
|
+
and_return('success')
|
20
|
+
client.get_users(ids).should == 'success'
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe "#user_search" do
|
25
|
+
it "gets 1/users/search" do
|
26
|
+
options = { :some => "options "}
|
27
|
+
client.should_receive(:get).with("1/users/search", options).and_return("success")
|
28
|
+
client.user_search(options).should == "success"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
describe "#me" do
|
33
|
+
it "gets 1/me" do
|
34
|
+
client.should_receive(:get).with("1/me").and_return("success")
|
35
|
+
client.me.should == "success"
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
@@ -3,17 +3,17 @@ require 'spec_helper'
|
|
3
3
|
describe AngellistApi::Configuration do
|
4
4
|
class ExtendedClass; extend AngellistApi::Configuration; end
|
5
5
|
class IncludedClass; include AngellistApi::Configuration; end
|
6
|
-
|
6
|
+
|
7
7
|
describe "#extended" do
|
8
|
-
it "
|
8
|
+
it "has all configuration variables set to the default values by default" do
|
9
9
|
AngellistApi::Configuration::VALID_OPTIONS_KEYS.each do |key|
|
10
10
|
ExtendedClass.send(key).should == AngellistApi::Configuration.const_get("DEFAULT_#{key.to_s.upcase}")
|
11
11
|
end
|
12
12
|
end
|
13
13
|
end
|
14
|
-
|
14
|
+
|
15
15
|
describe "#configure" do
|
16
|
-
it "
|
16
|
+
it "allows configuration variables to be set in a block" do
|
17
17
|
object = IncludedClass.new
|
18
18
|
object.configure do |o|
|
19
19
|
o.access_token = "my oauth token"
|
@@ -21,29 +21,30 @@ describe AngellistApi::Configuration do
|
|
21
21
|
object.access_token.should == "my oauth token"
|
22
22
|
end
|
23
23
|
end
|
24
|
-
|
24
|
+
|
25
25
|
describe "#options" do
|
26
|
-
it "
|
26
|
+
it "returns a hash of all configuration options" do
|
27
27
|
object = IncludedClass.new
|
28
28
|
config = { :access_token => "123-token" }
|
29
29
|
config.each { |k,v| object.send("#{k.to_s}=", v) }
|
30
30
|
config.each { |k,v| object.options[k].should == v }
|
31
31
|
end
|
32
32
|
end
|
33
|
-
|
33
|
+
|
34
34
|
describe "#reset" do
|
35
|
-
it "
|
35
|
+
it "sets all config variables to the defaults" do
|
36
36
|
object = IncludedClass.new
|
37
37
|
AngellistApi::Configuration::VALID_OPTIONS_KEYS.each_with_index do |key, i|
|
38
38
|
object.send("#{key}=", i)
|
39
39
|
object.send(key).should == i
|
40
40
|
end
|
41
|
-
|
41
|
+
|
42
42
|
object.reset
|
43
|
-
|
44
|
-
AngellistApi::Configuration::VALID_OPTIONS_KEYS.
|
43
|
+
|
44
|
+
AngellistApi::Configuration::VALID_OPTIONS_KEYS.each do |key|
|
45
45
|
object.send(key).should == AngellistApi::Configuration.const_get("DEFAULT_#{key.to_s.upcase}")
|
46
46
|
end
|
47
47
|
end
|
48
48
|
end
|
49
49
|
end
|
50
|
+
|
@@ -0,0 +1,124 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe AngellistApi::Error do
|
4
|
+
|
5
|
+
describe "#initialize" do
|
6
|
+
context "message parameter" do
|
7
|
+
it "does not raise an error if it is nil" do
|
8
|
+
expect { AngellistApi::Error.new(nil, :header => "data") }.to_not raise_error
|
9
|
+
end
|
10
|
+
|
11
|
+
it "builds an error with the given message" do
|
12
|
+
error = AngellistApi::Error.new("bad data", :header => 'data')
|
13
|
+
error.message.should == "bad data"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
context "http_headers parameter" do
|
18
|
+
it "raises an exception if no http headers are passed" do
|
19
|
+
expect { AngellistApi::Error.new("some message", nil) }.to raise_error(ArgumentError, "odd number of arguments for Hash")
|
20
|
+
end
|
21
|
+
|
22
|
+
it "raises an exception if the params cant be converted to a hash" do
|
23
|
+
expect { AngellistApi::Error.new("some message", "header") }.to raise_error(ArgumentError, "odd number of arguments for Hash")
|
24
|
+
end
|
25
|
+
|
26
|
+
it "is set with the params" do
|
27
|
+
error = AngellistApi::Error.new("some message", :some => "value")
|
28
|
+
error.http_headers.should == { :some => "value" }
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
describe "#ratelimit_reset" do
|
34
|
+
it "returns the time set as x-rate-limit-reset if it's set" do
|
35
|
+
time1 = Time.now.to_i
|
36
|
+
time2 = time1 + 3600
|
37
|
+
error = AngellistApi::Error.new("message", {'x-ratelimit-reset' => time1, 'X-RateLimit-Reset' => time2})
|
38
|
+
error.ratelimit_reset.should == Time.at(time1)
|
39
|
+
end
|
40
|
+
|
41
|
+
it "returns the time set as X-RateLimit-Reset if x-rate-limit-reset is empty" do
|
42
|
+
time = Time.now.to_i
|
43
|
+
error = AngellistApi::Error.new("message", {'x-ratelimit-reset' => nil, 'X-RateLimit-Reset' => time})
|
44
|
+
error.ratelimit_reset.should == Time.at(time)
|
45
|
+
end
|
46
|
+
|
47
|
+
it "returns 0 if both X-RateLimit-Reset or x-rate-limit-reset are not set" do
|
48
|
+
error = AngellistApi::Error.new("message", {})
|
49
|
+
error.ratelimit_reset.should == Time.at(0)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
describe "#ratelimit_limit" do
|
54
|
+
it "returns the number set as x-rate-limit-limit if it's set" do
|
55
|
+
error = AngellistApi::Error.new("message", {'x-ratelimit-limit' => 500, 'X-RateLimit-Limit' => 400})
|
56
|
+
error.ratelimit_limit.should == 500
|
57
|
+
end
|
58
|
+
|
59
|
+
it "returns the number set as X-RateLimit-Limit if x-rate-limit-limit is empty" do
|
60
|
+
error = AngellistApi::Error.new("message", {'x-ratelimit-limit' => nil, 'X-RateLimit-Limit' => 600})
|
61
|
+
error.ratelimit_limit.should == 600
|
62
|
+
end
|
63
|
+
|
64
|
+
it "returns 0 if both X-RateLimit-Limit or x-rate-limit-limit are not set" do
|
65
|
+
error = AngellistApi::Error.new("message", {})
|
66
|
+
error.ratelimit_limit.should == 0
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
describe "#ratelimit_remaining" do
|
71
|
+
it "returns the number set as x-rate-limit-remaining if it's set" do
|
72
|
+
error = AngellistApi::Error.new("message", {'x-ratelimit-remaining' => 22, 'X-RateLimit-Remaining' => 23})
|
73
|
+
error.ratelimit_remaining.should == 22
|
74
|
+
end
|
75
|
+
|
76
|
+
it "returns the number set as X-RateLimit-Remaining if x-rate-limit-remaining is empty" do
|
77
|
+
error = AngellistApi::Error.new("message", {'x-ratelimit-remaining' => nil, 'X-RateLimit-Remaining' => 32})
|
78
|
+
error.ratelimit_remaining.should == 32
|
79
|
+
end
|
80
|
+
|
81
|
+
it "returns 0 if both X-RateLimit-Remaining or x-rate-limit-remaining are not set" do
|
82
|
+
error = AngellistApi::Error.new("message", {})
|
83
|
+
error.ratelimit_remaining.should == 0
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
describe "#retry_after" do
|
88
|
+
context "a normal Error object" do
|
89
|
+
let(:error) { AngellistApi::Error.new("message", {}) }
|
90
|
+
|
91
|
+
it "give you the time in seconds when it is acceptable to make another call" do
|
92
|
+
Timecop.freeze(Time.now) do
|
93
|
+
error.should_receive(:ratelimit_reset) { Time.now + 3600 }
|
94
|
+
error.retry_after.should == 3600
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
it "return 0 if the ratelimit_reset time is in the past" do
|
99
|
+
Timecop.freeze(Time.now) do
|
100
|
+
error.should_receive(:ratelimit_reset) { Time.now - 3600 }
|
101
|
+
error.retry_after.should == 0
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
context "an EnhanceYourCalm Error object" do
|
107
|
+
it "return the number of seconds set as retry-after if it's set" do
|
108
|
+
error = AngellistApi::Error::EnhanceYourCalm.new("message", {'retry-after' => 12, 'Retry-After' => 13})
|
109
|
+
error.retry_after.should == 12
|
110
|
+
end
|
111
|
+
|
112
|
+
it "return the number set as Retry-After if retry-after is empty" do
|
113
|
+
error = AngellistApi::Error::EnhanceYourCalm.new("message", {'retry-after' => nil, 'Retry-After' => 16})
|
114
|
+
error.retry_after.should == 16
|
115
|
+
end
|
116
|
+
|
117
|
+
it "return 0 if both Retry-After or retry-after are not set" do
|
118
|
+
error = AngellistApi::Error::EnhanceYourCalm.new("message", {})
|
119
|
+
error.retry_after.should == 0
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe AngellistApi::Request do
|
4
|
+
class DummyRequest; include AngellistApi::Request; end
|
5
|
+
|
6
|
+
let(:dummy) { DummyRequest.new }
|
7
|
+
let(:sample_path) { "/index" }
|
8
|
+
let(:sample_params) { { :sample => "params" } }
|
9
|
+
let(:sample_options) { { :sample => "options" } }
|
10
|
+
|
11
|
+
describe "#get" do
|
12
|
+
it "calls request with the passed params" do
|
13
|
+
dummy.should_receive(:request).with(:get, sample_path, sample_params, sample_options).and_return("result")
|
14
|
+
dummy.get(sample_path, sample_params, sample_options).should == "result"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
describe "#post" do
|
19
|
+
it "calls request with the passed params" do
|
20
|
+
dummy.should_receive(:request).with(:post, sample_path, sample_params, sample_options).and_return("result")
|
21
|
+
dummy.post(sample_path, sample_params, sample_options).should == "result"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
describe "#delete" do
|
26
|
+
it "calls request with the passed params" do
|
27
|
+
dummy.should_receive(:request).with(:delete, sample_path, sample_params, sample_options).and_return("result")
|
28
|
+
dummy.delete(sample_path, sample_params, sample_options).should == "result"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe AngellistApi do
|
4
|
+
|
5
|
+
describe ".new" do
|
6
|
+
it "is an alias for AngellistApi::Client.new" do
|
7
|
+
options = { :some => "option" }
|
8
|
+
AngellistApi.new(options).class.name.should == "AngellistApi::Client"
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
describe ".method_missing" do
|
13
|
+
context "with a method known to AngellistApi::Client" do
|
14
|
+
it "passes the method call to AngellistApi::Client" do
|
15
|
+
expected_result = {:some => "result"}
|
16
|
+
AngellistApi::Client.any_instance.should_receive(:startup_search).
|
17
|
+
and_return(expected_result)
|
18
|
+
|
19
|
+
expect do
|
20
|
+
AngellistApi.startup_search(:slug => 'angellist').should == expected_result
|
21
|
+
end.to_not raise_error
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
context "with a method unknown to AngellistApi::Client" do
|
26
|
+
it "raises method not found error" do
|
27
|
+
expect { AngellistApi.some_unknown_method }.to raise_error(NoMethodError)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
describe ".respond_to?" do
|
33
|
+
it "returns true if AngellistApi::Client responds to the method" do
|
34
|
+
AngellistApi.respond_to?(:startup_search).should be_true
|
35
|
+
end
|
36
|
+
|
37
|
+
it "returns false if AngellistApi::Client does not respond to the method" do
|
38
|
+
AngellistApi.respond_to?(:some_unknown_method).should be_false
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: angellist_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-07-29 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: hashie
|
16
|
-
requirement: &
|
16
|
+
requirement: &2164428020 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,54 +21,43 @@ dependencies:
|
|
21
21
|
version: 1.1.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2164428020
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: faraday
|
27
|
-
requirement: &
|
27
|
+
requirement: &2164426660 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: 0.7
|
32
|
+
version: '0.7'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *2164426660
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: faraday_middleware
|
38
|
-
requirement: &
|
38
|
+
requirement: &2164425160 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
version: 0.7
|
43
|
+
version: '0.7'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *2164425160
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: multi_json
|
49
|
-
requirement: &
|
49
|
+
requirement: &2164423080 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 1.0
|
54
|
+
version: '1.0'
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
58
|
-
- !ruby/object:Gem::Dependency
|
59
|
-
name: mocha
|
60
|
-
requirement: &2156039420 !ruby/object:Gem::Requirement
|
61
|
-
none: false
|
62
|
-
requirements:
|
63
|
-
- - ~>
|
64
|
-
- !ruby/object:Gem::Version
|
65
|
-
version: 0.10.0
|
66
|
-
type: :development
|
67
|
-
prerelease: false
|
68
|
-
version_requirements: *2156039420
|
57
|
+
version_requirements: *2164423080
|
69
58
|
- !ruby/object:Gem::Dependency
|
70
59
|
name: rdiscount
|
71
|
-
requirement: &
|
60
|
+
requirement: &2164420720 !ruby/object:Gem::Requirement
|
72
61
|
none: false
|
73
62
|
requirements:
|
74
63
|
- - ~>
|
@@ -76,10 +65,10 @@ dependencies:
|
|
76
65
|
version: 1.6.8
|
77
66
|
type: :development
|
78
67
|
prerelease: false
|
79
|
-
version_requirements: *
|
68
|
+
version_requirements: *2164420720
|
80
69
|
- !ruby/object:Gem::Dependency
|
81
70
|
name: rspec
|
82
|
-
requirement: &
|
71
|
+
requirement: &2164418660 !ruby/object:Gem::Requirement
|
83
72
|
none: false
|
84
73
|
requirements:
|
85
74
|
- - ~>
|
@@ -87,21 +76,21 @@ dependencies:
|
|
87
76
|
version: 2.7.0
|
88
77
|
type: :development
|
89
78
|
prerelease: false
|
90
|
-
version_requirements: *
|
79
|
+
version_requirements: *2164418660
|
91
80
|
- !ruby/object:Gem::Dependency
|
92
81
|
name: simplecov
|
93
|
-
requirement: &
|
82
|
+
requirement: &2164416340 !ruby/object:Gem::Requirement
|
94
83
|
none: false
|
95
84
|
requirements:
|
96
85
|
- - ~>
|
97
86
|
- !ruby/object:Gem::Version
|
98
|
-
version: 0.
|
87
|
+
version: 0.6.4
|
99
88
|
type: :development
|
100
89
|
prerelease: false
|
101
|
-
version_requirements: *
|
90
|
+
version_requirements: *2164416340
|
102
91
|
- !ruby/object:Gem::Dependency
|
103
92
|
name: timecop
|
104
|
-
requirement: &
|
93
|
+
requirement: &2164407240 !ruby/object:Gem::Requirement
|
105
94
|
none: false
|
106
95
|
requirements:
|
107
96
|
- - ~>
|
@@ -109,10 +98,21 @@ dependencies:
|
|
109
98
|
version: 0.3.5
|
110
99
|
type: :development
|
111
100
|
prerelease: false
|
112
|
-
version_requirements: *
|
101
|
+
version_requirements: *2164407240
|
102
|
+
- !ruby/object:Gem::Dependency
|
103
|
+
name: vcr
|
104
|
+
requirement: &2164405080 !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ~>
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: 2.1.0
|
110
|
+
type: :development
|
111
|
+
prerelease: false
|
112
|
+
version_requirements: *2164405080
|
113
113
|
- !ruby/object:Gem::Dependency
|
114
114
|
name: yard
|
115
|
-
requirement: &
|
115
|
+
requirement: &2164402380 !ruby/object:Gem::Requirement
|
116
116
|
none: false
|
117
117
|
requirements:
|
118
118
|
- - ~>
|
@@ -120,7 +120,7 @@ dependencies:
|
|
120
120
|
version: 0.7.3
|
121
121
|
type: :development
|
122
122
|
prerelease: false
|
123
|
-
version_requirements: *
|
123
|
+
version_requirements: *2164402380
|
124
124
|
description: Ruby wrapper for the Angellist API. The AngelList API provides developers
|
125
125
|
with a RESTful interface to the AngelList data set. Some endpoints are public and
|
126
126
|
require no authentication.
|
@@ -134,7 +134,9 @@ files:
|
|
134
134
|
- lib/angellist_api/authentication.rb
|
135
135
|
- lib/angellist_api/client/activity_feeds.rb
|
136
136
|
- lib/angellist_api/client/follows.rb
|
137
|
+
- lib/angellist_api/client/jobs.rb
|
137
138
|
- lib/angellist_api/client/reviews.rb
|
139
|
+
- lib/angellist_api/client/search.rb
|
138
140
|
- lib/angellist_api/client/startup_roles.rb
|
139
141
|
- lib/angellist_api/client/startups.rb
|
140
142
|
- lib/angellist_api/client/status_updates.rb
|
@@ -143,35 +145,67 @@ files:
|
|
143
145
|
- lib/angellist_api/client.rb
|
144
146
|
- lib/angellist_api/configuration.rb
|
145
147
|
- lib/angellist_api/connection.rb
|
148
|
+
- lib/angellist_api/core_ext/hash.rb
|
149
|
+
- lib/angellist_api/error/bad_gateway.rb
|
150
|
+
- lib/angellist_api/error/bad_request.rb
|
151
|
+
- lib/angellist_api/error/enhance_your_calm.rb
|
152
|
+
- lib/angellist_api/error/forbidden.rb
|
153
|
+
- lib/angellist_api/error/internal_server_error.rb
|
154
|
+
- lib/angellist_api/error/not_acceptable.rb
|
155
|
+
- lib/angellist_api/error/not_found.rb
|
156
|
+
- lib/angellist_api/error/service_unavailable.rb
|
157
|
+
- lib/angellist_api/error/unauthorized.rb
|
146
158
|
- lib/angellist_api/error.rb
|
159
|
+
- lib/angellist_api/request/angellist_api_oauth.rb
|
160
|
+
- lib/angellist_api/request/gateway.rb
|
161
|
+
- lib/angellist_api/request/multipart_with_file.rb
|
147
162
|
- lib/angellist_api/request.rb
|
163
|
+
- lib/angellist_api/response/raise_client_error.rb
|
164
|
+
- lib/angellist_api/response/raise_server_error.rb
|
148
165
|
- lib/angellist_api/version.rb
|
149
166
|
- lib/angellist_api.rb
|
150
|
-
- lib/faraday/request/angellist_api_oauth.rb
|
151
|
-
- lib/faraday/request/gateway.rb
|
152
|
-
- lib/faraday/request/multipart_with_file.rb
|
153
|
-
- lib/faraday/request/phoenix.rb
|
154
|
-
- lib/faraday/response/raise_http_4xx.rb
|
155
|
-
- lib/faraday/response/raise_http_5xx.rb
|
156
167
|
- MIT-LICENSE
|
157
168
|
- Rakefile
|
158
169
|
- README.md
|
159
170
|
- CHANGELOG.md
|
160
|
-
- spec/
|
161
|
-
- spec/
|
162
|
-
- spec/
|
163
|
-
- spec/
|
164
|
-
- spec/
|
165
|
-
- spec/
|
166
|
-
- spec/
|
167
|
-
- spec/
|
168
|
-
- spec/
|
169
|
-
- spec/
|
170
|
-
- spec/
|
171
|
-
- spec/
|
172
|
-
- spec/
|
173
|
-
- spec/
|
171
|
+
- spec/fixtures/cassettes/activity_feeds.yml
|
172
|
+
- spec/fixtures/cassettes/follows.yml
|
173
|
+
- spec/fixtures/cassettes/jobs.yml
|
174
|
+
- spec/fixtures/cassettes/reviews.yml
|
175
|
+
- spec/fixtures/cassettes/search.yml
|
176
|
+
- spec/fixtures/cassettes/startup_roles.yml
|
177
|
+
- spec/fixtures/cassettes/startups.yml
|
178
|
+
- spec/fixtures/cassettes/status_updates.yml
|
179
|
+
- spec/fixtures/cassettes/tags.yml
|
180
|
+
- spec/fixtures/cassettes/users.yml
|
181
|
+
- spec/integration/activity_feeds_spec.rb
|
182
|
+
- spec/integration/follows_spec.rb
|
183
|
+
- spec/integration/jobs_spec.rb
|
184
|
+
- spec/integration/reviews_spec.rb
|
185
|
+
- spec/integration/search_spec.rb
|
186
|
+
- spec/integration/startup_roles_spec.rb
|
187
|
+
- spec/integration/startups_spec.rb
|
188
|
+
- spec/integration/status_updates_spec.rb
|
189
|
+
- spec/integration/tags_spec.rb
|
190
|
+
- spec/integration/users_spec.rb
|
174
191
|
- spec/spec_helper.rb
|
192
|
+
- spec/support/vcr.rb
|
193
|
+
- spec/unit/lib/angellist_api/api_spec.rb
|
194
|
+
- spec/unit/lib/angellist_api/authentication_spec.rb
|
195
|
+
- spec/unit/lib/angellist_api/client/activity_feeds_spec.rb
|
196
|
+
- spec/unit/lib/angellist_api/client/follows_spec.rb
|
197
|
+
- spec/unit/lib/angellist_api/client/jobs_spec.rb
|
198
|
+
- spec/unit/lib/angellist_api/client/reviews_spec.rb
|
199
|
+
- spec/unit/lib/angellist_api/client/search_spec.rb
|
200
|
+
- spec/unit/lib/angellist_api/client/startup_roles_spec.rb
|
201
|
+
- spec/unit/lib/angellist_api/client/startups_spec.rb
|
202
|
+
- spec/unit/lib/angellist_api/client/status_updates_spec.rb
|
203
|
+
- spec/unit/lib/angellist_api/client/tags_spec.rb
|
204
|
+
- spec/unit/lib/angellist_api/client/users_spec.rb
|
205
|
+
- spec/unit/lib/angellist_api/configuration_spec.rb
|
206
|
+
- spec/unit/lib/angellist_api/error_spec.rb
|
207
|
+
- spec/unit/lib/angellist_api/request_spec.rb
|
208
|
+
- spec/unit/lib/angellist_api_spec.rb
|
175
209
|
homepage: https://github.com/paulsingh/angellist-api
|
176
210
|
licenses: []
|
177
211
|
post_install_message:
|
@@ -186,7 +220,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
186
220
|
version: '0'
|
187
221
|
segments:
|
188
222
|
- 0
|
189
|
-
hash:
|
223
|
+
hash: 1323234531531222948
|
190
224
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
191
225
|
none: false
|
192
226
|
requirements:
|
@@ -195,7 +229,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
195
229
|
version: '0'
|
196
230
|
segments:
|
197
231
|
- 0
|
198
|
-
hash:
|
232
|
+
hash: 1323234531531222948
|
199
233
|
requirements: []
|
200
234
|
rubyforge_project:
|
201
235
|
rubygems_version: 1.8.10
|
@@ -203,19 +237,42 @@ signing_key:
|
|
203
237
|
specification_version: 3
|
204
238
|
summary: Ruby wrapper for the Angellist API.
|
205
239
|
test_files:
|
206
|
-
- spec/
|
207
|
-
- spec/
|
208
|
-
- spec/
|
209
|
-
- spec/
|
210
|
-
- spec/
|
211
|
-
- spec/
|
212
|
-
- spec/
|
213
|
-
- spec/
|
214
|
-
- spec/
|
215
|
-
- spec/
|
216
|
-
- spec/
|
217
|
-
- spec/
|
218
|
-
- spec/
|
219
|
-
- spec/
|
240
|
+
- spec/fixtures/cassettes/activity_feeds.yml
|
241
|
+
- spec/fixtures/cassettes/follows.yml
|
242
|
+
- spec/fixtures/cassettes/jobs.yml
|
243
|
+
- spec/fixtures/cassettes/reviews.yml
|
244
|
+
- spec/fixtures/cassettes/search.yml
|
245
|
+
- spec/fixtures/cassettes/startup_roles.yml
|
246
|
+
- spec/fixtures/cassettes/startups.yml
|
247
|
+
- spec/fixtures/cassettes/status_updates.yml
|
248
|
+
- spec/fixtures/cassettes/tags.yml
|
249
|
+
- spec/fixtures/cassettes/users.yml
|
250
|
+
- spec/integration/activity_feeds_spec.rb
|
251
|
+
- spec/integration/follows_spec.rb
|
252
|
+
- spec/integration/jobs_spec.rb
|
253
|
+
- spec/integration/reviews_spec.rb
|
254
|
+
- spec/integration/search_spec.rb
|
255
|
+
- spec/integration/startup_roles_spec.rb
|
256
|
+
- spec/integration/startups_spec.rb
|
257
|
+
- spec/integration/status_updates_spec.rb
|
258
|
+
- spec/integration/tags_spec.rb
|
259
|
+
- spec/integration/users_spec.rb
|
220
260
|
- spec/spec_helper.rb
|
261
|
+
- spec/support/vcr.rb
|
262
|
+
- spec/unit/lib/angellist_api/api_spec.rb
|
263
|
+
- spec/unit/lib/angellist_api/authentication_spec.rb
|
264
|
+
- spec/unit/lib/angellist_api/client/activity_feeds_spec.rb
|
265
|
+
- spec/unit/lib/angellist_api/client/follows_spec.rb
|
266
|
+
- spec/unit/lib/angellist_api/client/jobs_spec.rb
|
267
|
+
- spec/unit/lib/angellist_api/client/reviews_spec.rb
|
268
|
+
- spec/unit/lib/angellist_api/client/search_spec.rb
|
269
|
+
- spec/unit/lib/angellist_api/client/startup_roles_spec.rb
|
270
|
+
- spec/unit/lib/angellist_api/client/startups_spec.rb
|
271
|
+
- spec/unit/lib/angellist_api/client/status_updates_spec.rb
|
272
|
+
- spec/unit/lib/angellist_api/client/tags_spec.rb
|
273
|
+
- spec/unit/lib/angellist_api/client/users_spec.rb
|
274
|
+
- spec/unit/lib/angellist_api/configuration_spec.rb
|
275
|
+
- spec/unit/lib/angellist_api/error_spec.rb
|
276
|
+
- spec/unit/lib/angellist_api/request_spec.rb
|
277
|
+
- spec/unit/lib/angellist_api_spec.rb
|
221
278
|
has_rdoc:
|