angellist_api 1.0.2 → 1.0.3

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.
@@ -1,5 +1,12 @@
1
1
  ## Master
2
2
 
3
+ ## 1.0.3 - 10 March, 2013
4
+
5
+ - Added press endpoint ([Evan Tann])
6
+ - Added messages endpoint ([Paul Singh])
7
+ - Added paths endpoint ([Ches Martin])
8
+ - Established integration test setup for authenticated endpoints.
9
+
3
10
  ## 1.0.2 - 30 July, 2012
4
11
 
5
12
  - Loosen dependency requirements for faraday and multi_json, so we don't
@@ -23,5 +30,9 @@
23
30
  omniauth-angellist.
24
31
 
25
32
 
33
+ [Paul Singh]: https://github.com/paulsingh
34
+ [Ches Martin]: https://github.com/ches
35
+ [Evan Tann]: https://github.com/egtann
36
+
26
37
  <!-- vim: set tw=80 :-->
27
38
 
data/README.md CHANGED
@@ -1,22 +1,72 @@
1
- # The AngelList API Ruby Gem
1
+ The AngelList API Ruby Gem
2
+ ==========================
2
3
 
3
- A Ruby wrapper for the [AngelList REST APIs][]. See the [YARD documentation][].
4
+ A Ruby wrapper for the [AngelList REST APIs]. See the [YARD documentation] for
5
+ usage details.
4
6
 
5
- ## Installation
7
+ Installation
8
+ ------------
6
9
 
7
10
  gem install angellist_api
8
11
 
9
- ## Submitting a Pull Request
12
+ Configuration
13
+ -------------
14
+
15
+ Some API endpoints require authentication. [Register your app] with
16
+ AngelList to receive a [bearer token] and configure it as follows:
17
+
18
+ ```ruby
19
+ AngellistApi.configure do |config|
20
+ config.access_token = '<your token here>'
21
+ end
22
+ ```
23
+
24
+ As bearer tokens are used, this library makes all requests over SSL. AngelList
25
+ does permit unauthenticated requests over plain HTTP, but we make no
26
+ distinction in this regard.
27
+
28
+ [Register your app]: https://angel.co/api/oauth/clients
29
+ [bearer token]: http://self-issued.info/docs/draft-ietf-oauth-v2-bearer.html
30
+
31
+ Developing
32
+ ----------
33
+
34
+ Run `bundle` to install development dependencies, then run all specs with
35
+ `rake`. See `rake -T` for other possibilities.
36
+
37
+ ### Integration Tests for Authenticated Endpoints
38
+
39
+ Integration tests should run against the [VCR] cassettes included in the
40
+ repository out of the box. However, if you need to add new specs or change
41
+ existing ones, you'll need to use your own private OAuth token. To do so, you
42
+ can set an `ANGELLIST_ACCESS_TOKEN` environment variable, or set this variable
43
+ through a [Foreman]-style `.env` file in the project directory. VCR's
44
+ sensitive data filtering feature is used to prevent recording your private
45
+ token.
46
+
47
+ This means, though, that endpoints returning data specific to the
48
+ authenticated user, such as messages or the `/me` endpoint, will require
49
+ fixtures to be manually edited and maintained so that tests do not rely on
50
+ real private information stored in the repository. The suggested workflow is
51
+ to simply record a request once, then edit the body of the response in the
52
+ cassette file, and set `:record => :none` for the spec(s) to prevent
53
+ accidental overwrites when fixtures are updated *en masse* in the future.
54
+
55
+ [VCR]: https://github.com/vcr/vcr
56
+ [Foreman]: https://github.com/ddollar/foreman
57
+
58
+ Submitting a Pull Request
59
+ -------------------------
10
60
 
11
61
  1. Fork the project.
12
62
  2. Create a topic branch.
13
63
  3. Implement your feature or bug fix.
14
64
  4. Add documentation for your feature or bug fix.
15
- 5. Run <tt>bundle exec rake doc:yard</tt>. If your changes are not 100%
16
- documented, go back to step 4.
65
+ 5. Run `bundle exec rake doc:yard`. If your changes are not 100% documented,
66
+ go back to step 4.
17
67
  6. Add specs for your feature or bug fix.
18
- 7. Run <tt>bundle exec rake spec</tt>. If your changes are not 100% covered, go
19
- back to step 6.
68
+ 7. Run `bundle exec rake spec`. If your changes are not 100% covered, go back
69
+ to step 6.
20
70
  8. Commit and push your changes.
21
71
  9. Submit a pull request. Please do not include changes to the gemspec,
22
72
  version, or history file. (If you want to create your own version for some
data/Rakefile CHANGED
@@ -24,6 +24,6 @@ namespace :spec do
24
24
  end
25
25
 
26
26
  YARD::Rake::YardocTask.new do |t|
27
- t.files = ['lib/**/*.rb', 'README.md']
27
+ t.files = ['lib/**/*.rb']
28
28
  end
29
29
 
@@ -13,6 +13,9 @@ module AngellistApi
13
13
  require 'angellist_api/client/activity_feeds'
14
14
  require 'angellist_api/client/follows'
15
15
  require 'angellist_api/client/jobs'
16
+ require 'angellist_api/client/messages'
17
+ require 'angellist_api/client/paths'
18
+ require 'angellist_api/client/press'
16
19
  require 'angellist_api/client/reviews'
17
20
  require 'angellist_api/client/search'
18
21
  require 'angellist_api/client/startups'
@@ -26,6 +29,9 @@ module AngellistApi
26
29
  include AngellistApi::Client::ActivityFeeds
27
30
  include AngellistApi::Client::Follows
28
31
  include AngellistApi::Client::Jobs
32
+ include AngellistApi::Client::Messages
33
+ include AngellistApi::Client::Paths
34
+ include AngellistApi::Client::Press
29
35
  include AngellistApi::Client::Reviews
30
36
  include AngellistApi::Client::Search
31
37
  include AngellistApi::Client::Startups
@@ -35,3 +41,4 @@ module AngellistApi
35
41
  include AngellistApi::Client::Users
36
42
  end
37
43
  end
44
+
@@ -0,0 +1,45 @@
1
+ module AngellistApi
2
+ class Client
3
+ # Defines methods related to URLs
4
+ #
5
+ # @see http://angel.co/api/spec/messages
6
+ module Messages
7
+
8
+ # Returns threads that the authenticated user is involved in. A "thread"
9
+ # is a conversation between two users, where each message is tagged with
10
+ # the same thread_id. If the authenticated user has any unread messages
11
+ #in the thread, the viewed attribute will be false. Requires scope "message".
12
+ #
13
+ # @requires_authentication Yes
14
+ # @paginated Yes
15
+ #
16
+ # @param options [Hash] A customizable set of options.
17
+ # @option options [String] :view One of inbox, unread or sent. Defaults to inbox.
18
+ # The inbox view returns all threads in which the user has received at least
19
+ # one message. The unread view is a subset of the inbox view which only includes
20
+ # threads with an unread message. The sent view returns all threads in which the
21
+ # user has sent at least one message.
22
+ # @option options [Integer] :thread_id Returns the messages for the given thread
23
+ # that the authenticated user is involved in. The viewed attribute will be present
24
+ # for messages that were sent to the authenticated user. Messages are paginated
25
+ # and ordered by message timestamp descending. Requires scope "message".
26
+ def get_messages(options={})
27
+ get("1/messages", options)
28
+ end
29
+
30
+ # Creates a new message from the authenticated user to the other participant of the
31
+ # given thread. Returns the new message on success. Requires scope "message".
32
+ #
33
+ # @requires_authentication Yes
34
+ #
35
+ # @param options [Hash] A customizable set of options.
36
+ # @option options [Integer] :recipient_id The id of the user receiving the message
37
+ # @option options [Integer] :thread_id The id of the thread that you want the message
38
+ # to be attached to.
39
+ # @option options [String] :body The body of the message.
40
+ def post_messages(options={})
41
+ post("1/messages", options)
42
+ end
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,39 @@
1
+ module AngellistApi
2
+ class Client
3
+ # Defines methods related to path resources (social connections)
4
+ #
5
+ # @see http://angel.co/api/spec/paths
6
+ module Paths
7
+ # Show paths between you and given user/startup ids.
8
+ #
9
+ # Additional notes:
10
+ #
11
+ # - for each user/startup up to 10 different paths will show up
12
+ # - up to 20 ids per request are allowed
13
+ # - do not use user_ids and startup_ids at the same time
14
+ #
15
+ # @requires_authentication Yes
16
+ #
17
+ # @param options [Hash] A customizable set of options.
18
+ # @option options [Array<Integer>] :user_ids Show paths between you and
19
+ # these users
20
+ # @option options [Array<Integer>] :startup_ids Show paths between you
21
+ # and these startups
22
+ # @option options [string] :direction "following" or "followed"
23
+ #
24
+ # @todo This is a great case for a 2.0 version of our lib that has some
25
+ # real OOP abstraction -- the results of this as a dumb hash are pretty
26
+ # disgusting to work with.
27
+ def get_paths(options={})
28
+ user_ids = options.delete(:user_ids) { [] }
29
+ startup_ids = options.delete(:startup_ids) { [] }
30
+
31
+ options.merge!(:user_ids => user_ids.join(',')) if user_ids.any?
32
+ options.merge!(:startup_ids => startup_ids.join(',')) if startup_ids.any?
33
+
34
+ get('1/paths', options)
35
+ end
36
+ end
37
+ end
38
+ end
39
+
@@ -0,0 +1,25 @@
1
+ module AngellistApi
2
+ class Client
3
+ # Defines methods related to URLs
4
+ #
5
+ # @see http://angel.co/api/spec/press
6
+ module Press
7
+
8
+ # Return press for the given startup. Press is paginated and ordered by
9
+ # most recent first, according to the post date.
10
+ #
11
+ # @requires_authentication No
12
+ # @paginated Yes
13
+ #
14
+ # @param options [Hash] A customizable set of options.
15
+ # @option options [Integer] :startup_id Specifies the desired startup
16
+ # @option options [Integer] :page Specifies the page of results to
17
+ # retrieve.
18
+ # @option options [Integer] :per_page (50) The number of results to return
19
+ # for a page. Maximum of 50.
20
+ def get_press(options={})
21
+ get("1/press", options)
22
+ end
23
+ end
24
+ end
25
+ end
@@ -1,4 +1,4 @@
1
1
  module AngellistApi
2
- VERSION = '1.0.2'
2
+ VERSION = '1.0.3'
3
3
  end
4
4
 
@@ -0,0 +1,100 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.angel.co/1/messages
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - application/json
12
+ User-Agent:
13
+ - AngellistApi Ruby Gem 1.0.2
14
+ Authorization:
15
+ - Bearer <ANGELLIST_ACCESS_TOKEN>
16
+ response:
17
+ status:
18
+ code: 200
19
+ message:
20
+ headers:
21
+ cache-control:
22
+ - !binary |-
23
+ cHJpdmF0ZSwgbWF4LWFnZT0wLCBtdXN0LXJldmFsaWRhdGU=
24
+ content-type:
25
+ - !binary |-
26
+ YXBwbGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOA==
27
+ date:
28
+ - !binary |-
29
+ U3VuLCAxMCBNYXIgMjAxMyAxODowNzozMSBHTVQ=
30
+ etag:
31
+ - !binary |-
32
+ IjRjYTk5YmRiODgxNGM5MGI2N2I3NTc4NjI3ZTM1M2VmIg==
33
+ server:
34
+ - !binary |-
35
+ bmdpbng=
36
+ status:
37
+ - !binary |-
38
+ MjAwIE9L
39
+ vary:
40
+ - !binary |-
41
+ QWNjZXB0LUVuY29kaW5n
42
+ x-ratelimit-limit:
43
+ - !binary |-
44
+ MjAwMA==
45
+ x-ratelimit-remaining:
46
+ - !binary |-
47
+ MjAwMA==
48
+ x-runtime:
49
+ - !binary |-
50
+ NDI=
51
+ !binary "Y29udGVudC1sZW5ndGg=":
52
+ - !binary |-
53
+ ODQy
54
+ connection:
55
+ - !binary |-
56
+ Q2xvc2U=
57
+ body:
58
+ encoding: ASCII-8BIT
59
+ string: |-
60
+ {
61
+ "messages": [
62
+ {
63
+ "users": [
64
+ {
65
+ "name": "Ches Martin",
66
+ "id": 65956,
67
+ "bio": "typing one-line bios is one of my hobbies. I'm not very good at it, hence I don't do it professionally.",
68
+ "follower_count": 43,
69
+ "angellist_url": "https://angel.co/ches",
70
+ "image": "https://s3.amazonaws.com/photos.angel.co/users/65956-medium_jpg?1318831341"
71
+ }, {
72
+ "name": "Paul Singh",
73
+ "id": 1274,
74
+ "bio": "Partner at 500 Startups",
75
+ "follower_count": 5457,
76
+ "angellist_url": "https://angel.co/paulsingh",
77
+ "image": "https://s3.amazonaws.com/photos.angel.co/users/1274-medium_jpg?1359423366"
78
+ }
79
+ ],
80
+ "total": 1,
81
+ "viewed": true,
82
+ "thread_id": 1234,
83
+ "last_message": {
84
+ "id": 4321,
85
+ "body": "Paul, it will be glorious, I tell you.",
86
+ "recipient_id": 1274,
87
+ "sender_id": 65956,
88
+ "created_at": "2013-03-11T03:53:30Z",
89
+ "viewed": true
90
+ }
91
+ }
92
+ ],
93
+ "total": 1,
94
+ "per_page": 50,
95
+ "page": 1,
96
+ "last_page": 1
97
+ }
98
+ http_version:
99
+ recorded_at: Sun, 10 Mar 2013 18:07:32 GMT
100
+ recorded_with: VCR 2.4.0
@@ -0,0 +1,266 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.angel.co/1/paths?user_ids=1274
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - application/json
12
+ User-Agent:
13
+ - AngellistApi Ruby Gem 1.0.2
14
+ Authorization:
15
+ - Bearer <ANGELLIST_ACCESS_TOKEN>
16
+ response:
17
+ status:
18
+ code: 200
19
+ message:
20
+ headers:
21
+ cache-control:
22
+ - !binary |-
23
+ cHJpdmF0ZSwgbWF4LWFnZT0wLCBtdXN0LXJldmFsaWRhdGU=
24
+ content-type:
25
+ - !binary |-
26
+ YXBwbGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOA==
27
+ date:
28
+ - !binary |-
29
+ U3VuLCAxMCBNYXIgMjAxMyAyMTozMTowOCBHTVQ=
30
+ etag:
31
+ - !binary |-
32
+ ImM0ZGNhZWJmNWVhZjM3MmU1ZjJjNTNlOWQ5ZDY5ZGViIg==
33
+ server:
34
+ - !binary |-
35
+ bmdpbng=
36
+ status:
37
+ - !binary |-
38
+ MjAwIE9L
39
+ vary:
40
+ - !binary |-
41
+ QWNjZXB0LUVuY29kaW5n
42
+ x-ratelimit-limit:
43
+ - !binary |-
44
+ MjAwMA==
45
+ x-ratelimit-remaining:
46
+ - !binary |-
47
+ MjAwMA==
48
+ x-runtime:
49
+ - !binary |-
50
+ MTE3
51
+ transfer-encoding:
52
+ - !binary |-
53
+ Y2h1bmtlZA==
54
+ connection:
55
+ - !binary |-
56
+ Q2xvc2U=
57
+ body:
58
+ encoding: ASCII-8BIT
59
+ string: |-
60
+ {
61
+ "1274": [
62
+ [
63
+ {
64
+ "connector": {
65
+ "id": 65956,
66
+ "type": "User",
67
+ "name": "Ches Martin",
68
+ "image": "https://s3.amazonaws.com/photos.angel.co/users/65956-medium_jpg?1318831341",
69
+ "angellist_url": "https://angel.co/ches"
70
+ },
71
+ "connection": {
72
+ "type": "explicit",
73
+ "via": null,
74
+ "in": null,
75
+ "out": null
76
+ }
77
+ },
78
+ {
79
+ "connector": {
80
+ "id": 1274,
81
+ "type": "User",
82
+ "name": "Paul Singh",
83
+ "image": "https://s3.amazonaws.com/photos.angel.co/users/1274-medium_jpg?1359423366",
84
+ "angellist_url": "https://angel.co/paulsingh"
85
+ },
86
+ "connection": {
87
+ "type": null,
88
+ "via": null,
89
+ "in": null,
90
+ "out": null
91
+ }
92
+ }
93
+ ], [
94
+ {
95
+ "connector": {
96
+ "id": 65956,
97
+ "type": "User",
98
+ "name": "Ches Martin",
99
+ "image": "https://s3.amazonaws.com/photos.angel.co/users/65956-medium_jpg?1318831341",
100
+ "angellist_url": "https://angel.co/ches"
101
+ },
102
+ "connection": {
103
+ "type": "explicit",
104
+ "via": null,
105
+ "in": null,
106
+ "out": null
107
+ }
108
+ },
109
+ {
110
+ "connector": {
111
+ "id": 12431,
112
+ "type": "User",
113
+ "name": "Brenden Mulligan",
114
+ "image": "https://s3.amazonaws.com/photos.angel.co/users/12431-medium_jpg?1325658149",
115
+ "angellist_url": "https://angel.co/mulligan"
116
+ },
117
+ "connection": {
118
+ "type": "startup_role",
119
+ "via": {
120
+ "id": 15762,
121
+ "type": "Startup",
122
+ "name": "WillCall",
123
+ "image": "https://s3.amazonaws.com/photos.angel.co/startups/i/15762-eba2e37a308bc4faf3949312efe57a6a-thumb_jpg.jpg?buster=1331066434",
124
+ "angellist_url": "https://angel.co/willcall"
125
+ },
126
+ "in": "advisor",
127
+ "out": "past_investor"
128
+ }
129
+ },
130
+ {
131
+ "connector": {
132
+ "id": 1274,
133
+ "type": "User",
134
+ "name": "Paul Singh",
135
+ "image": "https://s3.amazonaws.com/photos.angel.co/users/1274-medium_jpg?1359423366",
136
+ "angellist_url": "https://angel.co/paulsingh"
137
+ },
138
+ "connection": {
139
+ "type": null,
140
+ "via": null,
141
+ "in": null,
142
+ "out": null
143
+ }
144
+ }
145
+ ]
146
+ ]
147
+ }
148
+ http_version:
149
+ recorded_at: Sun, 10 Mar 2013 21:31:08 GMT
150
+ - request:
151
+ method: get
152
+ uri: https://api.angel.co/1/paths?startup_ids=76155
153
+ body:
154
+ encoding: US-ASCII
155
+ string: ''
156
+ headers:
157
+ Accept:
158
+ - application/json
159
+ User-Agent:
160
+ - AngellistApi Ruby Gem 1.0.2
161
+ Authorization:
162
+ - Bearer <ANGELLIST_ACCESS_TOKEN>
163
+ response:
164
+ status:
165
+ code: 200
166
+ message:
167
+ headers:
168
+ cache-control:
169
+ - !binary |-
170
+ cHJpdmF0ZSwgbWF4LWFnZT0wLCBtdXN0LXJldmFsaWRhdGU=
171
+ content-type:
172
+ - !binary |-
173
+ YXBwbGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOA==
174
+ date:
175
+ - !binary |-
176
+ U3VuLCAxMCBNYXIgMjAxMyAyMzoxNTozNyBHTVQ=
177
+ etag:
178
+ - !binary |-
179
+ IjBkNTQ1NmViNjk2YmUxMjliZjliYjcwMzE3YWNkMWQ4Ig==
180
+ server:
181
+ - !binary |-
182
+ bmdpbng=
183
+ status:
184
+ - !binary |-
185
+ MjAwIE9L
186
+ vary:
187
+ - !binary |-
188
+ QWNjZXB0LUVuY29kaW5n
189
+ x-ratelimit-limit:
190
+ - !binary |-
191
+ MjAwMA==
192
+ x-ratelimit-remaining:
193
+ - !binary |-
194
+ MTk5OA==
195
+ x-runtime:
196
+ - !binary |-
197
+ MTM5
198
+ transfer-encoding:
199
+ - !binary |-
200
+ Y2h1bmtlZA==
201
+ connection:
202
+ - !binary |-
203
+ Q2xvc2U=
204
+ body:
205
+ encoding: ASCII-8BIT
206
+ string: |-
207
+ {
208
+ "76155": [
209
+ [
210
+ {
211
+ "connector": {
212
+ "id": 65956,
213
+ "type": "User",
214
+ "name": "Ches Martin",
215
+ "image": "https://s3.amazonaws.com/photos.angel.co/users/65956-medium_jpg?1318831341",
216
+ "angellist_url": "https://angel.co/ches"
217
+ },
218
+ "connection": {
219
+ "type": "explicit",
220
+ "via": null,
221
+ "in": null,
222
+ "out": null
223
+ }
224
+ },
225
+ {
226
+ "connector": {
227
+ "id": 6120,
228
+ "type": "User",
229
+ "name": "Ed Roman",
230
+ "image": "https://s3.amazonaws.com/photos.angel.co/users/6120-medium_jpg?1300500084",
231
+ "angellist_url": "https://angel.co/edro"
232
+ },
233
+ "connection": {
234
+ "type": "startup_role",
235
+ "via": {
236
+ "id": 76155,
237
+ "type": "Startup",
238
+ "name": "Precog",
239
+ "image": "https://s3.amazonaws.com/photos.angel.co/startups/i/76155-a20caa2b50a9be81f9afec7b9c018c59-thumb_jpg.jpg?buster=1331733354",
240
+ "angellist_url": "https://angel.co/precog"
241
+ },
242
+ "in": "referrer",
243
+ "out": "referrer"
244
+ }
245
+ },
246
+ {
247
+ "connector": {
248
+ "id": 76155,
249
+ "type": "Startup",
250
+ "name": "Precog",
251
+ "image": "https://s3.amazonaws.com/photos.angel.co/startups/i/76155-a20caa2b50a9be81f9afec7b9c018c59-thumb_jpg.jpg?buster=1331733354",
252
+ "angellist_url": "https://angel.co/precog"
253
+ },
254
+ "connection": {
255
+ "type": null,
256
+ "via": null,
257
+ "in": null,
258
+ "out": null
259
+ }
260
+ }
261
+ ]
262
+ ]
263
+ }
264
+ http_version:
265
+ recorded_at: Sun, 10 Mar 2013 23:15:38 GMT
266
+ recorded_with: VCR 2.4.0