travis-client 0.1.0 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +4 -2
  3. data/.rspec +3 -2
  4. data/.travis.yml +2 -9
  5. data/.yardopts +2 -0
  6. data/Gemfile +1 -3
  7. data/Gemfile.lock +59 -0
  8. data/lib/travis/client.rb +20 -104
  9. data/lib/travis/client/action.rb +128 -0
  10. data/lib/travis/client/collection.rb +66 -0
  11. data/lib/travis/client/connection.rb +104 -0
  12. data/lib/travis/client/context.rb +52 -0
  13. data/lib/travis/client/entity.rb +77 -0
  14. data/lib/travis/client/error.rb +47 -0
  15. data/lib/travis/client/generated.rb +2073 -0
  16. data/lib/travis/client/link.rb +34 -0
  17. data/lib/travis/client/session.rb +101 -0
  18. data/lib/travis/client/unknown.rb +5 -0
  19. data/lib/travis/client/version.rb +6 -0
  20. data/readme.md +187 -0
  21. data/script/generate +44 -0
  22. data/spec/http_responses/default/branches.http +715 -0
  23. data/spec/http_responses/default/find_owner.http +23 -0
  24. data/spec/http_responses/default/index.http +1518 -0
  25. data/spec/http_responses/default/repo.http +44 -0
  26. data/spec/http_responses/default/repo_branches_10.http +347 -0
  27. data/spec/http_responses/default/repo_branches_10_0.http +347 -0
  28. data/spec/http_responses/default/repo_branches_10_10.http +351 -0
  29. data/spec/http_responses/default/repo_branches_10_20.http +99 -0
  30. data/spec/http_responses/default/sync.http +12 -0
  31. data/spec/http_responses/default/user_repos.http +6315 -0
  32. data/spec/spec_helper.rb +4 -2
  33. data/spec/support/coverage.rb +8 -0
  34. data/spec/support/generate_http_response.rb +16 -0
  35. data/spec/support/http.rb +54 -0
  36. data/spec/travis/collection_spec.rb +19 -0
  37. data/spec/travis/connection_spec.rb +26 -0
  38. data/spec/travis/entity_spec.rb +27 -0
  39. data/spec/travis_spec.rb +18 -0
  40. data/travis-client.gemspec +21 -21
  41. metadata +103 -75
  42. data/README.textile +0 -111
  43. data/Rakefile +0 -8
  44. data/bin/travis +0 -21
  45. data/features/repositories.feature +0 -117
  46. data/features/step_definitions/repositories_steps.rb +0 -51
  47. data/features/support/env.rb +0 -2
  48. data/lib/travis.rb +0 -2
  49. data/lib/travis/api.rb +0 -3
  50. data/lib/travis/api/client.rb +0 -95
  51. data/lib/travis/api/client/repositories.rb +0 -234
  52. data/lib/travis/api/entity.rb +0 -44
  53. data/lib/travis/api/entity/build.rb +0 -129
  54. data/lib/travis/api/entity/repository.rb +0 -79
  55. data/lib/travis/client/repositories.rb +0 -345
  56. data/spec/travis/api/client/repositories_spec.rb +0 -2
  57. data/spec/travis/api/client_spec.rb +0 -15
  58. data/spec/travis/api/entity/build_spec.rb +0 -84
  59. data/spec/travis/api/entity/repository_spec.rb +0 -79
  60. data/spec/travis/api/entity_spec.rb +0 -46
  61. data/spec/travis/api/shared_client_examples.rb +0 -3
  62. data/spec/travis/api/shared_entity_examples.rb +0 -16
@@ -0,0 +1,351 @@
1
+ GET https://api.travis-ci.org/repo/409371/branches?limit=10&offset=10 HTTP/1.1
2
+ Accept: application/json
3
+ Travis-API-Version: 3
4
+
5
+ HTTP/1.1 200 OK
6
+ Content-Type: application/json
7
+
8
+ {
9
+ "@type": "branches",
10
+ "@href": "/repo/409371/branches?limit=10&offset=10",
11
+ "@representation": "standard",
12
+ "@pagination": {
13
+ "limit": 10,
14
+ "offset": 10,
15
+ "count": 22,
16
+ "is_first": false,
17
+ "is_last": false,
18
+ "next": {
19
+ "@href": "/repo/409371/branches?limit=10&offset=20",
20
+ "offset": 20,
21
+ "limit": 10
22
+ },
23
+ "prev": {
24
+ "@href": "/repo/409371/branches?limit=10&offset=0",
25
+ "offset": 0,
26
+ "limit": 10
27
+ },
28
+ "first": {
29
+ "@href": "/repo/409371/branches?limit=10&offset=0",
30
+ "offset": 0,
31
+ "limit": 10
32
+ },
33
+ "last": {
34
+ "@href": "/repo/409371/branches?limit=10&offset=20",
35
+ "offset": 20,
36
+ "limit": 10
37
+ }
38
+ },
39
+ "branches": [
40
+ {
41
+ "@type": "branch",
42
+ "@href": "/repo/409371/branch/v1.8.6",
43
+ "@representation": "standard",
44
+ "name": "v1.8.6",
45
+ "repository": {
46
+ "@type": "repository",
47
+ "@href": "/repo/409371",
48
+ "@representation": "minimal",
49
+ "id": 409371,
50
+ "name": "travis.rb",
51
+ "slug": "travis-ci/travis.rb"
52
+ },
53
+ "default_branch": false,
54
+ "exists_on_github": false,
55
+ "last_build": {
56
+ "@type": "build",
57
+ "@href": "/build/195648126",
58
+ "@representation": "minimal",
59
+ "id": 195648126,
60
+ "number": "810",
61
+ "state": "passed",
62
+ "duration": 591,
63
+ "event_type": "push",
64
+ "previous_state": null,
65
+ "pull_request_title": null,
66
+ "pull_request_number": null,
67
+ "started_at": "2017-01-26T19:46:38Z",
68
+ "finished_at": "2017-01-26T22:59:01Z"
69
+ }
70
+ },
71
+ {
72
+ "@type": "branch",
73
+ "@href": "/repo/409371/branch/fix_report",
74
+ "@representation": "standard",
75
+ "name": "fix_report",
76
+ "repository": {
77
+ "@type": "repository",
78
+ "@href": "/repo/409371",
79
+ "@representation": "minimal",
80
+ "id": 409371,
81
+ "name": "travis.rb",
82
+ "slug": "travis-ci/travis.rb"
83
+ },
84
+ "default_branch": false,
85
+ "exists_on_github": false,
86
+ "last_build": {
87
+ "@type": "build",
88
+ "@href": "/build/194281685",
89
+ "@representation": "minimal",
90
+ "id": 194281685,
91
+ "number": "804",
92
+ "state": "passed",
93
+ "duration": 479,
94
+ "event_type": "push",
95
+ "previous_state": null,
96
+ "pull_request_title": null,
97
+ "pull_request_number": null,
98
+ "started_at": "2017-01-22T20:25:57Z",
99
+ "finished_at": "2017-01-22T20:29:06Z"
100
+ }
101
+ },
102
+ {
103
+ "@type": "branch",
104
+ "@href": "/repo/409371/branch/v1.8.5",
105
+ "@representation": "standard",
106
+ "name": "v1.8.5",
107
+ "repository": {
108
+ "@type": "repository",
109
+ "@href": "/repo/409371",
110
+ "@representation": "minimal",
111
+ "id": 409371,
112
+ "name": "travis.rb",
113
+ "slug": "travis-ci/travis.rb"
114
+ },
115
+ "default_branch": false,
116
+ "exists_on_github": false,
117
+ "last_build": {
118
+ "@type": "build",
119
+ "@href": "/build/182323691",
120
+ "@representation": "minimal",
121
+ "id": 182323691,
122
+ "number": "795",
123
+ "state": "passed",
124
+ "duration": 651,
125
+ "event_type": "push",
126
+ "previous_state": null,
127
+ "pull_request_title": null,
128
+ "pull_request_number": null,
129
+ "started_at": "2016-12-08T16:14:19Z",
130
+ "finished_at": "2016-12-08T16:45:18Z"
131
+ }
132
+ },
133
+ {
134
+ "@type": "branch",
135
+ "@href": "/repo/409371/branch/v1.8.4",
136
+ "@representation": "standard",
137
+ "name": "v1.8.4",
138
+ "repository": {
139
+ "@type": "repository",
140
+ "@href": "/repo/409371",
141
+ "@representation": "minimal",
142
+ "id": 409371,
143
+ "name": "travis.rb",
144
+ "slug": "travis-ci/travis.rb"
145
+ },
146
+ "default_branch": false,
147
+ "exists_on_github": false,
148
+ "last_build": {
149
+ "@type": "build",
150
+ "@href": "/build/174556256",
151
+ "@representation": "minimal",
152
+ "id": 174556256,
153
+ "number": "780",
154
+ "state": "passed",
155
+ "duration": 489,
156
+ "event_type": "push",
157
+ "previous_state": null,
158
+ "pull_request_title": null,
159
+ "pull_request_number": null,
160
+ "started_at": "2016-11-09T17:45:45Z",
161
+ "finished_at": "2016-11-09T18:09:30Z"
162
+ }
163
+ },
164
+ {
165
+ "@type": "branch",
166
+ "@href": "/repo/409371/branch/v1.8.3",
167
+ "@representation": "standard",
168
+ "name": "v1.8.3",
169
+ "repository": {
170
+ "@type": "repository",
171
+ "@href": "/repo/409371",
172
+ "@representation": "minimal",
173
+ "id": 409371,
174
+ "name": "travis.rb",
175
+ "slug": "travis-ci/travis.rb"
176
+ },
177
+ "default_branch": false,
178
+ "exists_on_github": false,
179
+ "last_build": {
180
+ "@type": "build",
181
+ "@href": "/build/174531237",
182
+ "@representation": "minimal",
183
+ "id": 174531237,
184
+ "number": "778",
185
+ "state": "passed",
186
+ "duration": 508,
187
+ "event_type": "push",
188
+ "previous_state": "errored",
189
+ "pull_request_title": null,
190
+ "pull_request_number": null,
191
+ "started_at": "2016-11-09T16:13:15Z",
192
+ "finished_at": "2016-11-09T16:30:28Z"
193
+ }
194
+ },
195
+ {
196
+ "@type": "branch",
197
+ "@href": "/repo/409371/branch/sec-incident-20161007",
198
+ "@representation": "standard",
199
+ "name": "sec-incident-20161007",
200
+ "repository": {
201
+ "@type": "repository",
202
+ "@href": "/repo/409371",
203
+ "@representation": "minimal",
204
+ "id": 409371,
205
+ "name": "travis.rb",
206
+ "slug": "travis-ci/travis.rb"
207
+ },
208
+ "default_branch": false,
209
+ "exists_on_github": false,
210
+ "last_build": {
211
+ "@type": "build",
212
+ "@href": "/build/166763571",
213
+ "@representation": "minimal",
214
+ "id": 166763571,
215
+ "number": "772",
216
+ "state": "passed",
217
+ "duration": 578,
218
+ "event_type": "push",
219
+ "previous_state": "errored",
220
+ "pull_request_title": null,
221
+ "pull_request_number": null,
222
+ "started_at": "2016-10-11T14:10:26Z",
223
+ "finished_at": "2016-10-11T14:15:30Z"
224
+ }
225
+ },
226
+ {
227
+ "@type": "branch",
228
+ "@href": "/repo/409371/branch/v1.8.2",
229
+ "@representation": "standard",
230
+ "name": "v1.8.2",
231
+ "repository": {
232
+ "@type": "repository",
233
+ "@href": "/repo/409371",
234
+ "@representation": "minimal",
235
+ "id": 409371,
236
+ "name": "travis.rb",
237
+ "slug": "travis-ci/travis.rb"
238
+ },
239
+ "default_branch": false,
240
+ "exists_on_github": false,
241
+ "last_build": {
242
+ "@type": "build",
243
+ "@href": "/build/101827353",
244
+ "@representation": "minimal",
245
+ "id": 101827353,
246
+ "number": "725",
247
+ "state": "passed",
248
+ "duration": 282,
249
+ "event_type": "push",
250
+ "previous_state": null,
251
+ "pull_request_title": null,
252
+ "pull_request_number": null,
253
+ "started_at": "2016-01-12T12:56:48Z",
254
+ "finished_at": "2016-01-12T12:57:22Z"
255
+ }
256
+ },
257
+ {
258
+ "@type": "branch",
259
+ "@href": "/repo/409371/branch/v1.8.1",
260
+ "@representation": "standard",
261
+ "name": "v1.8.1",
262
+ "repository": {
263
+ "@type": "repository",
264
+ "@href": "/repo/409371",
265
+ "@representation": "minimal",
266
+ "id": 409371,
267
+ "name": "travis.rb",
268
+ "slug": "travis-ci/travis.rb"
269
+ },
270
+ "default_branch": false,
271
+ "exists_on_github": false,
272
+ "last_build": {
273
+ "@type": "build",
274
+ "@href": "/build/101827328",
275
+ "@representation": "minimal",
276
+ "id": 101827328,
277
+ "number": "723",
278
+ "state": "passed",
279
+ "duration": 284,
280
+ "event_type": "push",
281
+ "previous_state": null,
282
+ "pull_request_title": null,
283
+ "pull_request_number": null,
284
+ "started_at": "2016-01-12T12:54:23Z",
285
+ "finished_at": "2016-01-12T12:55:07Z"
286
+ }
287
+ },
288
+ {
289
+ "@type": "branch",
290
+ "@href": "/repo/409371/branch/ha-feature-logger",
291
+ "@representation": "standard",
292
+ "name": "ha-feature-logger",
293
+ "repository": {
294
+ "@type": "repository",
295
+ "@href": "/repo/409371",
296
+ "@representation": "minimal",
297
+ "id": 409371,
298
+ "name": "travis.rb",
299
+ "slug": "travis-ci/travis.rb"
300
+ },
301
+ "default_branch": false,
302
+ "exists_on_github": false,
303
+ "last_build": {
304
+ "@type": "build",
305
+ "@href": "/build/101148156",
306
+ "@representation": "minimal",
307
+ "id": 101148156,
308
+ "number": "720",
309
+ "state": "passed",
310
+ "duration": 333,
311
+ "event_type": "push",
312
+ "previous_state": null,
313
+ "pull_request_title": null,
314
+ "pull_request_number": null,
315
+ "started_at": "2016-01-08T20:13:05Z",
316
+ "finished_at": "2016-01-08T20:13:57Z"
317
+ }
318
+ },
319
+ {
320
+ "@type": "branch",
321
+ "@href": "/repo/409371/branch/v1.8.0",
322
+ "@representation": "standard",
323
+ "name": "v1.8.0",
324
+ "repository": {
325
+ "@type": "repository",
326
+ "@href": "/repo/409371",
327
+ "@representation": "minimal",
328
+ "id": 409371,
329
+ "name": "travis.rb",
330
+ "slug": "travis-ci/travis.rb"
331
+ },
332
+ "default_branch": false,
333
+ "exists_on_github": false,
334
+ "last_build": {
335
+ "@type": "build",
336
+ "@href": "/build/71051560",
337
+ "@representation": "minimal",
338
+ "id": 71051560,
339
+ "number": "690",
340
+ "state": "passed",
341
+ "duration": 300,
342
+ "event_type": "push",
343
+ "previous_state": null,
344
+ "pull_request_title": null,
345
+ "pull_request_number": null,
346
+ "started_at": "2015-07-15T10:07:19Z",
347
+ "finished_at": "2015-07-15T10:09:45Z"
348
+ }
349
+ }
350
+ ]
351
+ }
@@ -0,0 +1,99 @@
1
+ GET https://api.travis-ci.org/repo/409371/branches?limit=10&offset=20 HTTP/1.1
2
+ Accept: application/json
3
+ Travis-API-Version: 3
4
+
5
+ HTTP/1.1 200 OK
6
+ Content-Type: application/json
7
+
8
+ {
9
+ "@type": "branches",
10
+ "@href": "/repo/409371/branches?limit=10&offset=20",
11
+ "@representation": "standard",
12
+ "@pagination": {
13
+ "limit": 10,
14
+ "offset": 20,
15
+ "count": 22,
16
+ "is_first": false,
17
+ "is_last": true,
18
+ "next": null,
19
+ "prev": {
20
+ "@href": "/repo/409371/branches?limit=10&offset=10",
21
+ "offset": 10,
22
+ "limit": 10
23
+ },
24
+ "first": {
25
+ "@href": "/repo/409371/branches?limit=10&offset=0",
26
+ "offset": 0,
27
+ "limit": 10
28
+ },
29
+ "last": {
30
+ "@href": "/repo/409371/branches?limit=10&offset=20",
31
+ "offset": 20,
32
+ "limit": 10
33
+ }
34
+ },
35
+ "branches": [
36
+ {
37
+ "@type": "branch",
38
+ "@href": "/repo/409371/branch/v1.7.7",
39
+ "@representation": "standard",
40
+ "name": "v1.7.7",
41
+ "repository": {
42
+ "@type": "repository",
43
+ "@href": "/repo/409371",
44
+ "@representation": "minimal",
45
+ "id": 409371,
46
+ "name": "travis.rb",
47
+ "slug": "travis-ci/travis.rb"
48
+ },
49
+ "default_branch": false,
50
+ "exists_on_github": false,
51
+ "last_build": {
52
+ "@type": "build",
53
+ "@href": "/build/64086905",
54
+ "@representation": "minimal",
55
+ "id": 64086905,
56
+ "number": "685",
57
+ "state": "passed",
58
+ "duration": 360,
59
+ "event_type": "push",
60
+ "previous_state": null,
61
+ "pull_request_title": null,
62
+ "pull_request_number": null,
63
+ "started_at": "2015-05-26T12:52:46Z",
64
+ "finished_at": "2015-05-26T12:54:55Z"
65
+ }
66
+ },
67
+ {
68
+ "@type": "branch",
69
+ "@href": "/repo/409371/branch/v1.7.6",
70
+ "@representation": "standard",
71
+ "name": "v1.7.6",
72
+ "repository": {
73
+ "@type": "repository",
74
+ "@href": "/repo/409371",
75
+ "@representation": "minimal",
76
+ "id": 409371,
77
+ "name": "travis.rb",
78
+ "slug": "travis-ci/travis.rb"
79
+ },
80
+ "default_branch": false,
81
+ "exists_on_github": false,
82
+ "last_build": {
83
+ "@type": "build",
84
+ "@href": "/build/57651617",
85
+ "@representation": "minimal",
86
+ "id": 57651617,
87
+ "number": "679",
88
+ "state": "passed",
89
+ "duration": 669,
90
+ "event_type": "push",
91
+ "previous_state": null,
92
+ "pull_request_title": null,
93
+ "pull_request_number": null,
94
+ "started_at": "2015-04-08T14:28:31Z",
95
+ "finished_at": "2015-04-08T14:34:03Z"
96
+ }
97
+ }
98
+ ]
99
+ }
@@ -0,0 +1,12 @@
1
+ POST https://api.travis-ci.org/user/267/sync HTTP/1.1
2
+ Accept: application/json
3
+ Travis-API-Version: 3
4
+
5
+ HTTP/1.1 403 Forbidden
6
+ Content-Type: application/json
7
+
8
+ {
9
+ "@type": "error",
10
+ "error_type": "login_required",
11
+ "error_message": "login required"
12
+ }