hackerone-client 0.3.2 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 925620156caed0df9528705b34fba16cda8a2aed
4
- data.tar.gz: a111b75d5551716415a883138353a7e7ede18c8c
3
+ metadata.gz: 397902625adb3c35e0d7b8ae2eb923a13dab796f
4
+ data.tar.gz: 75c042deae0c3e2f74fa10ca73d8d87ad3702c13
5
5
  SHA512:
6
- metadata.gz: 30d2fd778a1a5042222095a975b00be38229d1e5ab69179b2ff1be1a14149606811be166a82467c344a51080b3c9a413eb7f30224d277feb7b882bbd74d1f0db
7
- data.tar.gz: 6bffdd06b1d495cde7199a8dd6c3fa639f5ebe92f0bbc7b92e591392d383852a18c59206fd535d793518996d7834cc160adfbd83c9f2576b13af3e5bb5d9ad9f
6
+ metadata.gz: 2cc5198f53f5015179910a497609eea387793b2b512c59e9f066ebd1364a08f2e4dfbd3c3fd6dc28e8faee6771e719c025207fdcfe5274acebfb431dcc77fed8
7
+ data.tar.gz: a3b92da769957275ff950ab42e72d0b11de1d15bfc3f8beeac91eb35b6ff3ee8056c98cadcd445865b9e3658f8972bce5b8a1480ca66a639c3912cad81359540
data/CHANGELOG.md ADDED
@@ -0,0 +1,4 @@
1
+ ## [0.4.0] - 2017-04-21
2
+ ### Added
3
+ - `client.reporters` to return all reporters for a given project (@esjee)
4
+ - `HackerOne::Client::Program.find(program_name)` to return information about a given program (@esjee)
data/README.md CHANGED
@@ -20,6 +20,9 @@ client.add_report_reference(id, reference)
20
20
 
21
21
  # Triage an issue (add a reference and set state to :triaged)
22
22
  client.triage(id, reference)
23
+
24
+ # GET `/{program}/reporters` returns a list of unique reporters that have reported to your program
25
+ client.reporters
23
26
  ```
24
27
 
25
28
  ## Usage
@@ -0,0 +1,71 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.hackerone.com/v1/me/programs
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Authorization:
11
+ - Basic nope
12
+ User-Agent:
13
+ - Faraday v0.12.0.1
14
+ Accept-Encoding:
15
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
16
+ Accept:
17
+ - "*/*"
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ Date:
24
+ - Sun, 09 Apr 2017 09:10:54 GMT
25
+ Content-Type:
26
+ - application/json; charset=utf-8
27
+ Transfer-Encoding:
28
+ - chunked
29
+ Connection:
30
+ - keep-alive
31
+ Set-Cookie:
32
+ - __cfduid=d5d9dea364499e21060bc94e1a78d63211491729053; expires=Mon, 09-Apr-18
33
+ 09:10:53 GMT; path=/; Domain=api.hackerone.com; HttpOnly
34
+ X-Request-Id:
35
+ - 4604197f-b50f-4813-a964-644a4c52ba35
36
+ Etag:
37
+ - W/"9329ef6b8f370e76d96d71977a6480c4"
38
+ Cache-Control:
39
+ - max-age=0, private, must-revalidate
40
+ Strict-Transport-Security:
41
+ - max-age=31536000; includeSubDomains; preload
42
+ Content-Security-Policy:
43
+ - default-src 'none'; connect-src 'self' www.google-analytics.com errors.hackerone.net;
44
+ font-src 'self'; img-src 'self' data:; script-src 'self'; style-src 'self'
45
+ 'unsafe-inline'; form-action 'self'; frame-ancestors 'none'; report-uri https://errors.hackerone.net/api/30/csp-report/?sentry_key=61c1e2f50d21487c97a071737701f598
46
+ X-Content-Type-Options:
47
+ - nosniff
48
+ X-Download-Options:
49
+ - noopen
50
+ X-Frame-Options:
51
+ - DENY
52
+ X-Permitted-Cross-Domain-Policies:
53
+ - none
54
+ X-Xss-Protection:
55
+ - 1; mode=block
56
+ Public-Key-Pins-Report-Only:
57
+ - pin-sha256="WoiWRyIOVNa9ihaBciRSC7XHjliYS9VwUGOIud4PB18="; pin-sha256="r/mIkG3eEpVdm+u/ko/cwxzOMo1bk4TyHIlByibiA5E=";
58
+ pin-sha256="K87oWBWM9UZfyddvDfoxL+8lpNyoUB2ptGtn0fv6G2Q="; pin-sha256="iie1VXtL7HzAMF+/PVPR9xzT80kQxdZeJ+zduCB3uj0=";
59
+ pin-sha256="cGuxAXyFXFkWm61cF4HPWX8S0srS9j0aSqN0k4AP+4A="; pin-sha256="bIlWcjiKq1mftH/xd7Hw1JO77Cr+Gv+XYcGUQWwO+A4=";
60
+ pin-sha256="tXD+dGAP8rGY4PW1be90cOYEwg7pZ4G+yPZmIZWPTSg="; max-age=600; includeSubDomains;
61
+ report-uri="https://hackerone.report-uri.io/r/default/hpkp/reportOnly"
62
+ Server:
63
+ - cloudflare-nginx
64
+ Cf-Ray:
65
+ - 34cc55fa4aa8731f-AMS
66
+ body:
67
+ encoding: ASCII-8BIT
68
+ string: '{"data":[{"id":"18969","type":"program","attributes":{"handle":"github","created_at":"2017-03-08T19:22:41.884Z","updated_at":"2017-04-09T08:15:15.228Z"}}],"links":{}}'
69
+ http_version:
70
+ recorded_at: Sun, 09 Apr 2017 09:10:40 GMT
71
+ recorded_with: VCR 3.0.3
@@ -0,0 +1,277 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.hackerone.com/v1/me/programs
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Authorization:
11
+ - Basic nope
12
+ User-Agent:
13
+ - Faraday v0.12.0.1
14
+ Accept-Encoding:
15
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
16
+ Accept:
17
+ - "*/*"
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ Date:
24
+ - Sun, 09 Apr 2017 08:59:07 GMT
25
+ Content-Type:
26
+ - application/json; charset=utf-8
27
+ Transfer-Encoding:
28
+ - chunked
29
+ Connection:
30
+ - keep-alive
31
+ Set-Cookie:
32
+ - __cfduid=d1f99b0b6a553f4dbc28ad4852db67fdb1491728346; expires=Mon, 09-Apr-18
33
+ 08:59:06 GMT; path=/; Domain=api.hackerone.com; HttpOnly
34
+ X-Request-Id:
35
+ - f97eb020-ff49-4ca1-96c4-d26c50ae8a83
36
+ Etag:
37
+ - W/"9329ef6b8f370e76d96d71977a6480c4"
38
+ Cache-Control:
39
+ - max-age=0, private, must-revalidate
40
+ Strict-Transport-Security:
41
+ - max-age=31536000; includeSubDomains; preload
42
+ Content-Security-Policy:
43
+ - default-src 'none'; connect-src 'self' www.google-analytics.com errors.hackerone.net;
44
+ font-src 'self'; img-src 'self' data:; script-src 'self'; style-src 'self'
45
+ 'unsafe-inline'; form-action 'self'; frame-ancestors 'none'; report-uri https://errors.hackerone.net/api/30/csp-report/?sentry_key=61c1e2f50d21487c97a071737701f598
46
+ X-Content-Type-Options:
47
+ - nosniff
48
+ X-Download-Options:
49
+ - noopen
50
+ X-Frame-Options:
51
+ - DENY
52
+ X-Permitted-Cross-Domain-Policies:
53
+ - none
54
+ X-Xss-Protection:
55
+ - 1; mode=block
56
+ Public-Key-Pins-Report-Only:
57
+ - pin-sha256="WoiWRyIOVNa9ihaBciRSC7XHjliYS9VwUGOIud4PB18="; pin-sha256="r/mIkG3eEpVdm+u/ko/cwxzOMo1bk4TyHIlByibiA5E=";
58
+ pin-sha256="K87oWBWM9UZfyddvDfoxL+8lpNyoUB2ptGtn0fv6G2Q="; pin-sha256="iie1VXtL7HzAMF+/PVPR9xzT80kQxdZeJ+zduCB3uj0=";
59
+ pin-sha256="cGuxAXyFXFkWm61cF4HPWX8S0srS9j0aSqN0k4AP+4A="; pin-sha256="bIlWcjiKq1mftH/xd7Hw1JO77Cr+Gv+XYcGUQWwO+A4=";
60
+ pin-sha256="tXD+dGAP8rGY4PW1be90cOYEwg7pZ4G+yPZmIZWPTSg="; max-age=600; includeSubDomains;
61
+ report-uri="https://hackerone.report-uri.io/r/default/hpkp/reportOnly"
62
+ Server:
63
+ - cloudflare-nginx
64
+ Cf-Ray:
65
+ - 34cc44b77b592c84-AMS
66
+ body:
67
+ encoding: ASCII-8BIT
68
+ string: '{"data":[{"id":"18969","type":"program","attributes":{"handle":"github","created_at":"2017-03-08T19:22:41.884Z","updated_at":"2017-04-09T08:15:15.228Z"}}],"links":{}}'
69
+ http_version:
70
+ recorded_at: Sun, 09 Apr 2017 08:58:53 GMT
71
+ - request:
72
+ method: get
73
+ uri: https://api.hackerone.com/v1/programs/18969/reporters
74
+ body:
75
+ encoding: US-ASCII
76
+ string: ''
77
+ headers:
78
+ Authorization:
79
+ - Basic nope
80
+ User-Agent:
81
+ - Faraday v0.12.0.1
82
+ Accept-Encoding:
83
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
84
+ Accept:
85
+ - "*/*"
86
+ response:
87
+ status:
88
+ code: 200
89
+ message: OK
90
+ headers:
91
+ Date:
92
+ - Sun, 09 Apr 2017 08:59:08 GMT
93
+ Content-Type:
94
+ - application/json; charset=utf-8
95
+ Transfer-Encoding:
96
+ - chunked
97
+ Connection:
98
+ - keep-alive
99
+ Set-Cookie:
100
+ - __cfduid=d23bd69c906353d19d61a470205fbd3aa1491728347; expires=Mon, 09-Apr-18
101
+ 08:59:07 GMT; path=/; Domain=api.hackerone.com; HttpOnly
102
+ X-Request-Id:
103
+ - 309a6cf3-fa65-431f-8fbb-4233b10e034a
104
+ Etag:
105
+ - W/"9aa4f6dc05b45c7c7501665dc619a30b"
106
+ Cache-Control:
107
+ - max-age=0, private, must-revalidate
108
+ Strict-Transport-Security:
109
+ - max-age=31536000; includeSubDomains; preload
110
+ Content-Security-Policy:
111
+ - default-src 'none'; connect-src 'self' www.google-analytics.com errors.hackerone.net;
112
+ font-src 'self'; img-src 'self' data:; script-src 'self'; style-src 'self'
113
+ 'unsafe-inline'; form-action 'self'; frame-ancestors 'none'; report-uri https://errors.hackerone.net/api/30/csp-report/?sentry_key=61c1e2f50d21487c97a071737701f598
114
+ X-Content-Type-Options:
115
+ - nosniff
116
+ X-Download-Options:
117
+ - noopen
118
+ X-Frame-Options:
119
+ - DENY
120
+ X-Permitted-Cross-Domain-Policies:
121
+ - none
122
+ X-Xss-Protection:
123
+ - 1; mode=block
124
+ Public-Key-Pins-Report-Only:
125
+ - pin-sha256="WoiWRyIOVNa9ihaBciRSC7XHjliYS9VwUGOIud4PB18="; pin-sha256="r/mIkG3eEpVdm+u/ko/cwxzOMo1bk4TyHIlByibiA5E=";
126
+ pin-sha256="K87oWBWM9UZfyddvDfoxL+8lpNyoUB2ptGtn0fv6G2Q="; pin-sha256="iie1VXtL7HzAMF+/PVPR9xzT80kQxdZeJ+zduCB3uj0=";
127
+ pin-sha256="cGuxAXyFXFkWm61cF4HPWX8S0srS9j0aSqN0k4AP+4A="; pin-sha256="bIlWcjiKq1mftH/xd7Hw1JO77Cr+Gv+XYcGUQWwO+A4=";
128
+ pin-sha256="tXD+dGAP8rGY4PW1be90cOYEwg7pZ4G+yPZmIZWPTSg="; max-age=600; includeSubDomains;
129
+ report-uri="https://hackerone.report-uri.io/r/default/hpkp/reportOnly"
130
+ Server:
131
+ - cloudflare-nginx
132
+ Cf-Ray:
133
+ - 34cc44bc8f6d2c36-AMS
134
+ body:
135
+ encoding: ASCII-8BIT
136
+ string: '{"data":[{"id":"3683","type":"user","attributes":{"username":"demo-hacker","name":"Demo
137
+ Hacker","disabled":false,"created_at":"2014-03-17T20:14:25.383Z","profile_picture":{"62x62":"https://profile-photos.hackerone-user-content.com/production/000/003/683/93c0f225152f8f18a396f325eca530143719a729_small.png?1423472503","82x82":"https://profile-photos.hackerone-user-content.com/production/000/003/683/d38d82a37a6ac1f2df43b0d36ad8ee8d0acd68d1_medium.png?1423472503","110x110":"https://profile-photos.hackerone-user-content.com/production/000/003/683/6793a1566a8c8ec72a179c63bbd92c1af965a162_large.png?1423472503","260x260":"https://profile-photos.hackerone-user-content.com/production/000/003/683/0201a343075ea8f7feb7aff975c6a48cc53536c7_xtralarge.png?1423472503"}}},{"id":"147515","type":"user","attributes":{"username":"hackhackhackhack","name":"hackhackhackhack","disabled":false,"created_at":"2017-03-04T16:31:33.595Z","profile_picture":{"62x62":"/assets/avatars/default-71a302d706457f3d3a31eb30fa3e73e6cf0b1d677b8fa218eaeaffd67ae97918.png","82x82":"/assets/avatars/default-71a302d706457f3d3a31eb30fa3e73e6cf0b1d677b8fa218eaeaffd67ae97918.png","110x110":"/assets/avatars/default-71a302d706457f3d3a31eb30fa3e73e6cf0b1d677b8fa218eaeaffd67ae97918.png","260x260":"/assets/avatars/default-71a302d706457f3d3a31eb30fa3e73e6cf0b1d677b8fa218eaeaffd67ae97918.png"}}}],"links":{}}'
138
+ http_version:
139
+ recorded_at: Sun, 09 Apr 2017 08:58:54 GMT
140
+ - request:
141
+ method: get
142
+ uri: https://api.hackerone.com/v1/me/programs
143
+ body:
144
+ encoding: US-ASCII
145
+ string: ''
146
+ headers:
147
+ Authorization:
148
+ - Basic c2pvcnM6czZhdGxtTGFZT1RZbXhMMXlrRHpoT3Z2SHRXbEhlK1praUg4SHpJWEtEZz0=
149
+ User-Agent:
150
+ - Faraday v0.12.0.1
151
+ Accept-Encoding:
152
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
153
+ Accept:
154
+ - "*/*"
155
+ response:
156
+ status:
157
+ code: 200
158
+ message: OK
159
+ headers:
160
+ Date:
161
+ - Sun, 09 Apr 2017 08:59:11 GMT
162
+ Content-Type:
163
+ - application/json; charset=utf-8
164
+ Transfer-Encoding:
165
+ - chunked
166
+ Connection:
167
+ - keep-alive
168
+ Set-Cookie:
169
+ - __cfduid=dbdf5d1926aa433bb647c26c813339cb51491728350; expires=Mon, 09-Apr-18
170
+ 08:59:10 GMT; path=/; Domain=api.hackerone.com; HttpOnly
171
+ X-Request-Id:
172
+ - 7c1141cc-ef87-4c17-9c65-ea564f1dbe64
173
+ Etag:
174
+ - W/"9329ef6b8f370e76d96d71977a6480c4"
175
+ Cache-Control:
176
+ - max-age=0, private, must-revalidate
177
+ Strict-Transport-Security:
178
+ - max-age=31536000; includeSubDomains; preload
179
+ Content-Security-Policy:
180
+ - default-src 'none'; connect-src 'self' www.google-analytics.com errors.hackerone.net;
181
+ font-src 'self'; img-src 'self' data:; script-src 'self'; style-src 'self'
182
+ 'unsafe-inline'; form-action 'self'; frame-ancestors 'none'; report-uri https://errors.hackerone.net/api/30/csp-report/?sentry_key=61c1e2f50d21487c97a071737701f598
183
+ X-Content-Type-Options:
184
+ - nosniff
185
+ X-Download-Options:
186
+ - noopen
187
+ X-Frame-Options:
188
+ - DENY
189
+ X-Permitted-Cross-Domain-Policies:
190
+ - none
191
+ X-Xss-Protection:
192
+ - 1; mode=block
193
+ Public-Key-Pins-Report-Only:
194
+ - pin-sha256="WoiWRyIOVNa9ihaBciRSC7XHjliYS9VwUGOIud4PB18="; pin-sha256="r/mIkG3eEpVdm+u/ko/cwxzOMo1bk4TyHIlByibiA5E=";
195
+ pin-sha256="K87oWBWM9UZfyddvDfoxL+8lpNyoUB2ptGtn0fv6G2Q="; pin-sha256="iie1VXtL7HzAMF+/PVPR9xzT80kQxdZeJ+zduCB3uj0=";
196
+ pin-sha256="cGuxAXyFXFkWm61cF4HPWX8S0srS9j0aSqN0k4AP+4A="; pin-sha256="bIlWcjiKq1mftH/xd7Hw1JO77Cr+Gv+XYcGUQWwO+A4=";
197
+ pin-sha256="tXD+dGAP8rGY4PW1be90cOYEwg7pZ4G+yPZmIZWPTSg="; max-age=600; includeSubDomains;
198
+ report-uri="https://hackerone.report-uri.io/r/default/hpkp/reportOnly"
199
+ Server:
200
+ - cloudflare-nginx
201
+ Cf-Ray:
202
+ - 34cc44d04b97726b-AMS
203
+ body:
204
+ encoding: ASCII-8BIT
205
+ string: '{"data":[{"id":"18969","type":"program","attributes":{"handle":"github","created_at":"2017-03-08T19:22:41.884Z","updated_at":"2017-04-09T08:15:15.228Z"}}],"links":{}}'
206
+ http_version:
207
+ recorded_at: Sun, 09 Apr 2017 08:58:57 GMT
208
+ - request:
209
+ method: get
210
+ uri: https://api.hackerone.com/v1/programs/18969/reporters
211
+ body:
212
+ encoding: US-ASCII
213
+ string: ''
214
+ headers:
215
+ Authorization:
216
+ - Basic c2pvcnM6czZhdGxtTGFZT1RZbXhMMXlrRHpoT3Z2SHRXbEhlK1praUg4SHpJWEtEZz0=
217
+ User-Agent:
218
+ - Faraday v0.12.0.1
219
+ Accept-Encoding:
220
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
221
+ Accept:
222
+ - "*/*"
223
+ response:
224
+ status:
225
+ code: 200
226
+ message: OK
227
+ headers:
228
+ Date:
229
+ - Sun, 09 Apr 2017 08:59:11 GMT
230
+ Content-Type:
231
+ - application/json; charset=utf-8
232
+ Transfer-Encoding:
233
+ - chunked
234
+ Connection:
235
+ - keep-alive
236
+ Set-Cookie:
237
+ - __cfduid=df4d61dedbf259f1df1a4e4abafb7dc281491728351; expires=Mon, 09-Apr-18
238
+ 08:59:11 GMT; path=/; Domain=api.hackerone.com; HttpOnly
239
+ X-Request-Id:
240
+ - b67b52f9-e1a6-40f4-8025-00bc77e842f7
241
+ Etag:
242
+ - W/"9aa4f6dc05b45c7c7501665dc619a30b"
243
+ Cache-Control:
244
+ - max-age=0, private, must-revalidate
245
+ Strict-Transport-Security:
246
+ - max-age=31536000; includeSubDomains; preload
247
+ Content-Security-Policy:
248
+ - default-src 'none'; connect-src 'self' www.google-analytics.com errors.hackerone.net;
249
+ font-src 'self'; img-src 'self' data:; script-src 'self'; style-src 'self'
250
+ 'unsafe-inline'; form-action 'self'; frame-ancestors 'none'; report-uri https://errors.hackerone.net/api/30/csp-report/?sentry_key=61c1e2f50d21487c97a071737701f598
251
+ X-Content-Type-Options:
252
+ - nosniff
253
+ X-Download-Options:
254
+ - noopen
255
+ X-Frame-Options:
256
+ - DENY
257
+ X-Permitted-Cross-Domain-Policies:
258
+ - none
259
+ X-Xss-Protection:
260
+ - 1; mode=block
261
+ Public-Key-Pins-Report-Only:
262
+ - pin-sha256="WoiWRyIOVNa9ihaBciRSC7XHjliYS9VwUGOIud4PB18="; pin-sha256="r/mIkG3eEpVdm+u/ko/cwxzOMo1bk4TyHIlByibiA5E=";
263
+ pin-sha256="K87oWBWM9UZfyddvDfoxL+8lpNyoUB2ptGtn0fv6G2Q="; pin-sha256="iie1VXtL7HzAMF+/PVPR9xzT80kQxdZeJ+zduCB3uj0=";
264
+ pin-sha256="cGuxAXyFXFkWm61cF4HPWX8S0srS9j0aSqN0k4AP+4A="; pin-sha256="bIlWcjiKq1mftH/xd7Hw1JO77Cr+Gv+XYcGUQWwO+A4=";
265
+ pin-sha256="tXD+dGAP8rGY4PW1be90cOYEwg7pZ4G+yPZmIZWPTSg="; max-age=600; includeSubDomains;
266
+ report-uri="https://hackerone.report-uri.io/r/default/hpkp/reportOnly"
267
+ Server:
268
+ - cloudflare-nginx
269
+ Cf-Ray:
270
+ - 34cc44d4dfa60c1d-AMS
271
+ body:
272
+ encoding: ASCII-8BIT
273
+ string: '{"data":[{"id":"3683","type":"user","attributes":{"username":"demo-hacker","name":"Demo
274
+ Hacker","disabled":false,"created_at":"2014-03-17T20:14:25.383Z","profile_picture":{"62x62":"https://profile-photos.hackerone-user-content.com/production/000/003/683/93c0f225152f8f18a396f325eca530143719a729_small.png?1423472503","82x82":"https://profile-photos.hackerone-user-content.com/production/000/003/683/d38d82a37a6ac1f2df43b0d36ad8ee8d0acd68d1_medium.png?1423472503","110x110":"https://profile-photos.hackerone-user-content.com/production/000/003/683/6793a1566a8c8ec72a179c63bbd92c1af965a162_large.png?1423472503","260x260":"https://profile-photos.hackerone-user-content.com/production/000/003/683/0201a343075ea8f7feb7aff975c6a48cc53536c7_xtralarge.png?1423472503"}}},{"id":"147515","type":"user","attributes":{"username":"hackhackhackhack","name":"hackhackhackhack","disabled":false,"created_at":"2017-03-04T16:31:33.595Z","profile_picture":{"62x62":"/assets/avatars/default-71a302d706457f3d3a31eb30fa3e73e6cf0b1d677b8fa218eaeaffd67ae97918.png","82x82":"/assets/avatars/default-71a302d706457f3d3a31eb30fa3e73e6cf0b1d677b8fa218eaeaffd67ae97918.png","110x110":"/assets/avatars/default-71a302d706457f3d3a31eb30fa3e73e6cf0b1d677b8fa218eaeaffd67ae97918.png","260x260":"/assets/avatars/default-71a302d706457f3d3a31eb30fa3e73e6cf0b1d677b8fa218eaeaffd67ae97918.png"}}}],"links":{}}'
275
+ http_version:
276
+ recorded_at: Sun, 09 Apr 2017 08:58:57 GMT
277
+ recorded_with: VCR 3.0.3
@@ -1,8 +1,11 @@
1
1
  require "faraday"
2
- require 'active_support/time'
2
+ require "json"
3
+ require "active_support/time"
3
4
  require_relative "client/version"
4
5
  require_relative "client/report"
5
6
  require_relative "client/activity"
7
+ require_relative "client/program"
8
+ require_relative "client/reporter"
6
9
 
7
10
  module HackerOne
8
11
  module Client
@@ -52,6 +55,22 @@ module HackerOne
52
55
  @program || HackerOne::Client.program
53
56
  end
54
57
 
58
+ def reporters
59
+ raise ArgumentError, "Program cannot be nil" unless program
60
+ response = self.class.hackerone_api_connection.get do |req|
61
+ req.url "programs/#{Program.find(program).id}/reporters"
62
+ end
63
+
64
+ data = self.class.parse_response(response)
65
+ if data.nil?
66
+ raise RuntimeError, "Expected data attribute in response: #{response.body}"
67
+ end
68
+
69
+ data.map do |reporter|
70
+ Reporter.new(reporter)
71
+ end
72
+ end
73
+
55
74
  ## Returns all open reports, optionally with a time bound
56
75
  #
57
76
  # program: the HackerOne program to search on (configure globally with Hackerone::Client.program=)
@@ -69,10 +88,7 @@ module HackerOne
69
88
  req.url "reports", options
70
89
  end
71
90
 
72
- data = JSON.parse(response.body, :symbolize_names => true)[:data]
73
- if data.nil?
74
- raise RuntimeError, "Expected data attribute in response: #{response.body}"
75
- end
91
+ data = self.class.parse_response(response)
76
92
 
77
93
  data.map do |report|
78
94
  Report.new(report)
@@ -108,7 +124,7 @@ module HackerOne
108
124
  }
109
125
  }
110
126
 
111
- post("reports/#{id}/issue_tracker_reference_id", body)
127
+ Report.new(post("reports/#{id}/issue_tracker_reference_id", body))
112
128
  end
113
129
 
114
130
  ## Idempotent: change the state of a report. See STATES for valid values.
@@ -148,7 +164,7 @@ module HackerOne
148
164
  # returns an HackerOne::Client::Report object or raises an error if
149
165
  # no report is found.
150
166
  def report(id)
151
- get("reports/#{id}")
167
+ Report.new(get("reports/#{id}"))
152
168
  end
153
169
 
154
170
  private
@@ -161,7 +177,7 @@ module HackerOne
161
177
  end
162
178
  end
163
179
 
164
- parse_response(response)
180
+ self.class.parse_response(response)
165
181
  end
166
182
 
167
183
  def get(endpoint, params = nil)
@@ -173,16 +189,16 @@ module HackerOne
173
189
  end
174
190
  end
175
191
 
176
- parse_response(response)
192
+ self.class.parse_response(response)
177
193
  end
178
194
 
179
- def parse_response(response)
195
+ def self.parse_response(response)
180
196
  if response.status.to_s.start_with?("4")
181
197
  raise ArgumentError, "API called failed, probably your fault: #{response.body}"
182
198
  elsif response.status.to_s.start_with?("5")
183
199
  raise RuntimeError, "API called failed, probably their fault: #{response.body}"
184
200
  elsif response.success?
185
- Report.new(JSON.parse(response.body, :symbolize_names => true)[:data])
201
+ JSON.parse(response.body, :symbolize_names => true)[:data]
186
202
  else
187
203
  raise RuntimeError, "Not sure what to do here: #{response.body}"
188
204
  end
@@ -0,0 +1,38 @@
1
+ module HackerOne
2
+ module Client
3
+ class Program
4
+ delegate :handle, to: :attributes
5
+
6
+ def self.find(program_handle_we_want)
7
+ my_programs.find do |program|
8
+ program.handle == program_handle_we_want
9
+ end
10
+ end
11
+
12
+ def initialize(program)
13
+ @program = program
14
+ end
15
+
16
+ def id
17
+ @program[:id]
18
+ end
19
+
20
+ def attributes
21
+ OpenStruct.new(@program[:attributes])
22
+ end
23
+
24
+ private
25
+
26
+ def self.my_programs
27
+ @my_programs ||= begin
28
+ response = HackerOne::Client::Api.hackerone_api_connection.get do |req|
29
+ req.url "me/programs"
30
+ end
31
+
32
+ data = HackerOne::Client::Api.parse_response(response)
33
+ data.map { |program| self.new(program) }
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,23 @@
1
+ module HackerOne
2
+ module Client
3
+ class Reporter
4
+ delegate :username, :name, :created_at, to: :attributes
5
+
6
+ def initialize(reporter)
7
+ @reporter = reporter
8
+ end
9
+
10
+ def id
11
+ @reporter[:id]
12
+ end
13
+
14
+ def attributes
15
+ OpenStruct.new(@reporter[:attributes])
16
+ end
17
+
18
+ def disabled?
19
+ attributes.disabled
20
+ end
21
+ end
22
+ end
23
+ end
@@ -1,5 +1,5 @@
1
1
  module Hackerone
2
2
  module Client
3
- VERSION = "0.3.2"
3
+ VERSION = "0.4.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hackerone-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Neil Matatall
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-03-24 00:00:00.000000000 Z
11
+ date: 2017-04-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -124,6 +124,7 @@ files:
124
124
  - ".gitignore"
125
125
  - ".rspec"
126
126
  - ".travis.yml"
127
+ - CHANGELOG.md
127
128
  - CODE_OF_CONDUCT.md
128
129
  - Gemfile
129
130
  - Guardfile
@@ -135,14 +136,18 @@ files:
135
136
  - fixtures/vcr_cassettes/add_report_reference.yml
136
137
  - fixtures/vcr_cassettes/empty_report_list.yml
137
138
  - fixtures/vcr_cassettes/missing_report.yml
139
+ - fixtures/vcr_cassettes/programs.yml
138
140
  - fixtures/vcr_cassettes/report.yml
139
141
  - fixtures/vcr_cassettes/report_list.yml
142
+ - fixtures/vcr_cassettes/reporters.yml
140
143
  - fixtures/vcr_cassettes/server_error.yml
141
144
  - fixtures/vcr_cassettes/stage_change.yml
142
145
  - hackerone-client.gemspec
143
146
  - lib/hackerone/client.rb
144
147
  - lib/hackerone/client/activity.rb
148
+ - lib/hackerone/client/program.rb
145
149
  - lib/hackerone/client/report.rb
150
+ - lib/hackerone/client/reporter.rb
146
151
  - lib/hackerone/client/version.rb
147
152
  - lib/hackerone/client/weakness.rb
148
153
  homepage: https://github.com/oreoshake/hackerone-client
@@ -165,7 +170,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
165
170
  version: '0'
166
171
  requirements: []
167
172
  rubyforge_project:
168
- rubygems_version: 2.2.0
173
+ rubygems_version: 2.4.5.1
169
174
  signing_key:
170
175
  specification_version: 4
171
176
  summary: A limited client for the HackerOne API