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.
Files changed (94) hide show
  1. data/CHANGELOG.md +15 -0
  2. data/README.md +11 -6
  3. data/Rakefile +9 -0
  4. data/lib/angellist_api.rb +1 -3
  5. data/lib/angellist_api/api.rb +2 -4
  6. data/lib/angellist_api/authentication.rb +0 -1
  7. data/lib/angellist_api/client.rb +9 -1
  8. data/lib/angellist_api/client/activity_feeds.rb +29 -8
  9. data/lib/angellist_api/client/follows.rb +105 -63
  10. data/lib/angellist_api/client/jobs.rb +72 -0
  11. data/lib/angellist_api/client/reviews.rb +17 -6
  12. data/lib/angellist_api/client/search.rb +31 -0
  13. data/lib/angellist_api/client/startup_roles.rb +23 -8
  14. data/lib/angellist_api/client/startups.rb +49 -13
  15. data/lib/angellist_api/client/status_updates.rb +45 -24
  16. data/lib/angellist_api/client/tags.rb +52 -30
  17. data/lib/angellist_api/client/users.rb +39 -17
  18. data/lib/angellist_api/configuration.rb +24 -29
  19. data/lib/angellist_api/connection.rb +27 -29
  20. data/lib/angellist_api/core_ext/hash.rb +19 -0
  21. data/lib/angellist_api/error.rb +9 -32
  22. data/lib/angellist_api/error/bad_gateway.rb +7 -0
  23. data/lib/angellist_api/error/bad_request.rb +7 -0
  24. data/lib/angellist_api/error/enhance_your_calm.rb +13 -0
  25. data/lib/angellist_api/error/forbidden.rb +7 -0
  26. data/lib/angellist_api/error/internal_server_error.rb +7 -0
  27. data/lib/angellist_api/error/not_acceptable.rb +7 -0
  28. data/lib/angellist_api/error/not_found.rb +7 -0
  29. data/lib/angellist_api/error/service_unavailable.rb +7 -0
  30. data/lib/angellist_api/error/unauthorized.rb +7 -0
  31. data/lib/angellist_api/request.rb +11 -18
  32. data/lib/angellist_api/request/angellist_api_oauth.rb +16 -0
  33. data/lib/angellist_api/request/gateway.rb +18 -0
  34. data/lib/angellist_api/request/multipart_with_file.rb +36 -0
  35. data/lib/angellist_api/response/raise_client_error.rb +51 -0
  36. data/lib/angellist_api/response/raise_server_error.rb +27 -0
  37. data/lib/angellist_api/version.rb +1 -1
  38. data/spec/fixtures/cassettes/activity_feeds.yml +273 -0
  39. data/spec/fixtures/cassettes/follows.yml +1722 -0
  40. data/spec/fixtures/cassettes/jobs.yml +2052 -0
  41. data/spec/fixtures/cassettes/reviews.yml +93 -0
  42. data/spec/fixtures/cassettes/search.yml +169 -0
  43. data/spec/fixtures/cassettes/startup_roles.yml +1481 -0
  44. data/spec/fixtures/cassettes/startups.yml +532 -0
  45. data/spec/fixtures/cassettes/status_updates.yml +125 -0
  46. data/spec/fixtures/cassettes/tags.yml +762 -0
  47. data/spec/fixtures/cassettes/users.yml +275 -0
  48. data/spec/integration/activity_feeds_spec.rb +29 -0
  49. data/spec/integration/follows_spec.rb +60 -0
  50. data/spec/integration/jobs_spec.rb +36 -0
  51. data/spec/integration/reviews_spec.rb +15 -0
  52. data/spec/integration/search_spec.rb +27 -0
  53. data/spec/integration/startup_roles_spec.rb +25 -0
  54. data/spec/integration/startups_spec.rb +36 -0
  55. data/spec/integration/status_updates_spec.rb +18 -0
  56. data/spec/integration/tags_spec.rb +29 -0
  57. data/spec/integration/users_spec.rb +23 -0
  58. data/spec/spec_helper.rb +5 -2
  59. data/spec/support/vcr.rb +12 -0
  60. data/spec/{lib → unit/lib}/angellist_api/api_spec.rb +13 -15
  61. data/spec/unit/lib/angellist_api/authentication_spec.rb +49 -0
  62. data/spec/unit/lib/angellist_api/client/activity_feeds_spec.rb +22 -0
  63. data/spec/unit/lib/angellist_api/client/follows_spec.rb +82 -0
  64. data/spec/unit/lib/angellist_api/client/jobs_spec.rb +39 -0
  65. data/spec/unit/lib/angellist_api/client/reviews_spec.rb +14 -0
  66. data/spec/unit/lib/angellist_api/client/search_spec.rb +15 -0
  67. data/spec/unit/lib/angellist_api/client/startup_roles_spec.rb +14 -0
  68. data/spec/unit/lib/angellist_api/client/startups_spec.rb +40 -0
  69. data/spec/unit/lib/angellist_api/client/status_updates_spec.rb +30 -0
  70. data/spec/unit/lib/angellist_api/client/tags_spec.rb +39 -0
  71. data/spec/unit/lib/angellist_api/client/users_spec.rb +39 -0
  72. data/spec/{lib → unit/lib}/angellist_api/configuration_spec.rb +12 -11
  73. data/spec/unit/lib/angellist_api/error_spec.rb +124 -0
  74. data/spec/unit/lib/angellist_api/request_spec.rb +32 -0
  75. data/spec/unit/lib/angellist_api_spec.rb +42 -0
  76. metadata +128 -71
  77. data/lib/faraday/request/angellist_api_oauth.rb +0 -14
  78. data/lib/faraday/request/gateway.rb +0 -18
  79. data/lib/faraday/request/multipart_with_file.rb +0 -36
  80. data/lib/faraday/request/phoenix.rb +0 -18
  81. data/lib/faraday/response/raise_http_4xx.rb +0 -45
  82. data/lib/faraday/response/raise_http_5xx.rb +0 -24
  83. data/spec/lib/angellist_api/authentication_spec.rb +0 -53
  84. data/spec/lib/angellist_api/client/activity_feeds_spec.rb +0 -16
  85. data/spec/lib/angellist_api/client/follows_spec.rb +0 -74
  86. data/spec/lib/angellist_api/client/reviews_spec.rb +0 -16
  87. data/spec/lib/angellist_api/client/startup_roles_spec.rb +0 -16
  88. data/spec/lib/angellist_api/client/startups_spec.rb +0 -23
  89. data/spec/lib/angellist_api/client/status_updates_spec.rb +0 -32
  90. data/spec/lib/angellist_api/client/tags_spec.rb +0 -40
  91. data/spec/lib/angellist_api/client/users_spec.rb +0 -30
  92. data/spec/lib/angellist_api/error_spec.rb +0 -126
  93. data/spec/lib/angellist_api/request_spec.rb +0 -51
  94. data/spec/lib/angellist_api_spec.rb +0 -38
@@ -0,0 +1,275 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.angel.co/1/users/2850?format=json&phoenix=true
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - application/json
12
+ User-Agent:
13
+ - AngellistApi Ruby Gem 1.0.1
14
+ response:
15
+ status:
16
+ code: 200
17
+ message: !!null
18
+ headers:
19
+ server:
20
+ - nginx/1.0.6
21
+ date:
22
+ - Sat, 21 Apr 2012 22:29:44 GMT
23
+ content-type:
24
+ - application/json; charset=utf-8
25
+ transfer-encoding:
26
+ - chunked
27
+ connection:
28
+ - close
29
+ vary:
30
+ - Accept-Encoding, Accept-Encoding
31
+ status:
32
+ - '200'
33
+ x-powered-by:
34
+ - Phusion Passenger (mod_rails/mod_rack) 3.0.9
35
+ x-ratelimit-limit:
36
+ - '1000'
37
+ x-ratelimit-remaining:
38
+ - '987'
39
+ x-thanks:
40
+ - For using AngelList. Rock on.
41
+ x-runtime:
42
+ - '21'
43
+ etag:
44
+ - ! '"0c13384ccaf0ae7c9e1ff289e0070619"'
45
+ cache-control:
46
+ - private, max-age=0, must-revalidate
47
+ body:
48
+ encoding: ASCII-8BIT
49
+ string: ! '{"name":"500 Startups","id":2850,"bio":"Internet seed fund & startup
50
+ accelerator in Silicon Valley. Partners worked at PayPal, Google, AOL, Rackspace,
51
+ YouTube, Mint, Facebook fbFund, Founders Fund.","follower_count":5560,"angellist_url":"http://angel.co/500startups","image":"https://s3.amazonaws.com/photos.angel.co/users/2850-medium?1294804197","blog_url":"http://500.co/blog","online_bio_url":"http://500.co","twitter_url":"http://twitter.com/#!/500","facebook_url":"http://facebook.com/500startups","linkedin_url":"http://www.linkedin.com/company/500-startups","locations":[{"id":1701,"tag_type":"LocationTag","name":"mountain
52
+ view","display_name":"Mountain View","angellist_url":"http://angel.co/mountain-view-1"},{"id":8732,"tag_type":"LocationTag","name":"sao
53
+ paulo","display_name":"Sao Paulo","angellist_url":"http://angel.co/sao-paulo"}],"roles":[{"id":9305,"tag_type":"RoleTag","name":"seed
54
+ funds","display_name":"Seed Fund","angellist_url":"http://angel.co/seed-funds"},{"id":9306,"tag_type":"RoleTag","name":"vc","display_name":"VC","angellist_url":"http://angel.co/vc"}]}'
55
+ http_version: !!null
56
+ recorded_at: Sat, 21 Apr 2012 22:29:44 GMT
57
+ - request:
58
+ method: get
59
+ uri: https://api.angel.co/1/users/2850?format=json
60
+ body:
61
+ encoding: US-ASCII
62
+ string: ''
63
+ headers:
64
+ Accept:
65
+ - application/json
66
+ User-Agent:
67
+ - AngellistApi Ruby Gem 1.0.1
68
+ response:
69
+ status:
70
+ code: 200
71
+ message: !!null
72
+ headers:
73
+ server:
74
+ - nginx/1.0.6
75
+ date:
76
+ - Sat, 21 Apr 2012 23:16:43 GMT
77
+ content-type:
78
+ - application/json; charset=utf-8
79
+ transfer-encoding:
80
+ - chunked
81
+ connection:
82
+ - close
83
+ vary:
84
+ - Accept-Encoding, Accept-Encoding
85
+ status:
86
+ - '200'
87
+ x-powered-by:
88
+ - Phusion Passenger (mod_rails/mod_rack) 3.0.9
89
+ x-ratelimit-limit:
90
+ - '1000'
91
+ x-ratelimit-remaining:
92
+ - '953'
93
+ x-thanks:
94
+ - For using AngelList. Rock on.
95
+ x-runtime:
96
+ - '25'
97
+ etag:
98
+ - ! '"0c13384ccaf0ae7c9e1ff289e0070619"'
99
+ cache-control:
100
+ - private, max-age=0, must-revalidate
101
+ body:
102
+ encoding: ASCII-8BIT
103
+ string: ! '{"name":"500 Startups","id":2850,"bio":"Internet seed fund & startup
104
+ accelerator in Silicon Valley. Partners worked at PayPal, Google, AOL, Rackspace,
105
+ YouTube, Mint, Facebook fbFund, Founders Fund.","follower_count":5560,"angellist_url":"http://angel.co/500startups","image":"https://s3.amazonaws.com/photos.angel.co/users/2850-medium?1294804197","blog_url":"http://500.co/blog","online_bio_url":"http://500.co","twitter_url":"http://twitter.com/#!/500","facebook_url":"http://facebook.com/500startups","linkedin_url":"http://www.linkedin.com/company/500-startups","locations":[{"id":1701,"tag_type":"LocationTag","name":"mountain
106
+ view","display_name":"Mountain View","angellist_url":"http://angel.co/mountain-view-1"},{"id":8732,"tag_type":"LocationTag","name":"sao
107
+ paulo","display_name":"Sao Paulo","angellist_url":"http://angel.co/sao-paulo"}],"roles":[{"id":9305,"tag_type":"RoleTag","name":"seed
108
+ funds","display_name":"Seed Fund","angellist_url":"http://angel.co/seed-funds"},{"id":9306,"tag_type":"RoleTag","name":"vc","display_name":"VC","angellist_url":"http://angel.co/vc"}]}'
109
+ http_version: !!null
110
+ recorded_at: Sat, 21 Apr 2012 23:16:43 GMT
111
+ - request:
112
+ method: get
113
+ uri: https://api.angel.co/1/users/2850
114
+ body:
115
+ encoding: US-ASCII
116
+ string: ''
117
+ headers:
118
+ Accept:
119
+ - application/json
120
+ User-Agent:
121
+ - AngellistApi Ruby Gem 1.0.1
122
+ response:
123
+ status:
124
+ code: 200
125
+ message: !!null
126
+ headers:
127
+ server:
128
+ - nginx/1.0.6
129
+ date:
130
+ - Sun, 22 Apr 2012 00:35:28 GMT
131
+ content-type:
132
+ - application/json; charset=utf-8
133
+ transfer-encoding:
134
+ - chunked
135
+ connection:
136
+ - close
137
+ vary:
138
+ - Accept-Encoding, Accept-Encoding
139
+ status:
140
+ - '200'
141
+ x-powered-by:
142
+ - Phusion Passenger (mod_rails/mod_rack) 3.0.9
143
+ x-ratelimit-limit:
144
+ - '1000'
145
+ x-ratelimit-remaining:
146
+ - '968'
147
+ x-thanks:
148
+ - For using AngelList. Rock on.
149
+ x-runtime:
150
+ - '19'
151
+ etag:
152
+ - ! '"b5d91f38826f5fc779a09c530bea1f02"'
153
+ cache-control:
154
+ - private, max-age=0, must-revalidate
155
+ body:
156
+ encoding: ASCII-8BIT
157
+ string: ! '{"name":"500 Startups","id":2850,"bio":"Internet seed fund & startup
158
+ accelerator in Silicon Valley. Partners worked at PayPal, Google, AOL, Rackspace,
159
+ YouTube, Mint, Facebook fbFund, Founders Fund.","follower_count":5561,"angellist_url":"http://angel.co/500startups","image":"https://s3.amazonaws.com/photos.angel.co/users/2850-medium?1294804197","blog_url":"http://500.co/blog","online_bio_url":"http://500.co","twitter_url":"http://twitter.com/#!/500","facebook_url":"http://facebook.com/500startups","linkedin_url":"http://www.linkedin.com/company/500-startups","locations":[{"id":1701,"tag_type":"LocationTag","name":"mountain
160
+ view","display_name":"Mountain View","angellist_url":"http://angel.co/mountain-view-1"},{"id":8732,"tag_type":"LocationTag","name":"sao
161
+ paulo","display_name":"Sao Paulo","angellist_url":"http://angel.co/sao-paulo"}],"roles":[{"id":9305,"tag_type":"RoleTag","name":"seed
162
+ funds","display_name":"Seed Fund","angellist_url":"http://angel.co/seed-funds"},{"id":9306,"tag_type":"RoleTag","name":"vc","display_name":"VC","angellist_url":"http://angel.co/vc"}]}'
163
+ http_version: !!null
164
+ recorded_at: Sun, 22 Apr 2012 00:35:28 GMT
165
+ - request:
166
+ method: get
167
+ uri: https://api.angel.co/1/users/search?slug=500startups
168
+ body:
169
+ encoding: US-ASCII
170
+ string: ''
171
+ headers:
172
+ Accept:
173
+ - application/json
174
+ User-Agent:
175
+ - AngellistApi Ruby Gem 1.0.1
176
+ response:
177
+ status:
178
+ code: 200
179
+ message: !!null
180
+ headers:
181
+ server:
182
+ - nginx/1.0.6
183
+ date:
184
+ - Sun, 22 Apr 2012 00:35:29 GMT
185
+ content-type:
186
+ - application/json; charset=utf-8
187
+ transfer-encoding:
188
+ - chunked
189
+ connection:
190
+ - close
191
+ vary:
192
+ - Accept-Encoding, Accept-Encoding
193
+ status:
194
+ - '200'
195
+ x-powered-by:
196
+ - Phusion Passenger (mod_rails/mod_rack) 3.0.9
197
+ x-ratelimit-limit:
198
+ - '1000'
199
+ x-ratelimit-remaining:
200
+ - '967'
201
+ x-thanks:
202
+ - For using AngelList. Rock on.
203
+ x-runtime:
204
+ - '23'
205
+ etag:
206
+ - ! '"b5d91f38826f5fc779a09c530bea1f02"'
207
+ cache-control:
208
+ - private, max-age=0, must-revalidate
209
+ body:
210
+ encoding: ASCII-8BIT
211
+ string: ! '{"name":"500 Startups","id":2850,"bio":"Internet seed fund & startup
212
+ accelerator in Silicon Valley. Partners worked at PayPal, Google, AOL, Rackspace,
213
+ YouTube, Mint, Facebook fbFund, Founders Fund.","follower_count":5561,"angellist_url":"http://angel.co/500startups","image":"https://s3.amazonaws.com/photos.angel.co/users/2850-medium?1294804197","blog_url":"http://500.co/blog","online_bio_url":"http://500.co","twitter_url":"http://twitter.com/#!/500","facebook_url":"http://facebook.com/500startups","linkedin_url":"http://www.linkedin.com/company/500-startups","locations":[{"id":1701,"tag_type":"LocationTag","name":"mountain
214
+ view","display_name":"Mountain View","angellist_url":"http://angel.co/mountain-view-1"},{"id":8732,"tag_type":"LocationTag","name":"sao
215
+ paulo","display_name":"Sao Paulo","angellist_url":"http://angel.co/sao-paulo"}],"roles":[{"id":9305,"tag_type":"RoleTag","name":"seed
216
+ funds","display_name":"Seed Fund","angellist_url":"http://angel.co/seed-funds"},{"id":9306,"tag_type":"RoleTag","name":"vc","display_name":"VC","angellist_url":"http://angel.co/vc"}]}'
217
+ http_version: !!null
218
+ recorded_at: Sun, 22 Apr 2012 00:35:30 GMT
219
+ - request:
220
+ method: get
221
+ uri: https://api.angel.co/1/users/batch?ids=15821%2C100303
222
+ body:
223
+ encoding: US-ASCII
224
+ string: ''
225
+ headers:
226
+ Accept:
227
+ - application/json
228
+ User-Agent:
229
+ - AngellistApi Ruby Gem 1.0.1
230
+ response:
231
+ status:
232
+ code: 200
233
+ message: !!null
234
+ headers:
235
+ server:
236
+ - nginx/1.0.6
237
+ date:
238
+ - Sun, 22 Apr 2012 04:01:49 GMT
239
+ content-type:
240
+ - application/json; charset=utf-8
241
+ transfer-encoding:
242
+ - chunked
243
+ connection:
244
+ - close
245
+ vary:
246
+ - Accept-Encoding, Accept-Encoding
247
+ status:
248
+ - '200'
249
+ x-powered-by:
250
+ - Phusion Passenger (mod_rails/mod_rack) 3.0.9
251
+ x-ratelimit-limit:
252
+ - '1000'
253
+ x-ratelimit-remaining:
254
+ - '999'
255
+ x-thanks:
256
+ - For using AngelList. Rock on.
257
+ x-runtime:
258
+ - '113'
259
+ etag:
260
+ - ! '"c7acb0532fee68206b1e469e5718f06f"'
261
+ cache-control:
262
+ - private, max-age=0, must-revalidate
263
+ body:
264
+ encoding: ASCII-8BIT
265
+ string: ! '[{"name":"Tim Chae","id":15821,"bio":"CEO of PostRocket. Two profitable
266
+ startups before age of 18. UI/UX, BD & Hustler. Babson College Tech Entrepreneurship
267
+ and Design UG.","follower_count":308,"angellist_url":"http://angel.co/tchae","image":"https://s3.amazonaws.com/photos.angel.co/users/15821-medium?1327034404","blog_url":"http://www.timchae.com","online_bio_url":"http://www.timchae.com","twitter_url":"http://twitter.com/#!/tchae","facebook_url":"","linkedin_url":"http://www.linkedin.com/in/timchae","locations":[{"id":1620,"tag_type":"LocationTag","name":"boston","display_name":"Boston","angellist_url":"http://angel.co/boston"},{"id":1681,"tag_type":"LocationTag","name":"silicon
268
+ valley","display_name":"Silicon Valley","angellist_url":"http://angel.co/silicon-valley"},{"id":1692,"tag_type":"LocationTag","name":"san
269
+ francisco","display_name":"San Francisco","angellist_url":"http://angel.co/san-francisco"}],"roles":[{"id":14725,"tag_type":"RoleTag","name":"entrepreneur","display_name":"Entrepreneur","angellist_url":"http://angel.co/entrepreneur-1"}]},{"name":"Prathan
270
+ Thananart","id":100303,"bio":"Web developer. I believe computer and the Internet
271
+ hold key solutions to many of our present day problems, from traffic to grassroots
272
+ democracy.","follower_count":7,"angellist_url":"http://angel.co/scomma","image":"https://s3.amazonaws.com/photos.angel.co/users/100303-medium?1330411698","blog_url":null,"online_bio_url":"http://la.byr.in.th","twitter_url":"http://twitter.com/#!/scomma","facebook_url":null,"linkedin_url":null,"locations":[],"roles":[]}]'
273
+ http_version: !!null
274
+ recorded_at: Sun, 22 Apr 2012 04:01:49 GMT
275
+ recorded_with: VCR 2.1.0
@@ -0,0 +1,29 @@
1
+ require 'spec_helper'
2
+
3
+ describe AngellistApi::Client::ActivityFeeds do
4
+ use_vcr_cassette 'activity_feeds'
5
+
6
+ let(:client) { AngellistApi::Client.new }
7
+ let(:valid_types) do
8
+ %w[Comment Follow Review StartupIntro StartupPublish StartupRole StatusUpdate Update].freeze
9
+ end
10
+
11
+ it 'fetches Activity Feed entries' do
12
+ client.get_feed.should be_an_instance_of Hashie::Mash
13
+ end
14
+
15
+ it 'wraps API item types' do
16
+ feed = client.get_feed[:feed]
17
+ feed.each do |activity|
18
+ valid_types.should include activity.item.type
19
+ end
20
+ end
21
+
22
+ it 'gets a single Activity Feed entry' do
23
+ activity = client.feed_item('8fCC3')
24
+ activity.should have_key :item
25
+ activity.should have_key :actor
26
+ activity.should have_key :target
27
+ end
28
+ end
29
+
@@ -0,0 +1,60 @@
1
+ require 'spec_helper'
2
+
3
+ describe AngellistApi::Client::Follows do
4
+ use_vcr_cassette 'follows'
5
+
6
+ let(:client) { AngellistApi::Client.new }
7
+
8
+ it 'gets follows in batch' do
9
+ follows = client.get_follows([4067161, 4067147])
10
+ follows.last.follower.angellist_url.should eq 'http://angel.co/danielle-morrill'
11
+ follows.last.followed.angellist_url.should eq 'http://angel.co/newco'
12
+ end
13
+
14
+ it "gets a user's followers" do
15
+ followers = client.get_user_followers(2850)
16
+ followers.users.should be_an_instance_of Array
17
+ followers.users.first.should be_an_instance_of Hashie::Mash
18
+ end
19
+
20
+ it "gets IDs of a user's followers" do
21
+ followers = client.get_user_follower_ids(2850)
22
+ followers.ids.should be_an_instance_of Array
23
+ followers.ids.first.should be_an_instance_of Fixnum
24
+ end
25
+
26
+ it 'gets users a user is following' do
27
+ following = client.get_user_following(2850)
28
+ following.users.first.should have_key :bio
29
+ end
30
+
31
+ it 'gets startups a user is following' do
32
+ following = client.get_user_following(2850, :type => :startup)
33
+ following.startups.first.should have_key :product_desc
34
+ end
35
+
36
+ it 'gets IDs of users a user is following' do
37
+ followers = client.get_user_following_ids(2850)
38
+ followers.ids.should be_an_instance_of Array
39
+ followers.ids.first.should be_an_instance_of Fixnum
40
+ end
41
+
42
+ it 'gets IDs of startups a user is following' do
43
+ followers = client.get_user_following_ids(2850, :type => :startup)
44
+ followers.ids.should be_an_instance_of Array
45
+ followers.ids.first.should be_an_instance_of Fixnum
46
+ end
47
+
48
+ it "gets a startup's followers" do
49
+ followers = client.get_startup_followers(1124) # 500-startups-fund
50
+ followers.users.should be_an_instance_of Array
51
+ followers.users.first.should be_an_instance_of Hashie::Mash
52
+ end
53
+
54
+ it "gets a startup's follower IDs" do
55
+ followers = client.get_startup_follower_ids(1124)
56
+ followers.ids.should be_an_instance_of Array
57
+ followers.ids.first.should be_an_instance_of Fixnum
58
+ end
59
+ end
60
+
@@ -0,0 +1,36 @@
1
+ require 'spec_helper'
2
+
3
+ describe AngellistApi::Client::Startups do
4
+ use_vcr_cassette 'jobs'
5
+
6
+ let(:client) { AngellistApi::Client.new }
7
+
8
+ it 'gets a listing of jobs' do
9
+ jobs = client.get_jobs
10
+ jobs.first.should have_key :job_type
11
+ jobs.first.should have_key :startup
12
+ end
13
+
14
+ it 'gets information about a job' do
15
+ job = client.get_job(2450)
16
+ job.title.should eq 'Software Engineer'
17
+ job.startup.name.should eq 'Kloudless'
18
+ end
19
+
20
+ it 'gets jobs for a given startup' do
21
+ jobs = client.get_startup_jobs(1124)
22
+ jobs.each { |job| job.startup.id.should eq 1124 }
23
+ end
24
+
25
+ it 'gets jobs for a given LocationTag' do
26
+ # This returns a job where the only LocationTag is Las Vegas. I've
27
+ # contacted AngelList to inquire if this is an API bug, doc fault, or?
28
+ pending 'API bug?'
29
+
30
+ sf = client.get_tag_jobs(1692)
31
+ sf.jobs.each do |job|
32
+ job.tags.select { |tag| tag.id == 1692 }.should_not be_empty
33
+ end
34
+ end
35
+ end
36
+
@@ -0,0 +1,15 @@
1
+ require 'spec_helper'
2
+
3
+ describe AngellistApi::Client::Reviews do
4
+ use_vcr_cassette 'reviews'
5
+
6
+ let(:client) { AngellistApi::Client.new }
7
+
8
+ it 'gets reviews of a user' do
9
+ reviews = client.get_reviews(:user_id => 2850)
10
+ reviews.should have_key :total_positive
11
+ reviews.reviews.should be_an_instance_of Array
12
+ reviews.reviews.first.should have_key :rating
13
+ end
14
+ end
15
+
@@ -0,0 +1,27 @@
1
+ require 'spec_helper'
2
+
3
+ describe AngellistApi::Client::Search do
4
+ use_vcr_cassette 'search'
5
+
6
+ let(:client) { AngellistApi::Client.new }
7
+ let(:valid_types) { %w[User Startup MarketTag LocationTag].freeze }
8
+
9
+ it 'searches with a general query' do
10
+ results = client.search('machine learning')
11
+ results.should be_an Array
12
+ end
13
+
14
+ it 'wraps API item types' do
15
+ results = client.search('machine learning')
16
+ results.each do |result|
17
+ valid_types.should include result.type
18
+ end
19
+ end
20
+
21
+ it 'searches with a scoped query' do
22
+ results = client.search('joshua', :type => 'User')
23
+ results.each { |res| res.type.should eq 'User' }
24
+ results.map { |res| res.name }.should include 'Joshua Slayton'
25
+ end
26
+ end
27
+