trav3 0.4.1 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/README.md +70 -9
- data/lib/trav3.rb +848 -17
- data/lib/trav3/error/invalid_repository.rb +1 -1
- data/lib/trav3/headers.rb +8 -0
- data/lib/trav3/options.rb +2 -1
- data/lib/trav3/pagination.rb +7 -1
- data/lib/trav3/response/request_error.rb +3 -0
- data/lib/trav3/response/response.rb +109 -6
- data/lib/trav3/response/response_collection.rb +75 -6
- data/lib/trav3/response/success.rb +4 -0
- data/lib/trav3/rest.rb +1 -0
- data/lib/trav3/version.rb +1 -1
- data/trav3.gemspec +2 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b6ce7da3671a152eb6cc9bc85f50d37d8aec27c17ff9c880d168d16e8ff78dff
|
4
|
+
data.tar.gz: 1d01ba5af7ad9bb160e92e975dd9ab0120d041da253580146113b2862675755e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2d840ae84e3064ec94d4eead9d1adb44d8ac70cbf8f06152cbcbd5be795bbf65d8b7b84979e48f11b541e1f8f0ab4f21baea61b520c02b69c1512f00eeb142ce
|
7
|
+
data.tar.gz: a43e53a52a2a6eb16d776532d0f2cf5dd208f84f7bbabda4f29a4c145056a96953285a27ebc3017b9b64968ca90b7e778cdaf6972f11c5331a7c5c1e4058a1e1
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
[![Gem Version](https://badge.fury.io/rb/trav3.svg)](http://badge.fury.io/rb/trav3)
|
2
2
|
[![Build Status](https://travis-ci.org/danielpclark/trav3.svg?branch=master)](https://travis-ci.org/danielpclark/trav3)
|
3
|
-
[![Commits Since Release](https://img.shields.io/github/commits-since/danielpclark/trav3/v0.
|
3
|
+
[![Commits Since Release](https://img.shields.io/github/commits-since/danielpclark/trav3/v0.5.0.svg)](https://github.com/danielpclark/trav3/graphs/commit-activity)
|
4
4
|
[![Maintainability](https://api.codeclimate.com/v1/badges/1ed07a4baea3832b6207/maintainability)](https://codeclimate.com/github/danielpclark/trav3/maintainability)
|
5
5
|
[![Test Coverage](https://api.codeclimate.com/v1/badges/1ed07a4baea3832b6207/test_coverage)](https://codeclimate.com/github/danielpclark/trav3/test_coverage)
|
6
6
|
[![Red The Docs](https://img.shields.io/badge/Read-the%20docs-blue.svg)](http://danielpclark.github.io/trav3/Trav3/Travis.html)
|
@@ -8,10 +8,14 @@
|
|
8
8
|
|
9
9
|
# Trav3
|
10
10
|
|
11
|
-
A simple abstraction layer for Travis CI API v3.
|
12
|
-
or `RequestError` which both repsond with Hash like query methods for the JSON data or the Net::HTTP
|
13
|
-
resonse object methods.
|
11
|
+
A simple abstraction layer for Travis CI API v3.
|
14
12
|
|
13
|
+
The benefits of this library over the official gem are:
|
14
|
+
|
15
|
+
* No gem dependencies
|
16
|
+
* Designed much like the API documentation
|
17
|
+
* Handling the returned data is the same for nearly every response
|
18
|
+
* Little to no learning curve
|
15
19
|
|
16
20
|
## Installation
|
17
21
|
|
@@ -108,13 +112,70 @@ builds.page.last
|
|
108
112
|
# Recommended inspection
|
109
113
|
builds.keys
|
110
114
|
builds.dig("some_key")
|
111
|
-
```
|
112
115
|
|
113
|
-
|
116
|
+
# Follow `@href`
|
117
|
+
repositories = project.repositories("owner")['repositories']
|
118
|
+
repositories.first.follow
|
119
|
+
```
|
114
120
|
|
115
|
-
|
116
|
-
|
117
|
-
|
121
|
+
## Response
|
122
|
+
|
123
|
+
The results from queries return either `Success` or `RequestError` which both repsond with Hash like query methods for the JSON data or the Net::HTTP resonse object methods.
|
124
|
+
|
125
|
+
The `Response` classes `Success` and `RequestError` forward method calls for all of the instance methods of a `ResponseCollection` to the collection. And for the actual Net::HTTP response the following methods are forwarded from these classes to it:
|
126
|
+
|
127
|
+
* `#code`
|
128
|
+
* `#code_type`
|
129
|
+
* `#uri`
|
130
|
+
* `#message`
|
131
|
+
* `#read_header`
|
132
|
+
* `#header`
|
133
|
+
* `#value`
|
134
|
+
* `#entity`
|
135
|
+
* `#response`
|
136
|
+
* `#body`
|
137
|
+
* `#decode_content`
|
138
|
+
* `#msg`
|
139
|
+
* `#reading_body`
|
140
|
+
* `#read_body`
|
141
|
+
* `#http_version`
|
142
|
+
* `#connection_close?`
|
143
|
+
* `#connection_keep_alive?`
|
144
|
+
* `#initialize_http_header`
|
145
|
+
* `#get_fields`
|
146
|
+
* `#each_header`
|
147
|
+
|
148
|
+
The keys for the response are displayed with `#inspect` along with the object. Opening up any of the items from its key will produce a [`ResponseCollection`](http://danielpclark.github.io/trav3/Trav3/ResponseCollection.html) object that behaves like both an Array or Hash and has a method to [follow](https://github.com/danielpclark/trav3#follow) response links.
|
149
|
+
|
150
|
+
`ResponseCollection` uniformly implements:
|
151
|
+
|
152
|
+
* `#[]`
|
153
|
+
* `#dig`
|
154
|
+
* `#each`
|
155
|
+
* `#fetch`
|
156
|
+
* `#first`
|
157
|
+
* `#follow`
|
158
|
+
* `#hash?`
|
159
|
+
* `#last`
|
160
|
+
|
161
|
+
Which each behave as they would on the collection type per collection type, `Hash` or `Array`, with the exception of `#each`. `#each` will wrap every item in an `Array` with another `ResponseCollection`, but if it's a `Hash` then `#each` simply works as it normally would on a `Hash`
|
162
|
+
|
163
|
+
`ResponseCollection` also forwards:
|
164
|
+
|
165
|
+
* `#count`
|
166
|
+
* `#keys`
|
167
|
+
* `#values`
|
168
|
+
* `#has_key?`
|
169
|
+
* `#key?`
|
170
|
+
* `empty?`
|
171
|
+
|
172
|
+
to the inner collection.
|
173
|
+
|
174
|
+
## Follow
|
175
|
+
|
176
|
+
Each request returns a `Response` type of either `Success` or `RequestError`.
|
177
|
+
When you have an instance of `Success` each response collection of either `Hash` or `Array` will
|
178
|
+
be an instance of `ResponseCollection`. If the `#hash?` method responds as `true` the `#follow`
|
118
179
|
method will follow any immediate `@href` link provided in the collection. If `#hash?` produces `false`
|
119
180
|
then the collection is an Array of items and you may use the index of the item you want to follow the
|
120
181
|
`@href` with; like so `#follow(3)`.
|
data/lib/trav3.rb
CHANGED
@@ -14,6 +14,68 @@ require 'trav3/rest'
|
|
14
14
|
module Trav3
|
15
15
|
# An abstraction for the Travis CI v3 API
|
16
16
|
#
|
17
|
+
#
|
18
|
+
# You can get started with the following.
|
19
|
+
#
|
20
|
+
# ```ruby
|
21
|
+
# require 'trav3'
|
22
|
+
# project = Trav3::Travis.new("name/example")
|
23
|
+
# ```
|
24
|
+
#
|
25
|
+
# When you instantiate an instance of `Travis`
|
26
|
+
# you get some default headers and default options.
|
27
|
+
#
|
28
|
+
# #### Default Options
|
29
|
+
#
|
30
|
+
# * `limit: 25` - for limiting data queries to 25 items at most
|
31
|
+
#
|
32
|
+
# Options can be changed via the {#options} getter method which will give you a
|
33
|
+
# {Options} instance. All changes to it affect the options that the `Travis`
|
34
|
+
# instance will submit in url requests.
|
35
|
+
#
|
36
|
+
# #### Default Headers
|
37
|
+
#
|
38
|
+
# * `'Content-Type': 'application/json'`
|
39
|
+
# * `'Accept': 'application/json'`
|
40
|
+
# * `'Travis-API-Version': 3`
|
41
|
+
#
|
42
|
+
# Headers can be changed via the {#headers} getter method which will give you a
|
43
|
+
# {Headers} instance. All changes to it affect the headers that the `Travis`
|
44
|
+
# instance will submit in url requests.
|
45
|
+
#
|
46
|
+
# #### General Usage
|
47
|
+
#
|
48
|
+
# ```ruby
|
49
|
+
# project.owner
|
50
|
+
# project.owner("owner")
|
51
|
+
# project.repositories
|
52
|
+
# project.repositories("owner")
|
53
|
+
# project.repository
|
54
|
+
# project.repository("owner/repo")
|
55
|
+
# project.builds
|
56
|
+
# project.build(12345)
|
57
|
+
# project.build_jobs(12345)
|
58
|
+
# project.job(1234)
|
59
|
+
# project.log(1234)
|
60
|
+
#
|
61
|
+
# # API Request Options
|
62
|
+
# project.options.build({limit: 25})
|
63
|
+
#
|
64
|
+
# # Pagination
|
65
|
+
# builds = project.builds
|
66
|
+
# builds.page.next
|
67
|
+
# builds.page.first
|
68
|
+
# builds.page.last
|
69
|
+
#
|
70
|
+
# # Recommended inspection
|
71
|
+
# builds.keys
|
72
|
+
# builds.dig("some_key")
|
73
|
+
#
|
74
|
+
# # Follow `@href`
|
75
|
+
# repositories = project.repositories("owner")['repositories']
|
76
|
+
# repositories.first.follow
|
77
|
+
# ```
|
78
|
+
#
|
17
79
|
# @author Daniel P. Clark https://6ftdan.com
|
18
80
|
# @!attribute [r] api_endpoint
|
19
81
|
# @return [String] API endpoint
|
@@ -113,6 +175,14 @@ module Trav3
|
|
113
175
|
#
|
114
176
|
# Example: GET /owner/danielpclark/active
|
115
177
|
#
|
178
|
+
# ```ruby
|
179
|
+
# # RUBY EXAMPLE
|
180
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
181
|
+
# travis.active
|
182
|
+
# # or
|
183
|
+
# travis.active('danielpclark')
|
184
|
+
# ```
|
185
|
+
#
|
116
186
|
# GET <code>/owner/{user.login}/active</code>
|
117
187
|
#
|
118
188
|
# Template Variable Type Description
|
@@ -122,6 +192,14 @@ module Trav3
|
|
122
192
|
#
|
123
193
|
# Example: GET /owner/danielpclark/active
|
124
194
|
#
|
195
|
+
# ```ruby
|
196
|
+
# # RUBY EXAMPLE
|
197
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
198
|
+
# travis.active
|
199
|
+
# # or
|
200
|
+
# travis.active('danielpclark')
|
201
|
+
# ```
|
202
|
+
#
|
125
203
|
# GET <code>/owner/{organization.login}/active</code>
|
126
204
|
#
|
127
205
|
# Template Variable Type Description
|
@@ -131,6 +209,12 @@ module Trav3
|
|
131
209
|
#
|
132
210
|
# Example: GET /owner/travis-ci/active
|
133
211
|
#
|
212
|
+
# ```ruby
|
213
|
+
# # RUBY EXAMPLE
|
214
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
215
|
+
# travis.active('travis-ci')
|
216
|
+
# ```
|
217
|
+
#
|
134
218
|
# GET <code>/owner/github_id/{owner.github_id}/active</code>
|
135
219
|
#
|
136
220
|
# Template Variable Type Description
|
@@ -140,6 +224,12 @@ module Trav3
|
|
140
224
|
#
|
141
225
|
# Example: GET /owner/github_id/639823/active
|
142
226
|
#
|
227
|
+
# ```ruby
|
228
|
+
# # RUBY EXAMPLE
|
229
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
230
|
+
# travis.active(639_823)
|
231
|
+
# ```
|
232
|
+
#
|
143
233
|
# @param owner [String] username, organization name, or github id
|
144
234
|
# @return [Success, RequestError]
|
145
235
|
def active(owner = username)
|
@@ -184,6 +274,19 @@ module Trav3
|
|
184
274
|
# beta_feature.id Integer Value uniquely identifying the beta feature.
|
185
275
|
# beta_feature.enabled Boolean Indicates if the user has this feature turned on.
|
186
276
|
#
|
277
|
+
# ```ruby
|
278
|
+
# # RUBY EXAMPLE
|
279
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
280
|
+
# travis.api_endpoint = 'https://api.travis-ci.com'
|
281
|
+
# travis.authorization = 'xxxx'
|
282
|
+
#
|
283
|
+
# # Enable comic-sans for user id 119240
|
284
|
+
# travis.beta_feature(:enable, 3, 119_240)
|
285
|
+
#
|
286
|
+
# # Disable comic-sans for user id 119240
|
287
|
+
# travis.beta_feature(:disable, 3, 119_240)
|
288
|
+
# ```
|
289
|
+
#
|
187
290
|
# **Delete**
|
188
291
|
#
|
189
292
|
# This will delete a user's beta feature.
|
@@ -194,6 +297,16 @@ module Trav3
|
|
194
297
|
# user.id Integer Value uniquely identifying the user.
|
195
298
|
# beta_feature.id Integer Value uniquely identifying the beta feature.
|
196
299
|
#
|
300
|
+
# ```ruby
|
301
|
+
# # RUBY EXAMPLE
|
302
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
303
|
+
# travis.api_endpoint = 'https://api.travis-ci.com'
|
304
|
+
# travis.authorization = 'xxxx'
|
305
|
+
#
|
306
|
+
# # Disable comic-sans via delete for user id 119240
|
307
|
+
# travis.beta_feature(:delete, 3, 119_240)
|
308
|
+
# ```
|
309
|
+
#
|
197
310
|
# @param action [Symbol] either `:enable`, `:disable` or `:delete`
|
198
311
|
# @param beta_feature_id [String, Integer] id for the beta feature
|
199
312
|
# @param user_id [String] user id
|
@@ -233,6 +346,12 @@ module Trav3
|
|
233
346
|
#
|
234
347
|
# Example: GET /user/119240/beta_features
|
235
348
|
#
|
349
|
+
# ```ruby
|
350
|
+
# # RUBY EXAMPLE
|
351
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
352
|
+
# travis.beta_features(119_240)
|
353
|
+
# ```
|
354
|
+
#
|
236
355
|
# @note requests require an authorization token set in the headers. See: {authorization=}
|
237
356
|
#
|
238
357
|
# @param user_id [String, Integer] user id
|
@@ -288,6 +407,12 @@ module Trav3
|
|
288
407
|
#
|
289
408
|
# Example: GET /repo/891/branch/master
|
290
409
|
#
|
410
|
+
# ```ruby
|
411
|
+
# # RUBY EXAMPLE
|
412
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
413
|
+
# travis.branch('master')
|
414
|
+
# ```
|
415
|
+
#
|
291
416
|
# GET <code>/repo/{repository.slug}/branch/{branch.name}</code>
|
292
417
|
#
|
293
418
|
# Template Variable Type Description
|
@@ -298,6 +423,12 @@ module Trav3
|
|
298
423
|
#
|
299
424
|
# Example: GET /repo/rails%2Frails/branch/master
|
300
425
|
#
|
426
|
+
# ```ruby
|
427
|
+
# # RUBY EXAMPLE
|
428
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
429
|
+
# travis.branch('master')
|
430
|
+
# ```
|
431
|
+
#
|
301
432
|
# @param name [String] the branch name for the current repository
|
302
433
|
# @return [Success, RequestError]
|
303
434
|
def branch(name)
|
@@ -348,6 +479,13 @@ module Trav3
|
|
348
479
|
# **Sortable by:** <code>name</code>, <code>last_build</code>, <code>exists_on_github</code>, <code>default_branch</code>, append <code>:desc</code> to any attribute to reverse order.
|
349
480
|
# The default value is <code>default_branch</code>,<code>exists_on_github</code>,<code>last_build:desc</code>.
|
350
481
|
#
|
482
|
+
# ```ruby
|
483
|
+
# # RUBY EXAMPLE
|
484
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
485
|
+
# travis.options.build({limit: 5, exists_on_github: true})
|
486
|
+
# travis.branches
|
487
|
+
# ```
|
488
|
+
#
|
351
489
|
# GET <code>/repo/{repository.slug}/branches</code>
|
352
490
|
#
|
353
491
|
# Template Variable Type Description
|
@@ -365,6 +503,13 @@ module Trav3
|
|
365
503
|
# **Sortable by:** <code>name</code>, <code>last_build</code>, <code>exists_on_github</code>, <code>default_branch</code>, append <code>:desc</code> to any attribute to reverse order.
|
366
504
|
# The default value is <code>default_branch</code>,<code>exists_on_github</code>,<code>last_build:desc</code>.
|
367
505
|
#
|
506
|
+
# ```ruby
|
507
|
+
# # RUBY EXAMPLE
|
508
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
509
|
+
# travis.options.build({limit: 5, exists_on_github: true})
|
510
|
+
# travis.branches
|
511
|
+
# ```
|
512
|
+
#
|
368
513
|
# @return [Success, RequestError]
|
369
514
|
def branches
|
370
515
|
get("#{with_repo}/branches#{opts}")
|
@@ -404,6 +549,13 @@ module Trav3
|
|
404
549
|
#
|
405
550
|
# Example: GET /broadcasts
|
406
551
|
#
|
552
|
+
# ```ruby
|
553
|
+
# # RUBY EXAMPLE
|
554
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
555
|
+
# travis.authorization = 'xxxx'
|
556
|
+
# travis.broadcasts
|
557
|
+
# ```
|
558
|
+
#
|
407
559
|
# @note requests require an authorization token set in the headers. See: {authorization=}
|
408
560
|
#
|
409
561
|
# @return [Success, RequestError]
|
@@ -471,6 +623,12 @@ module Trav3
|
|
471
623
|
#
|
472
624
|
# Example: GET /build/86601346
|
473
625
|
#
|
626
|
+
# ```ruby
|
627
|
+
# # RUBY EXAMPLE
|
628
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
629
|
+
# travis.build(351_778_872)
|
630
|
+
# ```
|
631
|
+
#
|
474
632
|
# **Cancel**
|
475
633
|
#
|
476
634
|
# This cancels a currently running build. It will set the build and associated jobs to "state": "canceled".
|
@@ -482,6 +640,13 @@ module Trav3
|
|
482
640
|
#
|
483
641
|
# Example: POST /build/86601346/cancel
|
484
642
|
#
|
643
|
+
# ```ruby
|
644
|
+
# # RUBY EXAMPLE
|
645
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
646
|
+
# travis.authorization = 'xxxx'
|
647
|
+
# travis.build(478_772_528, :cancel)
|
648
|
+
# ```
|
649
|
+
#
|
485
650
|
# **Restart**
|
486
651
|
#
|
487
652
|
# This restarts a build that has completed or been canceled.
|
@@ -493,6 +658,13 @@ module Trav3
|
|
493
658
|
#
|
494
659
|
# Example: POST /build/86601346/restart
|
495
660
|
#
|
661
|
+
# ```ruby
|
662
|
+
# # RUBY EXAMPLE
|
663
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
664
|
+
# travis.authorization = 'xxxx'
|
665
|
+
# travis.build(478_772_528, :restart)
|
666
|
+
# ```
|
667
|
+
#
|
496
668
|
# @note POST requests require an authorization token set in the headers. See: {authorization=}
|
497
669
|
#
|
498
670
|
# @param build_id [String, Integer] the build id number
|
@@ -565,6 +737,14 @@ module Trav3
|
|
565
737
|
#
|
566
738
|
# **Sortable by:** <code>id</code>, <code>started_at</code>, <code>finished_at</code>, append <code>:desc</code> to any attribute to reverse order.
|
567
739
|
#
|
740
|
+
# ```ruby
|
741
|
+
# # RUBY EXAMPLE
|
742
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
743
|
+
# travis.authorization = 'xxxx'
|
744
|
+
# travis.options.build({limit: 5})
|
745
|
+
# travis.builds(false)
|
746
|
+
# ```
|
747
|
+
#
|
568
748
|
# **Find**
|
569
749
|
#
|
570
750
|
# This returns a list of builds for an individual repository. It is possible to use the repository id or slug in the request. The result is paginated. Each request will return 25 results.
|
@@ -593,6 +773,13 @@ module Trav3
|
|
593
773
|
#
|
594
774
|
# **Sortable by:** <code>id</code>, <code>started_at</code>, <code>finished_at</code>, append <code>:desc</code> to any attribute to reverse order.
|
595
775
|
#
|
776
|
+
# ```ruby
|
777
|
+
# # RUBY EXAMPLE
|
778
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
779
|
+
# travis.options.build({limit: 5})
|
780
|
+
# travis.builds
|
781
|
+
# ```
|
782
|
+
#
|
596
783
|
# GET <code>/repo/{repository.slug}/builds</code>
|
597
784
|
#
|
598
785
|
# Template Variable Type Description
|
@@ -617,9 +804,20 @@ module Trav3
|
|
617
804
|
#
|
618
805
|
# **Sortable by:** <code>id</code>, <code>started_at</code>, <code>finished_at</code>, append <code>:desc</code> to any attribute to reverse order.
|
619
806
|
#
|
807
|
+
# ```ruby
|
808
|
+
# # RUBY EXAMPLE
|
809
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
810
|
+
# travis.options.build({limit: 5})
|
811
|
+
# travis.builds
|
812
|
+
# ```
|
813
|
+
#
|
814
|
+
# @note requests may require an authorization token set in the headers. See: {authorization=}
|
815
|
+
#
|
816
|
+
# @param repo [Boolean] If true get repo builds, otherwise get user builds
|
620
817
|
# @return [Success, RequestError]
|
621
|
-
def builds
|
622
|
-
get("#{with_repo}/builds#{opts}")
|
818
|
+
def builds(repo = true)
|
819
|
+
repo and return get("#{with_repo}/builds#{opts}")
|
820
|
+
get("#{without_repo}/builds#{opts}")
|
623
821
|
end
|
624
822
|
|
625
823
|
# A list of jobs.
|
@@ -666,6 +864,12 @@ module Trav3
|
|
666
864
|
#
|
667
865
|
# Example: GET /build/86601346/jobs
|
668
866
|
#
|
867
|
+
# ```ruby
|
868
|
+
# # RUBY EXAMPLE
|
869
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
870
|
+
# travis.build_jobs(86_601_346)
|
871
|
+
# ```
|
872
|
+
#
|
669
873
|
# **For Current User**
|
670
874
|
#
|
671
875
|
# This returns a list of jobs a current user has access to.
|
@@ -689,10 +893,21 @@ module Trav3
|
|
689
893
|
# **Sortable by:** <code>id</code>, append <code>:desc</code> to any attribute to reverse order.
|
690
894
|
# The default value is id:desc.
|
691
895
|
#
|
692
|
-
#
|
896
|
+
# ```ruby
|
897
|
+
# # RUBY EXAMPLE
|
898
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
899
|
+
# travis.authorization = 'xxxx'
|
900
|
+
# travis.options.build({limit: 5})
|
901
|
+
# travis.build_jobs(false)
|
902
|
+
# ```
|
903
|
+
#
|
904
|
+
# @note requests may require an authorization token set in the headers. See: {authorization=}
|
905
|
+
#
|
906
|
+
# @param build_id [String, Integer, Boolean] the build id number. If falsey then get all jobs for current user
|
693
907
|
# @return [Success, RequestError]
|
694
908
|
def build_jobs(build_id)
|
695
|
-
get("#{without_repo}/build/#{build_id}/jobs")
|
909
|
+
build_id and return get("#{without_repo}/build/#{build_id}/jobs")
|
910
|
+
get("#{without_repo}/jobs#{opts}")
|
696
911
|
end
|
697
912
|
|
698
913
|
# A list of caches.
|
@@ -721,6 +936,14 @@ module Trav3
|
|
721
936
|
# https://api.travis-ci.com/repo/1234/caches?branch=master
|
722
937
|
# ```
|
723
938
|
#
|
939
|
+
# ```ruby
|
940
|
+
# # RUBY EXAMPLE
|
941
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
942
|
+
# travis.authorization = 'xxxx'
|
943
|
+
# travis.options.build({branch: :master})
|
944
|
+
# travis.caches
|
945
|
+
# ```
|
946
|
+
#
|
724
947
|
# ```bash
|
725
948
|
# curl \
|
726
949
|
# -H "Content-Type: application/json" \
|
@@ -729,6 +952,14 @@ module Trav3
|
|
729
952
|
# https://api.travis-ci.com/repo/1234/caches?match=linux
|
730
953
|
# ```
|
731
954
|
#
|
955
|
+
# ```ruby
|
956
|
+
# # RUBY EXAMPLE
|
957
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
958
|
+
# travis.authorization = 'xxxx'
|
959
|
+
# travis.options.build({match: :linux})
|
960
|
+
# travis.caches
|
961
|
+
# ```
|
962
|
+
#
|
732
963
|
# GET <code>/repo/{repository.id}/caches</code>
|
733
964
|
#
|
734
965
|
# Template Variable Type Description
|
@@ -769,6 +1000,14 @@ module Trav3
|
|
769
1000
|
# https://api.travis-ci.com/repo/1234/caches?branch=master
|
770
1001
|
# ```
|
771
1002
|
#
|
1003
|
+
# ```ruby
|
1004
|
+
# # RUBY EXAMPLE
|
1005
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
1006
|
+
# travis.authorization = 'xxxx'
|
1007
|
+
# travis.options.build({branch: :master})
|
1008
|
+
# travis.caches(:delete)
|
1009
|
+
# ```
|
1010
|
+
#
|
772
1011
|
# DELETE <code>/repo/{repository.id}/caches</code>
|
773
1012
|
#
|
774
1013
|
# Template Variable Type Description
|
@@ -788,8 +1027,10 @@ module Trav3
|
|
788
1027
|
# @param delete [Boolean] option for deleting cache(s)
|
789
1028
|
# @return [Success, RequestError]
|
790
1029
|
def caches(delete = false)
|
791
|
-
|
792
|
-
|
1030
|
+
without_limit do
|
1031
|
+
delete and return delete("#{with_repo}/caches#{opts}")
|
1032
|
+
get("#{with_repo}/caches#{opts}")
|
1033
|
+
end
|
793
1034
|
end
|
794
1035
|
|
795
1036
|
# An individual cron. There can be only one cron per branch on a repository.
|
@@ -833,6 +1074,13 @@ module Trav3
|
|
833
1074
|
# Query Parameter Type Description
|
834
1075
|
# include [String] List of attributes to eager load.
|
835
1076
|
#
|
1077
|
+
# ```ruby
|
1078
|
+
# # RUBY EXAMPLE
|
1079
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
1080
|
+
# travis.authorization = 'xxxx'
|
1081
|
+
# travis.cron(id: 78_199)
|
1082
|
+
# ```
|
1083
|
+
#
|
836
1084
|
# **Delete**
|
837
1085
|
#
|
838
1086
|
# This deletes a single cron.
|
@@ -842,6 +1090,13 @@ module Trav3
|
|
842
1090
|
# Template Variable Type Description
|
843
1091
|
# cron.id Integer Value uniquely identifying the cron.
|
844
1092
|
#
|
1093
|
+
# ```ruby
|
1094
|
+
# # RUBY EXAMPLE
|
1095
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
1096
|
+
# travis.authorization = 'xxxx'
|
1097
|
+
# travis.cron(id: 78_199, delete: true)
|
1098
|
+
# ```
|
1099
|
+
#
|
845
1100
|
# **For Branch**
|
846
1101
|
#
|
847
1102
|
# This returns the cron set for the specified branch for the specified repository. It is possible to use the repository id or slug in the request.
|
@@ -856,6 +1111,13 @@ module Trav3
|
|
856
1111
|
#
|
857
1112
|
# Example: GET /repo/891/branch/master/cron
|
858
1113
|
#
|
1114
|
+
# ```ruby
|
1115
|
+
# # RUBY EXAMPLE
|
1116
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
1117
|
+
# travis.authorization = 'xxxx'
|
1118
|
+
# travis.cron(branch_name: 'master')
|
1119
|
+
# ```
|
1120
|
+
#
|
859
1121
|
# GET <code>/repo/{repository.slug}/branch/{branch.name}/cron</code>
|
860
1122
|
#
|
861
1123
|
# Template Variable Type Description
|
@@ -866,6 +1128,13 @@ module Trav3
|
|
866
1128
|
#
|
867
1129
|
# Example: GET /repo/rails%2Frails/branch/master/cron
|
868
1130
|
#
|
1131
|
+
# ```ruby
|
1132
|
+
# # RUBY EXAMPLE
|
1133
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
1134
|
+
# travis.authorization = 'xxxx'
|
1135
|
+
# travis.cron(branch_name: 'master')
|
1136
|
+
# ```
|
1137
|
+
#
|
869
1138
|
# **Create**
|
870
1139
|
#
|
871
1140
|
# This creates a cron on the specified branch for the specified repository. It is possible to use the repository id or slug in the request. Content-Type MUST be set in the header and an interval for the cron MUST be specified as a parameter.
|
@@ -879,6 +1148,13 @@ module Trav3
|
|
879
1148
|
# https://api.travis-ci.com/repo/1234/branch/master/cron
|
880
1149
|
# ```
|
881
1150
|
#
|
1151
|
+
# ```ruby
|
1152
|
+
# # RUBY EXAMPLE
|
1153
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
1154
|
+
# travis.authorization = 'xxxx'
|
1155
|
+
# travis.cron(branch_name: 'master', create: { 'interval' => 'monthly' })
|
1156
|
+
# ```
|
1157
|
+
#
|
882
1158
|
# POST <code>/repo/{repository.id}/branch/{branch.name}/cron</code>
|
883
1159
|
#
|
884
1160
|
# Template Variable Type Description
|
@@ -960,6 +1236,14 @@ module Trav3
|
|
960
1236
|
#
|
961
1237
|
# Example: GET /repo/891/crons?limit=5
|
962
1238
|
#
|
1239
|
+
# ```ruby
|
1240
|
+
# # RUBY EXAMPLE
|
1241
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
1242
|
+
# travis.authorization = 'xxxx'
|
1243
|
+
# travis.options.build({limit: 5})
|
1244
|
+
# travis.crons
|
1245
|
+
# ```
|
1246
|
+
#
|
963
1247
|
# GET <code>/repo/{repository.slug}/crons</code>
|
964
1248
|
#
|
965
1249
|
# Template Variable Type Description
|
@@ -971,9 +1255,17 @@ module Trav3
|
|
971
1255
|
#
|
972
1256
|
# Example: GET /repo/rails%2Frails/crons?limit=5
|
973
1257
|
#
|
1258
|
+
# ```ruby
|
1259
|
+
# # RUBY EXAMPLE
|
1260
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
1261
|
+
# travis.authorization = 'xxxx'
|
1262
|
+
# travis.options.build({limit: 5})
|
1263
|
+
# travis.crons
|
1264
|
+
# ```
|
1265
|
+
#
|
974
1266
|
# @return [Success, RequestError]
|
975
1267
|
def crons
|
976
|
-
get("#{with_repo}/crons")
|
1268
|
+
get("#{with_repo}/crons#{opts}")
|
977
1269
|
end
|
978
1270
|
|
979
1271
|
# POST <code>/repo/{repository.id}/email_subscription</code>
|
@@ -983,6 +1275,13 @@ module Trav3
|
|
983
1275
|
#
|
984
1276
|
# Example: POST /repo/891/email_subscription
|
985
1277
|
#
|
1278
|
+
# ```ruby
|
1279
|
+
# # RUBY EXAMPLE
|
1280
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
1281
|
+
# travis.authorization = 'xxxx'
|
1282
|
+
# travis.email_resubscribe
|
1283
|
+
# ```
|
1284
|
+
#
|
986
1285
|
# POST <code>/repo/{repository.slug}/email_subscription</code>
|
987
1286
|
#
|
988
1287
|
# Template Variable Type Description
|
@@ -990,6 +1289,13 @@ module Trav3
|
|
990
1289
|
#
|
991
1290
|
# Example: POST /repo/rails%2Frails/email_subscription
|
992
1291
|
#
|
1292
|
+
# ```ruby
|
1293
|
+
# # RUBY EXAMPLE
|
1294
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
1295
|
+
# travis.authorization = 'xxxx'
|
1296
|
+
# travis.email_resubscribe
|
1297
|
+
# ```
|
1298
|
+
#
|
993
1299
|
# @note requests require an authorization token set in the headers. See: {authorization=}
|
994
1300
|
#
|
995
1301
|
# @return [Success, RequestError]
|
@@ -1004,6 +1310,13 @@ module Trav3
|
|
1004
1310
|
#
|
1005
1311
|
# Example: DELETE /repo/891/email_subscription
|
1006
1312
|
#
|
1313
|
+
# ```ruby
|
1314
|
+
# # RUBY EXAMPLE
|
1315
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
1316
|
+
# travis.authorization = 'xxxx'
|
1317
|
+
# travis.email_unsubscribe
|
1318
|
+
# ```
|
1319
|
+
#
|
1007
1320
|
# DELETE <code>/repo/{repository.slug}/email_subscription</code>
|
1008
1321
|
#
|
1009
1322
|
# Template Variable Type Description
|
@@ -1011,6 +1324,13 @@ module Trav3
|
|
1011
1324
|
#
|
1012
1325
|
# Example: DELETE /repo/rails%2Frails/email_subscription
|
1013
1326
|
#
|
1327
|
+
# ```ruby
|
1328
|
+
# # RUBY EXAMPLE
|
1329
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
1330
|
+
# travis.authorization = 'xxxx'
|
1331
|
+
# travis.email_unsubscribe
|
1332
|
+
# ```
|
1333
|
+
#
|
1014
1334
|
# @note requests require an authorization token set in the headers. See: {authorization=}
|
1015
1335
|
#
|
1016
1336
|
# @return [Success, RequestError]
|
@@ -1060,6 +1380,13 @@ module Trav3
|
|
1060
1380
|
# include [String] List of attributes to eager load.
|
1061
1381
|
# repository.id Integer Value uniquely identifying the repository.
|
1062
1382
|
#
|
1383
|
+
# ```ruby
|
1384
|
+
# # RUBY EXAMPLE
|
1385
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
1386
|
+
# travis.authorization = 'xxxx'
|
1387
|
+
# travis.env_var('76f9d8bd-642d-47ed-9f35-4c25eb030c6c')
|
1388
|
+
# ```
|
1389
|
+
#
|
1063
1390
|
# GET <code>/repo/{repository.slug}/env_var/{env_var.id}</code>
|
1064
1391
|
#
|
1065
1392
|
# Template Variable Type Description
|
@@ -1071,6 +1398,13 @@ module Trav3
|
|
1071
1398
|
# include [String] List of attributes to eager load.
|
1072
1399
|
# repository.id Integer Value uniquely identifying the repository.
|
1073
1400
|
#
|
1401
|
+
# ```ruby
|
1402
|
+
# # RUBY EXAMPLE
|
1403
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
1404
|
+
# travis.authorization = 'xxxx'
|
1405
|
+
# travis.env_var('76f9d8bd-642d-47ed-9f35-4c25eb030c6c')
|
1406
|
+
# ```
|
1407
|
+
#
|
1074
1408
|
# **Update**
|
1075
1409
|
#
|
1076
1410
|
# This updates a single environment variable. It is possible to use the repository id or slug in the request.
|
@@ -1086,6 +1420,13 @@ module Trav3
|
|
1086
1420
|
# https://api.travis-ci.com/repo/1234/{env_var.id}
|
1087
1421
|
# ```
|
1088
1422
|
#
|
1423
|
+
# ```ruby
|
1424
|
+
# # RUBY EXAMPLE
|
1425
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
1426
|
+
# travis.authorization = 'xxxx'
|
1427
|
+
# travis.env_var('76f9d8bd-642d-47ed-9f35-4c25eb030c6c', update: { value: 'bar', public: false })
|
1428
|
+
# ```
|
1429
|
+
#
|
1089
1430
|
# PATCH <code>/repo/{repository.id}/env_var/{env_var.id}</code>
|
1090
1431
|
#
|
1091
1432
|
# Template Variable Type Description
|
@@ -1116,12 +1457,26 @@ module Trav3
|
|
1116
1457
|
# repository.id Integer Value uniquely identifying the repository.
|
1117
1458
|
# env_var.id String The environment variable id.
|
1118
1459
|
#
|
1460
|
+
# ```ruby
|
1461
|
+
# # RUBY EXAMPLE
|
1462
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
1463
|
+
# travis.authorization = 'xxxx'
|
1464
|
+
# travis.env_var('76f9d8bd-642d-47ed-9f35-4c25eb030c6c', delete: true)
|
1465
|
+
# ```
|
1466
|
+
#
|
1119
1467
|
# DELETE <code>/repo/{repository.slug}/env_var/{env_var.id}</code>
|
1120
1468
|
#
|
1121
1469
|
# Template Variable Type Description
|
1122
1470
|
# repository.slug String Same as {repository.owner.name}/{repository.name}.
|
1123
1471
|
# env_var.id String The environment variable id.
|
1124
1472
|
#
|
1473
|
+
# ```ruby
|
1474
|
+
# # RUBY EXAMPLE
|
1475
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
1476
|
+
# travis.authorization = 'xxxx'
|
1477
|
+
# travis.env_var('76f9d8bd-642d-47ed-9f35-4c25eb030c6c', delete: true)
|
1478
|
+
# ```
|
1479
|
+
#
|
1125
1480
|
# @overload env_var(env_var_id)
|
1126
1481
|
# Gets current env var
|
1127
1482
|
# @param env_var_id [String] environment variable id
|
@@ -1165,6 +1520,13 @@ module Trav3
|
|
1165
1520
|
#
|
1166
1521
|
# Example: GET /repo/891/env_vars
|
1167
1522
|
#
|
1523
|
+
# ```ruby
|
1524
|
+
# # RUBY EXAMPLE
|
1525
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
1526
|
+
# travis.authorization = 'xxxx'
|
1527
|
+
# travis.env_vars
|
1528
|
+
# ```
|
1529
|
+
#
|
1168
1530
|
# GET <code>/repo/{repository.slug}/env_vars</code>
|
1169
1531
|
#
|
1170
1532
|
# Template Variable Type Description
|
@@ -1174,6 +1536,13 @@ module Trav3
|
|
1174
1536
|
#
|
1175
1537
|
# Example: GET /repo/rails%2Frails/env_vars
|
1176
1538
|
#
|
1539
|
+
# ```ruby
|
1540
|
+
# # RUBY EXAMPLE
|
1541
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
1542
|
+
# travis.authorization = 'xxxx'
|
1543
|
+
# travis.env_vars
|
1544
|
+
# ```
|
1545
|
+
#
|
1177
1546
|
# **Create**
|
1178
1547
|
#
|
1179
1548
|
# This creates an environment variable for an individual repository. It is possible to use the repository id or slug in the request.
|
@@ -1189,6 +1558,13 @@ module Trav3
|
|
1189
1558
|
# https://api.travis-ci.com/repo/1234/env_vars
|
1190
1559
|
# ```
|
1191
1560
|
#
|
1561
|
+
# ```ruby
|
1562
|
+
# # RUBY EXAMPLE
|
1563
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
1564
|
+
# travis.authorization = 'xxxx'
|
1565
|
+
# travis.env_vars(name: 'FOO', value: 'bar', public: false)
|
1566
|
+
# ```
|
1567
|
+
#
|
1192
1568
|
# POST <code>/repo/{repository.id}/env_vars</code>
|
1193
1569
|
#
|
1194
1570
|
# Template Variable Type Description
|
@@ -1254,6 +1630,14 @@ module Trav3
|
|
1254
1630
|
# Query Parameter Type Description
|
1255
1631
|
# include [String] List of attributes to eager load.
|
1256
1632
|
#
|
1633
|
+
# ```ruby
|
1634
|
+
# # RUBY EXAMPLE
|
1635
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
1636
|
+
# travis.api_endpoint = 'https://api.travis-ci.com'
|
1637
|
+
# travis.authorization = 'xxxx'
|
1638
|
+
# travis.installation(617_754)
|
1639
|
+
# ```
|
1640
|
+
#
|
1257
1641
|
# @param installation_id [String, Integer] GitHub App installation id
|
1258
1642
|
# @return [Success, RequestError]
|
1259
1643
|
def installation(installation_id)
|
@@ -1309,6 +1693,13 @@ module Trav3
|
|
1309
1693
|
#
|
1310
1694
|
# Example: GET /job/86601347
|
1311
1695
|
#
|
1696
|
+
# ```ruby
|
1697
|
+
# # RUBY EXAMPLE
|
1698
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
1699
|
+
# travis.authorization = 'xxxx'
|
1700
|
+
# travis.job(351_778_875)
|
1701
|
+
# ```
|
1702
|
+
#
|
1312
1703
|
# **Cancel**
|
1313
1704
|
#
|
1314
1705
|
# This cancels a currently running job.
|
@@ -1320,6 +1711,13 @@ module Trav3
|
|
1320
1711
|
#
|
1321
1712
|
# Example: POST /job/86601347/cancel
|
1322
1713
|
#
|
1714
|
+
# ```ruby
|
1715
|
+
# # RUBY EXAMPLE
|
1716
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
1717
|
+
# travis.authorization = 'xxxx'
|
1718
|
+
# travis.job(351_778_875, :cancel)
|
1719
|
+
# ```
|
1720
|
+
#
|
1323
1721
|
# **Restart**
|
1324
1722
|
#
|
1325
1723
|
# This restarts a job that has completed or been canceled.
|
@@ -1331,6 +1729,13 @@ module Trav3
|
|
1331
1729
|
#
|
1332
1730
|
# Example: POST /job/86601347/restart
|
1333
1731
|
#
|
1732
|
+
# ```ruby
|
1733
|
+
# # RUBY EXAMPLE
|
1734
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
1735
|
+
# travis.authorization = 'xxxx'
|
1736
|
+
# travis.job(351_778_875, :restart)
|
1737
|
+
# ```
|
1738
|
+
#
|
1334
1739
|
# **Debug**
|
1335
1740
|
#
|
1336
1741
|
# This restarts a job in debug mode, enabling the logged-in user to ssh into the build VM. Please note this feature is only available on the travis-ci.com domain, and those repositories on the travis-ci.org domain for which the debug feature is enabled. See this document for more details.
|
@@ -1342,7 +1747,16 @@ module Trav3
|
|
1342
1747
|
#
|
1343
1748
|
# Example: POST /job/86601347/debug
|
1344
1749
|
#
|
1750
|
+
# ```ruby
|
1751
|
+
# # RUBY EXAMPLE
|
1752
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
1753
|
+
# travis.api_endpoint = 'https://api.travis-ci.com'
|
1754
|
+
# travis.authorization = 'xxxx'
|
1755
|
+
# travis.job(351_778_875, :debug)
|
1756
|
+
# ```
|
1757
|
+
#
|
1345
1758
|
# @note POST requests require an authorization token set in the headers. See: {authorization=}
|
1759
|
+
# @note **Debug** is only available on the travis-ci.com domain, and those repositories on the travis-ci.org domain for which the debug feature is enabled.
|
1346
1760
|
#
|
1347
1761
|
# @param job_id [String, Integer] the job id number
|
1348
1762
|
# @param option [Symbol] options for :cancel, :restart, or :debug
|
@@ -1399,6 +1813,14 @@ module Trav3
|
|
1399
1813
|
#
|
1400
1814
|
# Example: GET /repo/891/key_pair
|
1401
1815
|
#
|
1816
|
+
# ```ruby
|
1817
|
+
# # RUBY EXAMPLE
|
1818
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
1819
|
+
# travis.api_endpoint = 'https://api.travis-ci.com'
|
1820
|
+
# travis.authorization = 'xxxx'
|
1821
|
+
# travis.key_pair
|
1822
|
+
# ```
|
1823
|
+
#
|
1402
1824
|
# GET <code>/repo/{repository.slug}/key_pair</code>
|
1403
1825
|
#
|
1404
1826
|
# Template Variable Type Description
|
@@ -1408,6 +1830,14 @@ module Trav3
|
|
1408
1830
|
#
|
1409
1831
|
# Example: GET /repo/rails%2Frails/key_pair
|
1410
1832
|
#
|
1833
|
+
# ```ruby
|
1834
|
+
# # RUBY EXAMPLE
|
1835
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
1836
|
+
# travis.api_endpoint = 'https://api.travis-ci.com'
|
1837
|
+
# travis.authorization = 'xxxx'
|
1838
|
+
# travis.key_pair
|
1839
|
+
# ```
|
1840
|
+
#
|
1411
1841
|
# **Create**
|
1412
1842
|
#
|
1413
1843
|
# Creates a new key pair.
|
@@ -1421,6 +1851,14 @@ module Trav3
|
|
1421
1851
|
# https://api.travis-ci.com/repo/1234/key_pair
|
1422
1852
|
# ```
|
1423
1853
|
#
|
1854
|
+
# ```ruby
|
1855
|
+
# # RUBY EXAMPLE
|
1856
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
1857
|
+
# travis.api_endpoint = 'https://api.travis-ci.com'
|
1858
|
+
# travis.authorization = 'xxxx'
|
1859
|
+
# travis.key_pair(create: { description: 'FooBar', value: OpenSSL::PKey::RSA.generate(2048).to_s })
|
1860
|
+
# ```
|
1861
|
+
#
|
1424
1862
|
# POST <code>/repo/{repository.id}/key_pair</code>
|
1425
1863
|
#
|
1426
1864
|
# Template Variable Type Description
|
@@ -1454,6 +1892,14 @@ module Trav3
|
|
1454
1892
|
# https://api.travis-ci.com/repo/1234/key_pair
|
1455
1893
|
# ```
|
1456
1894
|
#
|
1895
|
+
# ```ruby
|
1896
|
+
# # RUBY EXAMPLE
|
1897
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
1898
|
+
# travis.api_endpoint = 'https://api.travis-ci.com'
|
1899
|
+
# travis.authorization = 'xxxx'
|
1900
|
+
# travis.key_pair(update: { description: 'FooBarBaz' })
|
1901
|
+
# ```
|
1902
|
+
#
|
1457
1903
|
# PATCH <code>/repo/{repository.id}/key_pair</code>
|
1458
1904
|
#
|
1459
1905
|
# Template Variable Type Description
|
@@ -1485,6 +1931,14 @@ module Trav3
|
|
1485
1931
|
#
|
1486
1932
|
# Example: DELETE /repo/891/key_pair
|
1487
1933
|
#
|
1934
|
+
# ```ruby
|
1935
|
+
# # RUBY EXAMPLE
|
1936
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
1937
|
+
# travis.api_endpoint = 'https://api.travis-ci.com'
|
1938
|
+
# travis.authorization = 'xxxx'
|
1939
|
+
# travis.key_pair(delete: true)
|
1940
|
+
# ```
|
1941
|
+
#
|
1488
1942
|
# DELETE <code>/repo/{repository.slug}/key_pair</code>
|
1489
1943
|
#
|
1490
1944
|
# Template Variable Type Description
|
@@ -1492,6 +1946,14 @@ module Trav3
|
|
1492
1946
|
#
|
1493
1947
|
# Example: DELETE /repo/rails%2Frails/key_pair
|
1494
1948
|
#
|
1949
|
+
# ```ruby
|
1950
|
+
# # RUBY EXAMPLE
|
1951
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
1952
|
+
# travis.api_endpoint = 'https://api.travis-ci.com'
|
1953
|
+
# travis.authorization = 'xxxx'
|
1954
|
+
# travis.key_pair(delete: true)
|
1955
|
+
# ```
|
1956
|
+
#
|
1495
1957
|
# @note requests require an authorization token set in the headers. See: {authorization=}
|
1496
1958
|
# @note API enpoint needs to be set to `https://api.travis-ci.com` See: {api_endpoint=}
|
1497
1959
|
#
|
@@ -1551,6 +2013,14 @@ module Trav3
|
|
1551
2013
|
#
|
1552
2014
|
# Example: GET /repo/891/key_pair/generated
|
1553
2015
|
#
|
2016
|
+
# ```ruby
|
2017
|
+
# # RUBY EXAMPLE
|
2018
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
2019
|
+
# travis.api_endpoint = 'https://api.travis-ci.com'
|
2020
|
+
# travis.authorization = 'xxxx'
|
2021
|
+
# travis.key_pair_generated
|
2022
|
+
# ```
|
2023
|
+
#
|
1554
2024
|
# GET <code>/repo/{repository.slug}/key_pair/generated</code>
|
1555
2025
|
#
|
1556
2026
|
# Template Variable Type Description
|
@@ -1560,6 +2030,14 @@ module Trav3
|
|
1560
2030
|
#
|
1561
2031
|
# Example: GET /repo/rails%2Frails/key_pair/generated
|
1562
2032
|
#
|
2033
|
+
# ```ruby
|
2034
|
+
# # RUBY EXAMPLE
|
2035
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
2036
|
+
# travis.api_endpoint = 'https://api.travis-ci.com'
|
2037
|
+
# travis.authorization = 'xxxx'
|
2038
|
+
# travis.key_pair_generated
|
2039
|
+
# ```
|
2040
|
+
#
|
1563
2041
|
# **Create**
|
1564
2042
|
#
|
1565
2043
|
# Generate a new key pair, replacing the previous one.
|
@@ -1571,6 +2049,14 @@ module Trav3
|
|
1571
2049
|
#
|
1572
2050
|
# Example: POST /repo/891/key_pair/generated
|
1573
2051
|
#
|
2052
|
+
# ```ruby
|
2053
|
+
# # RUBY EXAMPLE
|
2054
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
2055
|
+
# travis.api_endpoint = 'https://api.travis-ci.com'
|
2056
|
+
# travis.authorization = 'xxxx'
|
2057
|
+
# travis.key_pair_generated(:create)
|
2058
|
+
# ```
|
2059
|
+
#
|
1574
2060
|
# POST <code>/repo/{repository.slug}/key_pair/generated</code>
|
1575
2061
|
#
|
1576
2062
|
# Template Variable Type Description
|
@@ -1578,6 +2064,14 @@ module Trav3
|
|
1578
2064
|
#
|
1579
2065
|
# Example: POST /repo/rails%2Frails/key_pair/generated
|
1580
2066
|
#
|
2067
|
+
# ```ruby
|
2068
|
+
# # RUBY EXAMPLE
|
2069
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
2070
|
+
# travis.api_endpoint = 'https://api.travis-ci.com'
|
2071
|
+
# travis.authorization = 'xxxx'
|
2072
|
+
# travis.key_pair_generated(:create)
|
2073
|
+
# ```
|
2074
|
+
#
|
1581
2075
|
# @note requests require an authorization token set in the headers. See: {authorization=}
|
1582
2076
|
#
|
1583
2077
|
# @param action [String, Symbol] defaults to getting current key pair, use `:create` if you would like to generate a new key pair
|
@@ -1605,6 +2099,12 @@ module Trav3
|
|
1605
2099
|
#
|
1606
2100
|
# Example: POST /lint
|
1607
2101
|
#
|
2102
|
+
# ```ruby
|
2103
|
+
# # RUBY EXAMPLE
|
2104
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
2105
|
+
# travis.lint(File.read('.travis.yml'))
|
2106
|
+
# ```
|
2107
|
+
#
|
1608
2108
|
# @param yaml_content [String] the contents for the file `.travis.yml`
|
1609
2109
|
# @return [Success, RequestError]
|
1610
2110
|
def lint(yaml_content)
|
@@ -1649,6 +2149,14 @@ module Trav3
|
|
1649
2149
|
# -H "Authorization: token xxxxxxxxxxxx" \
|
1650
2150
|
# https://api.travis-ci.org/job/{job.id}/log
|
1651
2151
|
#
|
2152
|
+
# ```ruby
|
2153
|
+
# # RUBY EXAMPLE
|
2154
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
2155
|
+
# travis.log(351_778_875)
|
2156
|
+
# # or
|
2157
|
+
# travis.log(351_778_875, :text)
|
2158
|
+
# ```
|
2159
|
+
#
|
1652
2160
|
# The default response type is application/json, and will include additional meta data such as @type, @representation etc. (see [https://developer.travis-ci.org/format](https://developer.travis-ci.org/format)).
|
1653
2161
|
#
|
1654
2162
|
# GET <code>/job/{job.id}/log</code>
|
@@ -1682,6 +2190,13 @@ module Trav3
|
|
1682
2190
|
# -H "Authorization: token xxxxxxxxxxxx" \
|
1683
2191
|
# https://api.travis-ci.org/job/{job.id}/log
|
1684
2192
|
#
|
2193
|
+
# ```ruby
|
2194
|
+
# # RUBY EXAMPLE
|
2195
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
2196
|
+
# travis.authorization = 'xxxx'
|
2197
|
+
# travis.log(478_772_530, :delete)
|
2198
|
+
# ```
|
2199
|
+
#
|
1685
2200
|
# DELETE <code>/job/{job.id}/log</code>
|
1686
2201
|
#
|
1687
2202
|
# Template Variable Type Description
|
@@ -1737,6 +2252,13 @@ module Trav3
|
|
1737
2252
|
# limit Integer How many messages to include in the response. Used for pagination.
|
1738
2253
|
# offset Integer How many messages to skip before the first entry in the response. Used for pagination.
|
1739
2254
|
#
|
2255
|
+
# ```ruby
|
2256
|
+
# # RUBY EXAMPLE
|
2257
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
2258
|
+
# travis.authorization = 'xxxx'
|
2259
|
+
# travis.messages(147_731_561)
|
2260
|
+
# ```
|
2261
|
+
#
|
1740
2262
|
# GET <code>/repo/{repository.slug}/request/{request.id}/messages</code>
|
1741
2263
|
#
|
1742
2264
|
# Template Variable Type Description
|
@@ -1747,6 +2269,13 @@ module Trav3
|
|
1747
2269
|
# limit Integer How many messages to include in the response. Used for pagination.
|
1748
2270
|
# offset Integer How many messages to skip before the first entry in the response. Used for pagination.
|
1749
2271
|
#
|
2272
|
+
# ```ruby
|
2273
|
+
# # RUBY EXAMPLE
|
2274
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
2275
|
+
# travis.authorization = 'xxxx'
|
2276
|
+
# travis.messages(147_731_561)
|
2277
|
+
# ```
|
2278
|
+
#
|
1750
2279
|
# @param request_id [String, Integer] the request id
|
1751
2280
|
# @return [Success, RequestError]
|
1752
2281
|
def messages(request_id)
|
@@ -1801,6 +2330,12 @@ module Trav3
|
|
1801
2330
|
#
|
1802
2331
|
# Example: GET /org/87
|
1803
2332
|
#
|
2333
|
+
# ```ruby
|
2334
|
+
# # RUBY EXAMPLE
|
2335
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
2336
|
+
# travis.organization(87)
|
2337
|
+
# ```
|
2338
|
+
#
|
1804
2339
|
# @param org_id [String, Integer] the organization id
|
1805
2340
|
# @raise [TypeError] if given organization id is not a number
|
1806
2341
|
# @return [Success, RequestError]
|
@@ -1852,9 +2387,17 @@ module Trav3
|
|
1852
2387
|
#
|
1853
2388
|
# **Sortable by:** <code>id</code>, <code>login</code>, <code>name</code>, <code>github_id</code>, append <code>:desc</code> to any attribute to reverse order.
|
1854
2389
|
#
|
2390
|
+
# ```ruby
|
2391
|
+
# # RUBY EXAMPLE
|
2392
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
2393
|
+
# travis.authorization = 'xxxx'
|
2394
|
+
# travis.options.build({limit: 5})
|
2395
|
+
# travis.organizations
|
2396
|
+
# ```
|
2397
|
+
#
|
1855
2398
|
# @return [Success, RequestError]
|
1856
2399
|
def organizations
|
1857
|
-
get("#{without_repo}/orgs")
|
2400
|
+
get("#{without_repo}/orgs#{opts}")
|
1858
2401
|
end
|
1859
2402
|
|
1860
2403
|
# This will be either a {https://developer.travis-ci.com/resource/user user} or {https://developer.travis-ci.com/resource/organization organization}.
|
@@ -1901,6 +2444,15 @@ module Trav3
|
|
1901
2444
|
#
|
1902
2445
|
# Example: GET /owner/danielpclark
|
1903
2446
|
#
|
2447
|
+
# ```ruby
|
2448
|
+
# # RUBY EXAMPLE
|
2449
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
2450
|
+
# travis.authorization = 'xxxx'
|
2451
|
+
# travis.owner
|
2452
|
+
# # or
|
2453
|
+
# travis.owner('danielpclark')
|
2454
|
+
# ```
|
2455
|
+
#
|
1904
2456
|
# GET <code>/owner/{user.login}</code>
|
1905
2457
|
#
|
1906
2458
|
# Template Variable Type Description
|
@@ -1911,6 +2463,15 @@ module Trav3
|
|
1911
2463
|
#
|
1912
2464
|
# Example: GET /owner/danielpclark
|
1913
2465
|
#
|
2466
|
+
# ```ruby
|
2467
|
+
# # RUBY EXAMPLE
|
2468
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
2469
|
+
# travis.authorization = 'xxxx'
|
2470
|
+
# travis.owner
|
2471
|
+
# # or
|
2472
|
+
# travis.owner('danielpclark')
|
2473
|
+
# ```
|
2474
|
+
#
|
1914
2475
|
# GET <code>/owner/{organization.login}</code>
|
1915
2476
|
#
|
1916
2477
|
# Template Variable Type Description
|
@@ -1921,6 +2482,13 @@ module Trav3
|
|
1921
2482
|
#
|
1922
2483
|
# Example: GET /owner/travis-ci
|
1923
2484
|
#
|
2485
|
+
# ```ruby
|
2486
|
+
# # RUBY EXAMPLE
|
2487
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
2488
|
+
# travis.authorization = 'xxxx'
|
2489
|
+
# travis.owner('travis-ci')
|
2490
|
+
# ```
|
2491
|
+
#
|
1924
2492
|
# GET <code>/owner/github_id/{owner.github_id}</code>
|
1925
2493
|
#
|
1926
2494
|
# Template Variable Type Description
|
@@ -1931,6 +2499,13 @@ module Trav3
|
|
1931
2499
|
#
|
1932
2500
|
# Example: GET /owner/github_id/639823
|
1933
2501
|
#
|
2502
|
+
# ```ruby
|
2503
|
+
# # RUBY EXAMPLE
|
2504
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
2505
|
+
# travis.authorization = 'xxxx'
|
2506
|
+
# travis.owner(639_823)
|
2507
|
+
# ```
|
2508
|
+
#
|
1934
2509
|
# @param owner [String] username or github id
|
1935
2510
|
# @return [Success, RequestError]
|
1936
2511
|
def owner(owner = username)
|
@@ -1938,7 +2513,7 @@ module Trav3
|
|
1938
2513
|
get("#{without_repo}/owner/#{owner}")
|
1939
2514
|
end
|
1940
2515
|
|
1941
|
-
#
|
2516
|
+
# Individual preferences for current user or organization.
|
1942
2517
|
#
|
1943
2518
|
# ## Attributes
|
1944
2519
|
#
|
@@ -1962,7 +2537,7 @@ module Trav3
|
|
1962
2537
|
#
|
1963
2538
|
# **For Organization**
|
1964
2539
|
#
|
1965
|
-
#
|
2540
|
+
# Get preference for organization.
|
1966
2541
|
#
|
1967
2542
|
# GET <code>/org/{organization.id}/preference/{preference.name}</code>
|
1968
2543
|
#
|
@@ -1972,9 +2547,16 @@ module Trav3
|
|
1972
2547
|
# Query Parameter Type Description
|
1973
2548
|
# include [String] List of attributes to eager load.
|
1974
2549
|
#
|
2550
|
+
# ```ruby
|
2551
|
+
# # RUBY EXAMPLE
|
2552
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
2553
|
+
# travis.authorization = 'xxxx'
|
2554
|
+
# travis.preference('private_insights_visibility', org_id: 107_660)
|
2555
|
+
# ```
|
2556
|
+
#
|
1975
2557
|
# **Update**
|
1976
2558
|
#
|
1977
|
-
#
|
2559
|
+
# Set preference for organization.
|
1978
2560
|
#
|
1979
2561
|
# PATCH <code>/org/{organization.id}/preference/{preference.name}</code>
|
1980
2562
|
#
|
@@ -1984,6 +2566,15 @@ module Trav3
|
|
1984
2566
|
# Accepted Parameter Type Description
|
1985
2567
|
# preference.value Unknown The preference's value.
|
1986
2568
|
#
|
2569
|
+
# ```ruby
|
2570
|
+
# # RUBY EXAMPLE
|
2571
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
2572
|
+
# travis.authorization = 'xxxx'
|
2573
|
+
# travis.preference('private_insights_visibility', 'admins', org_id: 107_660)
|
2574
|
+
# ```
|
2575
|
+
#
|
2576
|
+
# Set preference for current user.
|
2577
|
+
#
|
1987
2578
|
# PATCH <code>/preference/{preference.name}</code>
|
1988
2579
|
#
|
1989
2580
|
# Template Variable Type Description
|
@@ -1991,9 +2582,16 @@ module Trav3
|
|
1991
2582
|
# Accepted Parameter Type Description
|
1992
2583
|
# preference.value Unknown The preference's value.
|
1993
2584
|
#
|
2585
|
+
# ```ruby
|
2586
|
+
# # RUBY EXAMPLE
|
2587
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
2588
|
+
# travis.authorization = 'xxxx'
|
2589
|
+
# travis.preference('build_emails', true)
|
2590
|
+
# ```
|
2591
|
+
#
|
1994
2592
|
# **Find**
|
1995
2593
|
#
|
1996
|
-
#
|
2594
|
+
# Get preference for current user.
|
1997
2595
|
#
|
1998
2596
|
# GET <code>/preference/{preference.name}</code>
|
1999
2597
|
#
|
@@ -2002,6 +2600,13 @@ module Trav3
|
|
2002
2600
|
# Query Parameter Type Description
|
2003
2601
|
# include [String] List of attributes to eager load.
|
2004
2602
|
#
|
2603
|
+
# ```ruby
|
2604
|
+
# # RUBY EXAMPLE
|
2605
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
2606
|
+
# travis.authorization = 'xxxx'
|
2607
|
+
# travis.preference('build_emails')
|
2608
|
+
# ```
|
2609
|
+
#
|
2005
2610
|
# @note requests require an authorization token set in the headers. See: {authorization=}
|
2006
2611
|
#
|
2007
2612
|
# @param key [String] preference name to get or set
|
@@ -2018,7 +2623,7 @@ module Trav3
|
|
2018
2623
|
get("#{without_repo}#{org_id}/preference/#{key}")
|
2019
2624
|
end
|
2020
2625
|
|
2021
|
-
#
|
2626
|
+
# Preferences for current user or organization.
|
2022
2627
|
#
|
2023
2628
|
# ## Attributes
|
2024
2629
|
#
|
@@ -2029,7 +2634,7 @@ module Trav3
|
|
2029
2634
|
#
|
2030
2635
|
# **For Organization**
|
2031
2636
|
#
|
2032
|
-
#
|
2637
|
+
# Gets preferences for organization.
|
2033
2638
|
#
|
2034
2639
|
# GET <code>/org/{organization.id}/preferences</code>
|
2035
2640
|
#
|
@@ -2040,9 +2645,16 @@ module Trav3
|
|
2040
2645
|
#
|
2041
2646
|
# Example: GET /org/87/preferences
|
2042
2647
|
#
|
2648
|
+
# ```ruby
|
2649
|
+
# # RUBY EXAMPLE
|
2650
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
2651
|
+
# travis.authorization = 'xxxx'
|
2652
|
+
# travis.preferences(107_660)
|
2653
|
+
# ```
|
2654
|
+
#
|
2043
2655
|
# **For User**
|
2044
2656
|
#
|
2045
|
-
#
|
2657
|
+
# Gets preferences for current user.
|
2046
2658
|
#
|
2047
2659
|
# GET <code>/preferences</code>
|
2048
2660
|
#
|
@@ -2051,6 +2663,13 @@ module Trav3
|
|
2051
2663
|
#
|
2052
2664
|
# Example: GET /preferences
|
2053
2665
|
#
|
2666
|
+
# ```ruby
|
2667
|
+
# # RUBY EXAMPLE
|
2668
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
2669
|
+
# travis.authorization = 'xxxx'
|
2670
|
+
# travis.preferences
|
2671
|
+
# ```
|
2672
|
+
#
|
2054
2673
|
# @note requests require an authorization token set in the headers. See: {authorization=}
|
2055
2674
|
#
|
2056
2675
|
# @param org_id [String, Integer] optional organization id
|
@@ -2116,6 +2735,15 @@ module Trav3
|
|
2116
2735
|
#
|
2117
2736
|
# **Sortable by:** <code>id</code>, <code>github_id</code>, <code>owner_name</code>, <code>name</code>, <code>active</code>, <code>default_branch.last_build</code>, append <code>:desc</code> to any attribute to reverse order.
|
2118
2737
|
#
|
2738
|
+
# ```ruby
|
2739
|
+
# # RUBY EXAMPLE
|
2740
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
2741
|
+
# travis.options.build({limit: 5, sort_by: 'active,name'})
|
2742
|
+
# travis.repositories
|
2743
|
+
# # or
|
2744
|
+
# travis.repositories('danielpclark')
|
2745
|
+
# ```
|
2746
|
+
#
|
2119
2747
|
# GET <code>/owner/{user.login}/repos</code>
|
2120
2748
|
#
|
2121
2749
|
# Template Variable Type Description
|
@@ -2137,6 +2765,15 @@ module Trav3
|
|
2137
2765
|
#
|
2138
2766
|
# **Sortable by:** <code>id</code>, <code>github_id</code>, <code>owner_name</code>, <code>name</code>, <code>active</code>, <code>default_branch.last_build</code>, append <code>:desc</code> to any attribute to reverse order.
|
2139
2767
|
#
|
2768
|
+
# ```ruby
|
2769
|
+
# # RUBY EXAMPLE
|
2770
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
2771
|
+
# travis.options.build({limit: 5, sort_by: 'active,name'})
|
2772
|
+
# travis.repositories
|
2773
|
+
# # or
|
2774
|
+
# travis.repositories('danielpclark')
|
2775
|
+
# ```
|
2776
|
+
#
|
2140
2777
|
# GET <code>/owner/{organization.login}/repos</code>
|
2141
2778
|
#
|
2142
2779
|
# Template Variable Type Description
|
@@ -2158,6 +2795,14 @@ module Trav3
|
|
2158
2795
|
#
|
2159
2796
|
# **Sortable by:** <code>id</code>, <code>github_id</code>, <code>owner_name</code>, <code>name</code>, <code>active</code>, <code>default_branch.last_build</code>, append <code>:desc</code> to any attribute to reverse order.
|
2160
2797
|
#
|
2798
|
+
# ```ruby
|
2799
|
+
# # RUBY EXAMPLE
|
2800
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
2801
|
+
# travis.authorization = 'xxxx'
|
2802
|
+
# travis.options.build({limit: 5, sort_by: 'active,name'})
|
2803
|
+
# travis.repositories('travis-ci')
|
2804
|
+
# ```
|
2805
|
+
#
|
2161
2806
|
# GET <code>/owner/github_id/{owner.github_id}/repos</code>
|
2162
2807
|
#
|
2163
2808
|
# Template Variable Type Description
|
@@ -2179,6 +2824,13 @@ module Trav3
|
|
2179
2824
|
#
|
2180
2825
|
# **Sortable by:** <code>id</code>, <code>github_id</code>, <code>owner_name</code>, <code>name</code>, <code>active</code>, <code>default_branch.last_build</code>, append <code>:desc</code> to any attribute to reverse order.
|
2181
2826
|
#
|
2827
|
+
# ```ruby
|
2828
|
+
# # RUBY EXAMPLE
|
2829
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
2830
|
+
# travis.options.build({limit: 5, sort_by: 'active,name'})
|
2831
|
+
# travis.repositories(639_823)
|
2832
|
+
# ```
|
2833
|
+
#
|
2182
2834
|
# **For Current User**
|
2183
2835
|
#
|
2184
2836
|
# This returns a list of repositories the current user has access to.
|
@@ -2201,9 +2853,18 @@ module Trav3
|
|
2201
2853
|
#
|
2202
2854
|
# **Sortable by:** <code>id</code>, <code>github_id</code>, <code>owner_name</code>, <code>name</code>, <code>active</code>, <code>default_branch.last_build</code>, append <code>:desc</code> to any attribute to reverse order.
|
2203
2855
|
#
|
2204
|
-
#
|
2856
|
+
# ```ruby
|
2857
|
+
# # RUBY EXAMPLE
|
2858
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
2859
|
+
# travis.authorization = 'xxxx'
|
2860
|
+
# travis.options.build({limit: 5, sort_by: 'active,name'})
|
2861
|
+
# travis.repositories(:self)
|
2862
|
+
# ```
|
2863
|
+
#
|
2864
|
+
# @param owner [String, Integer, Symbol] username, github id, or `:self`
|
2205
2865
|
# @return [Success, RequestError]
|
2206
2866
|
def repositories(owner = username)
|
2867
|
+
owner.equal?(:self) and return get("#{without_repo}/repos#{opts}")
|
2207
2868
|
number?(owner) and return get("#{without_repo}/owner/github_id/#{owner}/repos#{opts}")
|
2208
2869
|
get("#{without_repo}/owner/#{owner}/repos#{opts}")
|
2209
2870
|
end
|
@@ -2253,6 +2914,12 @@ module Trav3
|
|
2253
2914
|
#
|
2254
2915
|
# Example: GET /repo/891
|
2255
2916
|
#
|
2917
|
+
# ```ruby
|
2918
|
+
# # RUBY EXAMPLE
|
2919
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
2920
|
+
# travis.repository('danielpclark/trav3')
|
2921
|
+
# ```
|
2922
|
+
#
|
2256
2923
|
# GET <code>/repo/{repository.slug}</code>
|
2257
2924
|
#
|
2258
2925
|
# Template Variable Type Description
|
@@ -2263,6 +2930,12 @@ module Trav3
|
|
2263
2930
|
#
|
2264
2931
|
# Example: GET /repo/rails%2Frails
|
2265
2932
|
#
|
2933
|
+
# ```ruby
|
2934
|
+
# # RUBY EXAMPLE
|
2935
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
2936
|
+
# travis.repository('danielpclark/trav3')
|
2937
|
+
# ```
|
2938
|
+
#
|
2266
2939
|
# **Activate**
|
2267
2940
|
#
|
2268
2941
|
# This will activate a repository, allowing its tests to be run on Travis CI.
|
@@ -2274,6 +2947,13 @@ module Trav3
|
|
2274
2947
|
#
|
2275
2948
|
# Example: POST /repo/891/activate
|
2276
2949
|
#
|
2950
|
+
# ```ruby
|
2951
|
+
# # RUBY EXAMPLE
|
2952
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
2953
|
+
# travis.authorization = 'xxxx'
|
2954
|
+
# travis.repository('danielpclark/trav3', :activate)
|
2955
|
+
# ```
|
2956
|
+
#
|
2277
2957
|
# POST <code>/repo/{repository.slug}/activate</code>
|
2278
2958
|
#
|
2279
2959
|
# Template Variable Type Description
|
@@ -2281,6 +2961,13 @@ module Trav3
|
|
2281
2961
|
#
|
2282
2962
|
# Example: POST /repo/rails%2Frails/activate
|
2283
2963
|
#
|
2964
|
+
# ```ruby
|
2965
|
+
# # RUBY EXAMPLE
|
2966
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
2967
|
+
# travis.authorization = 'xxxx'
|
2968
|
+
# travis.repository('danielpclark/trav3', :activate)
|
2969
|
+
# ```
|
2970
|
+
#
|
2284
2971
|
# **Deactivate**
|
2285
2972
|
#
|
2286
2973
|
# This will deactivate a repository, preventing any tests from running on Travis CI.
|
@@ -2292,6 +2979,13 @@ module Trav3
|
|
2292
2979
|
#
|
2293
2980
|
# Example: POST /repo/891/deactivate
|
2294
2981
|
#
|
2982
|
+
# ```ruby
|
2983
|
+
# # RUBY EXAMPLE
|
2984
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
2985
|
+
# travis.authorization = 'xxxx'
|
2986
|
+
# travis.repository('danielpclark/trav3', :deactivate)
|
2987
|
+
# ```
|
2988
|
+
#
|
2295
2989
|
# POST <code>/repo/{repository.slug}/deactivate</code>
|
2296
2990
|
#
|
2297
2991
|
# Template Variable Type Description
|
@@ -2299,6 +2993,13 @@ module Trav3
|
|
2299
2993
|
#
|
2300
2994
|
# Example: POST /repo/rails%2Frails/deactivate
|
2301
2995
|
#
|
2996
|
+
# ```ruby
|
2997
|
+
# # RUBY EXAMPLE
|
2998
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
2999
|
+
# travis.authorization = 'xxxx'
|
3000
|
+
# travis.repository('danielpclark/trav3', :deactivate)
|
3001
|
+
# ```
|
3002
|
+
#
|
2302
3003
|
# **Star**
|
2303
3004
|
#
|
2304
3005
|
# This will star a repository based on the currently logged in user.
|
@@ -2310,6 +3011,13 @@ module Trav3
|
|
2310
3011
|
#
|
2311
3012
|
# Example: POST /repo/891/star
|
2312
3013
|
#
|
3014
|
+
# ```ruby
|
3015
|
+
# # RUBY EXAMPLE
|
3016
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
3017
|
+
# travis.authorization = 'xxxx'
|
3018
|
+
# travis.repository('danielpclark/trav3', :star)
|
3019
|
+
# ```
|
3020
|
+
#
|
2313
3021
|
# POST <code>/repo/{repository.slug}/star</code>
|
2314
3022
|
#
|
2315
3023
|
# Template Variable Type Description
|
@@ -2317,6 +3025,13 @@ module Trav3
|
|
2317
3025
|
#
|
2318
3026
|
# Example: POST /repo/rails%2Frails/star
|
2319
3027
|
#
|
3028
|
+
# ```ruby
|
3029
|
+
# # RUBY EXAMPLE
|
3030
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
3031
|
+
# travis.authorization = 'xxxx'
|
3032
|
+
# travis.repository('danielpclark/trav3', :star)
|
3033
|
+
# ```
|
3034
|
+
#
|
2320
3035
|
# **Unstar**
|
2321
3036
|
#
|
2322
3037
|
# This will unstar a repository based on the currently logged in user.
|
@@ -2328,6 +3043,13 @@ module Trav3
|
|
2328
3043
|
#
|
2329
3044
|
# Example: POST /repo/891/unstar
|
2330
3045
|
#
|
3046
|
+
# ```ruby
|
3047
|
+
# # RUBY EXAMPLE
|
3048
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
3049
|
+
# travis.authorization = 'xxxx'
|
3050
|
+
# travis.repository('danielpclark/trav3', :unstar)
|
3051
|
+
# ```
|
3052
|
+
#
|
2331
3053
|
# POST <code>/repo/{repository.slug}/unstar</code>
|
2332
3054
|
#
|
2333
3055
|
# Template Variable Type Description
|
@@ -2335,6 +3057,13 @@ module Trav3
|
|
2335
3057
|
#
|
2336
3058
|
# Example: POST /repo/rails%2Frails/unstar
|
2337
3059
|
#
|
3060
|
+
# ```ruby
|
3061
|
+
# # RUBY EXAMPLE
|
3062
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
3063
|
+
# travis.authorization = 'xxxx'
|
3064
|
+
# travis.repository('danielpclark/trav3', :unstar)
|
3065
|
+
# ```
|
3066
|
+
#
|
2338
3067
|
# @note POST requests require an authorization token set in the headers. See: {authorization=}
|
2339
3068
|
#
|
2340
3069
|
# @param repo [String] github_username/repository_name
|
@@ -2388,7 +3117,7 @@ module Trav3
|
|
2388
3117
|
#
|
2389
3118
|
# **Find**
|
2390
3119
|
#
|
2391
|
-
#
|
3120
|
+
# Get the request by id for the current repository
|
2392
3121
|
#
|
2393
3122
|
# GET <code>/repo/{repository.id}/request/{request.id}</code>
|
2394
3123
|
#
|
@@ -2398,6 +3127,13 @@ module Trav3
|
|
2398
3127
|
# Query Parameter Type Description
|
2399
3128
|
# include [String] List of attributes to eager load.
|
2400
3129
|
#
|
3130
|
+
# ```ruby
|
3131
|
+
# # RUBY EXAMPLE
|
3132
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
3133
|
+
# travis.authorization = 'xxxx'
|
3134
|
+
# travis.request(147_776_757)
|
3135
|
+
# ```
|
3136
|
+
#
|
2401
3137
|
# GET <code>/repo/{repository.slug}/request/{request.id}</code>
|
2402
3138
|
#
|
2403
3139
|
# Template Variable Type Description
|
@@ -2406,6 +3142,13 @@ module Trav3
|
|
2406
3142
|
# Query Parameter Type Description
|
2407
3143
|
# include [String] List of attributes to eager load.
|
2408
3144
|
#
|
3145
|
+
# ```ruby
|
3146
|
+
# # RUBY EXAMPLE
|
3147
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
3148
|
+
# travis.authorization = 'xxxx'
|
3149
|
+
# travis.request(147_776_757)
|
3150
|
+
# ```
|
3151
|
+
#
|
2409
3152
|
# @param request_id [String, Integer] request id
|
2410
3153
|
# @return [Success, RequestError]
|
2411
3154
|
def request(request_id)
|
@@ -2460,6 +3203,14 @@ module Trav3
|
|
2460
3203
|
#
|
2461
3204
|
# Example: GET /repo/891/requests?limit=5
|
2462
3205
|
#
|
3206
|
+
# ```ruby
|
3207
|
+
# # RUBY EXAMPLE
|
3208
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
3209
|
+
# travis.authorization = 'xxxx'
|
3210
|
+
# travis.options.build({limit: 5})
|
3211
|
+
# travis.requests
|
3212
|
+
# ```
|
3213
|
+
#
|
2463
3214
|
# GET <code>/repo/{repository.slug}/requests</code>
|
2464
3215
|
#
|
2465
3216
|
# Template Variable Type Description
|
@@ -2471,6 +3222,14 @@ module Trav3
|
|
2471
3222
|
#
|
2472
3223
|
# Example: GET /repo/rails%2Frails/requests?limit=5
|
2473
3224
|
#
|
3225
|
+
# ```ruby
|
3226
|
+
# # RUBY EXAMPLE
|
3227
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
3228
|
+
# travis.authorization = 'xxxx'
|
3229
|
+
# travis.options.build({limit: 5})
|
3230
|
+
# travis.requests
|
3231
|
+
# ```
|
3232
|
+
#
|
2474
3233
|
# **Create**
|
2475
3234
|
#
|
2476
3235
|
# This will create a request for an individual repository, triggering a build to run on Travis CI.
|
@@ -2487,6 +3246,16 @@ module Trav3
|
|
2487
3246
|
# https://api.travis-ci.com/repo/1/requests
|
2488
3247
|
# ```
|
2489
3248
|
#
|
3249
|
+
# ```ruby
|
3250
|
+
# # RUBY EXAMPLE
|
3251
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
3252
|
+
# travis.authorization = 'xxxx'
|
3253
|
+
# travis.requests(
|
3254
|
+
# message: 'Override the commit message: this is an api request',
|
3255
|
+
# branch: 'master'
|
3256
|
+
# )
|
3257
|
+
# ```
|
3258
|
+
#
|
2490
3259
|
# The response includes the following body:
|
2491
3260
|
#
|
2492
3261
|
# ```json
|
@@ -2588,6 +3357,13 @@ module Trav3
|
|
2588
3357
|
#
|
2589
3358
|
# Example: GET /build/86601346/stages
|
2590
3359
|
#
|
3360
|
+
# ```ruby
|
3361
|
+
# # RUBY EXAMPLE
|
3362
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
3363
|
+
# travis.authorization = 'xxxx'
|
3364
|
+
# travis.stages(479_113_572)
|
3365
|
+
# ```
|
3366
|
+
#
|
2591
3367
|
# @param build_id [String, Integer] build id
|
2592
3368
|
# @raise [TypeError] if given build id is not a number
|
2593
3369
|
# @return [Success, RequestError]
|
@@ -2640,6 +3416,13 @@ module Trav3
|
|
2640
3416
|
# Query Parameter Type Description
|
2641
3417
|
# include [String] List of attributes to eager load.
|
2642
3418
|
#
|
3419
|
+
# ```ruby
|
3420
|
+
# # RUBY EXAMPLE
|
3421
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
3422
|
+
# travis.authorization = 'xxxx'
|
3423
|
+
# travis.setting('auto_cancel_pull_requests')
|
3424
|
+
# ```
|
3425
|
+
#
|
2643
3426
|
# GET <code>/repo/{repository.slug}/setting/{setting.name}</code>
|
2644
3427
|
#
|
2645
3428
|
# Template Variable Type Description
|
@@ -2648,6 +3431,13 @@ module Trav3
|
|
2648
3431
|
# Query Parameter Type Description
|
2649
3432
|
# include [String] List of attributes to eager load.
|
2650
3433
|
#
|
3434
|
+
# ```ruby
|
3435
|
+
# # RUBY EXAMPLE
|
3436
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
3437
|
+
# travis.authorization = 'xxxx'
|
3438
|
+
# travis.setting('auto_cancel_pull_requests')
|
3439
|
+
# ```
|
3440
|
+
#
|
2651
3441
|
# **Update**
|
2652
3442
|
#
|
2653
3443
|
# This updates a single setting. It is possible to use the repository id or slug in the request.
|
@@ -2663,6 +3453,13 @@ module Trav3
|
|
2663
3453
|
# https://api.travis-ci.com/repo/1234/setting/{setting.name}
|
2664
3454
|
# ```
|
2665
3455
|
#
|
3456
|
+
# ```ruby
|
3457
|
+
# # RUBY EXAMPLE
|
3458
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
3459
|
+
# travis.authorization = 'xxxx'
|
3460
|
+
# travis.setting('auto_cancel_pull_requests', false)
|
3461
|
+
# ```
|
3462
|
+
#
|
2666
3463
|
# PATCH <code>/repo/{repository.id}/setting/{setting.name}</code>
|
2667
3464
|
#
|
2668
3465
|
# Template Variable Type Description
|
@@ -2727,6 +3524,13 @@ module Trav3
|
|
2727
3524
|
#
|
2728
3525
|
# Example: GET /repo/891/settings
|
2729
3526
|
#
|
3527
|
+
# ```ruby
|
3528
|
+
# # RUBY EXAMPLE
|
3529
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
3530
|
+
# travis.authorization = 'xxxx'
|
3531
|
+
# travis.settings
|
3532
|
+
# ```
|
3533
|
+
#
|
2730
3534
|
# GET <code>/repo/{repository.slug}/settings</code>
|
2731
3535
|
#
|
2732
3536
|
# Template Variable Type Description
|
@@ -2736,6 +3540,13 @@ module Trav3
|
|
2736
3540
|
#
|
2737
3541
|
# Example: GET /repo/rails%2Frails/settings
|
2738
3542
|
#
|
3543
|
+
# ```ruby
|
3544
|
+
# # RUBY EXAMPLE
|
3545
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
3546
|
+
# travis.authorization = 'xxxx'
|
3547
|
+
# travis.settings
|
3548
|
+
# ```
|
3549
|
+
#
|
2739
3550
|
# @return [Success, RequestError]
|
2740
3551
|
def settings
|
2741
3552
|
get("#{with_repo}/settings")
|
@@ -2790,6 +3601,12 @@ module Trav3
|
|
2790
3601
|
#
|
2791
3602
|
# Example: GET /user/119240
|
2792
3603
|
#
|
3604
|
+
# ```ruby
|
3605
|
+
# # RUBY EXAMPLE
|
3606
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
3607
|
+
# travis.user(119_240)
|
3608
|
+
# ```
|
3609
|
+
#
|
2793
3610
|
# **Sync**
|
2794
3611
|
#
|
2795
3612
|
# This triggers a sync on a user's account with their GitHub account.
|
@@ -2801,6 +3618,13 @@ module Trav3
|
|
2801
3618
|
#
|
2802
3619
|
# Example: POST /user/119240/sync
|
2803
3620
|
#
|
3621
|
+
# ```ruby
|
3622
|
+
# # RUBY EXAMPLE
|
3623
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
3624
|
+
# travis.authorization = 'xxxx'
|
3625
|
+
# travis.user(114_816, :sync)
|
3626
|
+
# ```
|
3627
|
+
#
|
2804
3628
|
# **Current**
|
2805
3629
|
#
|
2806
3630
|
# This will return information about the current user.
|
@@ -2812,6 +3636,13 @@ module Trav3
|
|
2812
3636
|
#
|
2813
3637
|
# Example: GET /user
|
2814
3638
|
#
|
3639
|
+
# ```ruby
|
3640
|
+
# # RUBY EXAMPLE
|
3641
|
+
# travis = Trav3::Travis.new('danielpclark/trav3')
|
3642
|
+
# travis.authorization = 'xxxx'
|
3643
|
+
# travis.user
|
3644
|
+
# ```
|
3645
|
+
#
|
2815
3646
|
# @note sync feature may not be permitted
|
2816
3647
|
# @note POST requests require an authorization token set in the headers. See: {authorization=}
|
2817
3648
|
#
|