circleci 1.1.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/README.md +268 -82
- data/lib/circleci.rb +1 -0
- data/lib/circleci/api_project_resource.rb +32 -0
- data/lib/circleci/build.rb +6 -96
- data/lib/circleci/config.rb +8 -8
- data/lib/circleci/project.rb +27 -275
- data/lib/circleci/projects.rb +1 -1
- data/lib/circleci/recent_builds.rb +1 -18
- data/lib/circleci/user.rb +4 -29
- metadata +7 -6
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 01d1ecdf5dd5c7751ba1b8d5a02aac75129a3ff3
|
4
|
+
data.tar.gz: 29f32045901558cb42e4c25e68d4bdeb5569cf5f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 964f61a6e7976946c3cd8d14082d2625d28f9e6fc55a086ce33c22c84bdc27a76d7cc7bd18901770ccc94386903822c3599e6250d3fd0851d79fee6d7edbab0b
|
7
|
+
data.tar.gz: 3e41c32238ab6fc370a221376200bd8e0289fd9ff838d4dac363e8f4f2cc37842b6572d8d6e6114f109c653ead394fb33d2298562796447f3b9cfcb345da0bb7
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/README.md
CHANGED
@@ -8,6 +8,11 @@
|
|
8
8
|
|
9
9
|
Circle CI API Wrapper. Requires ruby `>= 2.0.0`.
|
10
10
|
|
11
|
+
**Version 2.x has breaking changes from v1.x**
|
12
|
+
> Please use branch v-1.1.0 or tag v1.1.0 for previous 1.x version of
|
13
|
+
> the gem until you can update to the latest version. 1.x will not be supported
|
14
|
+
> in the longer term.
|
15
|
+
|
11
16
|
## Install
|
12
17
|
|
13
18
|
```ruby
|
@@ -22,8 +27,14 @@ gem 'circleci'
|
|
22
27
|
|
23
28
|
## Usage
|
24
29
|
|
30
|
+
### Documentation
|
31
|
+
|
32
|
+
Documentation can be found on [rubydoc][docs] or in this README
|
33
|
+
|
25
34
|
### Configuring
|
26
35
|
|
36
|
+
#### Global Config
|
37
|
+
|
27
38
|
Configure using an API token from Circle
|
28
39
|
|
29
40
|
```ruby
|
@@ -71,6 +82,67 @@ CircleCi.configure do |config|
|
|
71
82
|
end
|
72
83
|
```
|
73
84
|
|
85
|
+
#### Config Object
|
86
|
+
|
87
|
+
If you need to use custom config per request or for specific non-global cases
|
88
|
+
you can instantiate a `CircleCi::Config` object with all the same granularity
|
89
|
+
as a global config.
|
90
|
+
|
91
|
+
```ruby
|
92
|
+
# Using a new token
|
93
|
+
config = CircleCi::Config.new token: ENV['SECRET_CIRCLECI_TOKEN']
|
94
|
+
|
95
|
+
# Setting a new host
|
96
|
+
config_options = { host: ENV['CIRCLECI_HOST'], port: ENV['CIRCLECI_PORT'] }
|
97
|
+
config = CircleCi::Config.new
|
98
|
+
|
99
|
+
# Proxy setup is a little more invovled right now
|
100
|
+
# and requires setting proxy info on instantiated config
|
101
|
+
config = CircleCi::Config.new token: ENV['CIRCLECI_TOKEN'], proxy: true
|
102
|
+
config.proxy_host = ENV['CIRCLECI_PROXY_HOST']
|
103
|
+
config.proxy_port = ENV['CIRCLECI_PROXY_PORT']
|
104
|
+
config.proxy_user = ENV['CIRCLECI_PROXY_USER']
|
105
|
+
config.proxy_pass = ENV['CIRCLECI_PROXY_PASS']
|
106
|
+
```
|
107
|
+
|
108
|
+
### API Versioning
|
109
|
+
|
110
|
+
CircleCi is a versioned API. This gem attempts to stay up to date with any
|
111
|
+
changes between versions. As of now you can change the version on the config
|
112
|
+
you use to make requests.
|
113
|
+
|
114
|
+
```ruby
|
115
|
+
config = CircleCi::Config.new token: ENV['CIRCLECI_TOKEN'], version: 'v1.1'
|
116
|
+
```
|
117
|
+
|
118
|
+
This will change the requests to be in the format of
|
119
|
+
|
120
|
+
`https://circleci.com/api/v1.1/`
|
121
|
+
|
122
|
+
### VCS Type
|
123
|
+
|
124
|
+
Introduced in `v1.1` of the API is interacting with projects and builds based
|
125
|
+
on their version control system type. Currently this can be `github` or `bitbucket`.
|
126
|
+
Please see endpoint documentation for `Project` and `Build` on usage but you can
|
127
|
+
set a vcs type on either as so
|
128
|
+
|
129
|
+
```ruby
|
130
|
+
# A bitbucket project
|
131
|
+
project = CircleCi::Project.new 'username', 'project', 'bitbucket'
|
132
|
+
|
133
|
+
# A github build
|
134
|
+
build = CircleCi::Build.new 'username', 'project', 'github', '1234'
|
135
|
+
|
136
|
+
# Defaults to github
|
137
|
+
build = CircleCi::Build.new 'username', 'project', nil, '1234'
|
138
|
+
build.vcs_type # will be github
|
139
|
+
|
140
|
+
# Non-valid types default to github as well
|
141
|
+
project = CircleCi::Project.new 'username', 'project', 'gitlab'
|
142
|
+
project.vcs_type # will be github
|
143
|
+
```
|
144
|
+
|
145
|
+
|
74
146
|
## API Endpoints
|
75
147
|
|
76
148
|
* [User](#user)
|
@@ -88,7 +160,7 @@ end
|
|
88
160
|
* [Get Checkout Key](#get_checkout_key)
|
89
161
|
* [List Checkout Keys](#list_checkout_keys)
|
90
162
|
* [New Checkout Key](#new_checkout_key)
|
91
|
-
* [Recent Builds](#
|
163
|
+
* [Recent Project Builds](#recent_project_builds)
|
92
164
|
* [Recent Builds Branch](#recent_builds_branch)
|
93
165
|
* [Settings](#settings)
|
94
166
|
* [Set Envvar](#set_envvar)
|
@@ -101,7 +173,7 @@ end
|
|
101
173
|
* [Retry](#retry)
|
102
174
|
* [Tests](#tests)
|
103
175
|
* [Recent Builds](#recent_builds)
|
104
|
-
* [Get](#
|
176
|
+
* [Get Recent Builds](#get_recent_builds)
|
105
177
|
|
106
178
|
### [User](#user)
|
107
179
|
|
@@ -111,9 +183,13 @@ Endpoint: `/user/heroku-key`
|
|
111
183
|
|
112
184
|
Adds your Heroku API key to CircleCI.
|
113
185
|
```ruby
|
114
|
-
|
115
|
-
|
116
|
-
|
186
|
+
# Use global config with token for user
|
187
|
+
user = CircleCi::User.new
|
188
|
+
user.heroku_key 'your-api-key'
|
189
|
+
|
190
|
+
# Use a different config with another user token
|
191
|
+
user = CircleCi::User.new other_user_config
|
192
|
+
user.heroku_key 'your-api-key'
|
117
193
|
```
|
118
194
|
|
119
195
|
Example response
|
@@ -130,9 +206,13 @@ Endpoint: `/me`
|
|
130
206
|
Provides information about the signed in user.
|
131
207
|
|
132
208
|
```ruby
|
133
|
-
|
134
|
-
|
135
|
-
|
209
|
+
# Use global config with token for user
|
210
|
+
user = CircleCi::User.new
|
211
|
+
user.me
|
212
|
+
|
213
|
+
# Use a different config with another user token
|
214
|
+
user = CircleCi::User.new other_user_config
|
215
|
+
user.me
|
136
216
|
```
|
137
217
|
|
138
218
|
Example response
|
@@ -153,9 +233,13 @@ Endpoint: `/projects`
|
|
153
233
|
List of all the repos you have access to on Github, with build information organized by branch.
|
154
234
|
|
155
235
|
```ruby
|
156
|
-
|
157
|
-
|
158
|
-
|
236
|
+
# Use global config with token for user
|
237
|
+
projects = CircleCi::Projects.new
|
238
|
+
projects.get
|
239
|
+
|
240
|
+
# Use a different config with another projects token
|
241
|
+
projects = CircleCi::Projects.new other_projects_config
|
242
|
+
projects.get
|
159
243
|
```
|
160
244
|
|
161
245
|
Example response
|
@@ -203,23 +287,30 @@ Endpoint: `/project/:username/:repository/tree/:branch`
|
|
203
287
|
Build a specific branch of a project
|
204
288
|
|
205
289
|
```ruby
|
206
|
-
|
207
|
-
|
208
|
-
res.body['build_url'] # Get url of build
|
290
|
+
# Use global config with token for user
|
291
|
+
project = CircleCi::Project.new 'username', 'reponame'
|
209
292
|
|
210
|
-
#
|
211
|
-
|
212
|
-
res = CircleCi::Project.build_branch 'username', 'reponame', 'branch', {}, build_params
|
213
|
-
res.body['status'] # Not running
|
214
|
-
res.body['build_url'] # Get url of build
|
293
|
+
# Get recent failed builds with a filter parameter
|
294
|
+
failed_builds = project.build_branch 'branch'
|
215
295
|
|
216
296
|
# Adding URL params for revision or parallel
|
217
297
|
params = { revision: 'fda12345asdf', parallel: 2 }
|
218
|
-
res =
|
298
|
+
res = project.build_branch 'branch', params
|
219
299
|
res.body['status'] # Not running
|
220
300
|
res.body['build_url'] # Get url of build
|
301
|
+
|
302
|
+
# Passing build parameters in the post body
|
303
|
+
build_params = { build_parameters: { 'MY_TOKEN' => '123asd123asd' } }
|
304
|
+
res = project.build_branch 'branch', {}, build_params
|
305
|
+
res.body['status']
|
306
|
+
res.body['build_url']
|
307
|
+
|
308
|
+
# Use a different config with another user token
|
309
|
+
project = CircleCi::Project.new 'username', 'reponame', other_project_config
|
310
|
+
project.build_branch 'branch'
|
221
311
|
```
|
222
312
|
|
313
|
+
|
223
314
|
Example response
|
224
315
|
|
225
316
|
```javascript
|
@@ -311,8 +402,13 @@ Endpoint: `/project/:username/:repository/:build_num/ssh-users`
|
|
311
402
|
Adds a user to the build's SSH permissions.
|
312
403
|
|
313
404
|
```ruby
|
314
|
-
|
315
|
-
|
405
|
+
# Use global config with token for user
|
406
|
+
project = CircleCi::Project.new 'username', 'reponame'
|
407
|
+
res = project.build_ssh_key 'username', 'repo', 'RSA private key', 'hostname'
|
408
|
+
|
409
|
+
# Use a different config with another user token
|
410
|
+
project = CircleCi::Project.new 'username', 'reponame', other_project_config
|
411
|
+
project.build_ssh_key 'username', 'repo', 'RSA private key', 'hostname'
|
316
412
|
```
|
317
413
|
|
318
414
|
Example response
|
@@ -329,8 +425,13 @@ Endpoint: `/project/:username/:repository/build-cache`
|
|
329
425
|
Clears the cache for a project
|
330
426
|
|
331
427
|
```ruby
|
332
|
-
|
333
|
-
|
428
|
+
# Use global config with token for user
|
429
|
+
project = CircleCi::Project.new 'username', 'reponame'
|
430
|
+
res = project.clear_cache
|
431
|
+
|
432
|
+
# Use a different config with another user token
|
433
|
+
project = CircleCi::Project.new 'username', 'reponame', other_project_config
|
434
|
+
project.clear_cache
|
334
435
|
```
|
335
436
|
|
336
437
|
Example response
|
@@ -347,9 +448,13 @@ Endpoint: `/project/:username/:repository/checkout-key/:fingerprint`
|
|
347
448
|
|
348
449
|
Delete a checkout key for a project by supplying the fingerprint of the key.
|
349
450
|
```ruby
|
350
|
-
|
351
|
-
|
352
|
-
res.
|
451
|
+
# Use global config with token for user
|
452
|
+
project = CircleCi::Project.new 'username', 'reponame'
|
453
|
+
res = project.delete_checkout_key 'fingerprint'
|
454
|
+
|
455
|
+
# Use a different config with another user token
|
456
|
+
project = CircleCi::Project.new 'username', 'reponame', other_project_config
|
457
|
+
project.delete_checkout_key 'fingerprint'
|
353
458
|
```
|
354
459
|
|
355
460
|
Example response
|
@@ -366,8 +471,13 @@ Enable a project in CircleCI. Causes a CircleCI SSH key to be added to
|
|
366
471
|
the GitHub. Requires admin privilege to the repository.
|
367
472
|
|
368
473
|
```ruby
|
369
|
-
|
370
|
-
|
474
|
+
# Use global config with token for user
|
475
|
+
project = CircleCi::Project.new 'username', 'reponame'
|
476
|
+
res = project.enable
|
477
|
+
|
478
|
+
# Use a different config with another user token
|
479
|
+
project = CircleCi::Project.new 'username', 'reponame', other_project_config
|
480
|
+
project.enable
|
371
481
|
```
|
372
482
|
|
373
483
|
Example response
|
@@ -454,8 +564,13 @@ Endpoint: `/project/:username/:project/envvar`
|
|
454
564
|
Get a list of environment variables for a project
|
455
565
|
|
456
566
|
```ruby
|
457
|
-
|
458
|
-
|
567
|
+
# Use global config with token for user
|
568
|
+
project = CircleCi::Project.new 'username', 'reponame'
|
569
|
+
res = project.envvar
|
570
|
+
|
571
|
+
# Use a different config with another user token
|
572
|
+
project = CircleCi::Project.new 'username', 'reponame', other_project_config
|
573
|
+
project.envvar
|
459
574
|
```
|
460
575
|
|
461
576
|
Example response
|
@@ -471,8 +586,13 @@ Endpoint: `/project/:username/:repository/follow`
|
|
471
586
|
Follow a project
|
472
587
|
|
473
588
|
```ruby
|
474
|
-
|
475
|
-
|
589
|
+
# Use global config with token for user
|
590
|
+
project = CircleCi::Project.new 'username', 'reponame'
|
591
|
+
res = project.follow
|
592
|
+
|
593
|
+
# Use a different config with another user token
|
594
|
+
project = CircleCi::Project.new 'username', 'reponame', other_project_config
|
595
|
+
project.follow
|
476
596
|
```
|
477
597
|
|
478
598
|
Example response
|
@@ -489,10 +609,15 @@ Example response
|
|
489
609
|
Endpoint: `/project/:username/:repository/checkout-key/:fingerprint`
|
490
610
|
|
491
611
|
Get a checkout key for a project by supplying the fingerprint of the key.
|
612
|
+
|
492
613
|
```ruby
|
493
|
-
|
494
|
-
|
495
|
-
res.
|
614
|
+
# Use global config with token for user
|
615
|
+
project = CircleCi::Project.new 'username', 'reponame'
|
616
|
+
res = project.get_checkout_key 'fingerprint'
|
617
|
+
|
618
|
+
# Use a different config with another user token
|
619
|
+
project = CircleCi::Project.new 'username', 'reponame', other_project_config
|
620
|
+
project.get_checkout_key 'fingerprint
|
496
621
|
```
|
497
622
|
|
498
623
|
Example response
|
@@ -514,8 +639,13 @@ Endpoint: `/project/#{username}/#{project}/checkout-key`
|
|
514
639
|
List checkout keys
|
515
640
|
|
516
641
|
```ruby
|
517
|
-
|
518
|
-
|
642
|
+
# Use global config with token for user
|
643
|
+
project = CircleCi::Project.new 'username', 'reponame'
|
644
|
+
res = project.checkout_keys
|
645
|
+
|
646
|
+
# Use a different config with another user token
|
647
|
+
project = CircleCi::Project.new 'username', 'reponame', other_project_config
|
648
|
+
project.checkout_keys
|
519
649
|
```
|
520
650
|
|
521
651
|
Example response
|
@@ -538,10 +668,15 @@ Endpoint: `/project/:username/:repository/checkout-key`
|
|
538
668
|
|
539
669
|
Create an ssh key used to access external systems that require SSH key-based authentication.
|
540
670
|
Takes a type of key to create which an be `deploy-key` or `github-user-key`.
|
671
|
+
|
541
672
|
```ruby
|
542
|
-
|
543
|
-
|
544
|
-
res.
|
673
|
+
# Use global config with token for user
|
674
|
+
project = CircleCi::Project.new 'username', 'reponame'
|
675
|
+
res = project.new_checkout_key 'deploy-key'
|
676
|
+
|
677
|
+
# Use a different config with another user token
|
678
|
+
project = CircleCi::Project.new 'username', 'reponame', other_project_config
|
679
|
+
project.new_checkout_key 'deploy-key
|
545
680
|
```
|
546
681
|
|
547
682
|
Example response
|
@@ -556,23 +691,26 @@ Example response
|
|
556
691
|
}
|
557
692
|
```
|
558
693
|
|
559
|
-
#### [
|
694
|
+
#### [recent_project_builds](#recent_project_builds)
|
560
695
|
|
561
696
|
Endpoint: `/project/:username/:repository`
|
562
697
|
|
563
698
|
Build summary for each of the last 30 recent builds, ordered by build_num.
|
564
699
|
|
565
700
|
```ruby
|
566
|
-
|
701
|
+
# Use global config with token for user
|
702
|
+
project = CircleCi::Project.new 'username', 'reponame'
|
703
|
+
res = project.recent_builds
|
567
704
|
|
568
705
|
# Use params to filter by status
|
569
|
-
|
706
|
+
res = project.recent_builds filter: 'failed'
|
570
707
|
|
571
708
|
# Use params to limit and give an offset
|
572
|
-
|
709
|
+
res = project.recent_builds limit: 10, offset: 50
|
573
710
|
|
574
|
-
|
575
|
-
|
711
|
+
# Use a different config with another user token
|
712
|
+
project = CircleCi::Project.new 'username', 'reponame', other_project_config
|
713
|
+
project.recent_builds
|
576
714
|
```
|
577
715
|
|
578
716
|
Example response
|
@@ -611,9 +749,13 @@ Endpoint: `/project/:username/:repository/tree/:branch`
|
|
611
749
|
Build summary for each of the last 30 recent builds for a specific branch, ordered by build_num.
|
612
750
|
|
613
751
|
```ruby
|
614
|
-
|
615
|
-
|
616
|
-
res.
|
752
|
+
# Use global config with token for user
|
753
|
+
project = CircleCi::Project.new 'username', 'reponame'
|
754
|
+
res = project.recent_builds_branch 'branch'
|
755
|
+
|
756
|
+
# Use a different config with another user token
|
757
|
+
project = CircleCi::Project.new 'username', 'reponame', other_project_config
|
758
|
+
project.recent_builds_branch 'branch'
|
617
759
|
```
|
618
760
|
|
619
761
|
Example response
|
@@ -652,8 +794,13 @@ Endpoint: `/project/:username/:repository/settings`
|
|
652
794
|
Get project settings
|
653
795
|
|
654
796
|
```ruby
|
655
|
-
|
656
|
-
|
797
|
+
# Use global config with token for user
|
798
|
+
project = CircleCi::Project.new 'username', 'reponame'
|
799
|
+
res = project.settings
|
800
|
+
|
801
|
+
# Use a different config with another user token
|
802
|
+
project = CircleCi::Project.new 'username', 'reponame', other_project_config
|
803
|
+
project.settings
|
657
804
|
```
|
658
805
|
|
659
806
|
Example response
|
@@ -731,8 +878,14 @@ Creates a new environment variable for a project
|
|
731
878
|
|
732
879
|
```ruby
|
733
880
|
environment = { name: 'foo', value: 'bar' }
|
734
|
-
|
735
|
-
|
881
|
+
|
882
|
+
# Use global config with token for user
|
883
|
+
project = CircleCi::Project.new 'username', 'reponame'
|
884
|
+
res = project.set_envvar environment
|
885
|
+
|
886
|
+
# Use a different config with another user token
|
887
|
+
project = CircleCi::Project.new 'username', 'reponame', other_project_config
|
888
|
+
project.set_envvar environment
|
736
889
|
```
|
737
890
|
|
738
891
|
Example response
|
@@ -749,8 +902,13 @@ Creates an ssh key that will be used to access the external system identified
|
|
749
902
|
by the hostname parameter for SSH key-based authentication.
|
750
903
|
|
751
904
|
```ruby
|
752
|
-
|
753
|
-
|
905
|
+
# Use global config with token for user
|
906
|
+
project = CircleCi::Project.new 'username', 'reponame'
|
907
|
+
res = project.ssh_key 'RSA private key', 'hostname'
|
908
|
+
|
909
|
+
# Use a different config with another user token
|
910
|
+
project = CircleCi::Project.new 'username', 'reponame', other_project_config
|
911
|
+
project.ssh_key 'RSA private key', 'hostname'
|
754
912
|
```
|
755
913
|
|
756
914
|
Example response
|
@@ -767,8 +925,13 @@ Endpoint: `/project/:username/:repository/unfollow`
|
|
767
925
|
Unfollow a project
|
768
926
|
|
769
927
|
```ruby
|
770
|
-
|
771
|
-
|
928
|
+
# Use global config with token for user
|
929
|
+
project = CircleCi::Project.new 'username', 'reponame'
|
930
|
+
res = project.unfollow
|
931
|
+
|
932
|
+
# Use a different config with another user token
|
933
|
+
project = CircleCi::Project.new 'username', 'reponame', other_project_config
|
934
|
+
project.unfollow
|
772
935
|
```
|
773
936
|
|
774
937
|
Example response
|
@@ -788,9 +951,13 @@ Endpoint: `/project/:username/:repository/:build/artifacts`
|
|
788
951
|
Artifacts produced by the build, returns an array of artifact details
|
789
952
|
|
790
953
|
```ruby
|
791
|
-
|
792
|
-
|
793
|
-
res.
|
954
|
+
# Use global config with token for user
|
955
|
+
build = CircleCi::Build.new 'username', 'reponame', nil, 'build'
|
956
|
+
res = build.artifacts
|
957
|
+
|
958
|
+
# Use a different config with another user token
|
959
|
+
build = CircleCi::Build.new 'username', 'reponame', nil, 'build', other_build_config
|
960
|
+
build.artifacts
|
794
961
|
```
|
795
962
|
|
796
963
|
```javascript
|
@@ -817,11 +984,13 @@ Endpoint: `/project/:username/:repository/:build/cancel`
|
|
817
984
|
Cancels the build, returns a summary of the build.
|
818
985
|
|
819
986
|
```ruby
|
820
|
-
|
821
|
-
|
822
|
-
res
|
823
|
-
|
824
|
-
|
987
|
+
# Use global config with token for user
|
988
|
+
build = CircleCi::Build.new 'username', 'reponame', nil, 'build'
|
989
|
+
res = build.cancel
|
990
|
+
|
991
|
+
# Use a different config with another user token
|
992
|
+
build = CircleCi::Build.new 'username', 'reponame', nil, 'build', other_build_config
|
993
|
+
build.cancel
|
825
994
|
```
|
826
995
|
|
827
996
|
Example response
|
@@ -864,9 +1033,13 @@ Endpoint: `/project/:username/:repository/:build`
|
|
864
1033
|
Full details for a single build, including the output for all actions. The response includes all of the fields from the build summary.
|
865
1034
|
|
866
1035
|
```ruby
|
867
|
-
|
868
|
-
|
869
|
-
res.
|
1036
|
+
# Use global config with token for user
|
1037
|
+
build = CircleCi::Build.new 'username', 'reponame', nil, 'build'
|
1038
|
+
res = build.get
|
1039
|
+
|
1040
|
+
# Use a different config with another user token
|
1041
|
+
build = CircleCi::Build.new 'username', 'reponame', nil, 'build', other_build_config
|
1042
|
+
build.get
|
870
1043
|
```
|
871
1044
|
|
872
1045
|
Example response
|
@@ -953,10 +1126,13 @@ Endpoint: `/project/:username/:repository/:build/retry`
|
|
953
1126
|
Retries the build, returns a summary of the new build.
|
954
1127
|
|
955
1128
|
```ruby
|
956
|
-
|
957
|
-
|
958
|
-
res
|
959
|
-
|
1129
|
+
# Use global config with token for user
|
1130
|
+
build = CircleCi::Build.new 'username', 'reponame', nil, 'build'
|
1131
|
+
res = build.retry
|
1132
|
+
|
1133
|
+
# Use a different config with another user token
|
1134
|
+
build = CircleCi::Build.new 'username', 'reponame', nil, 'build', other_build_config
|
1135
|
+
build.retry
|
960
1136
|
```
|
961
1137
|
|
962
1138
|
Example response
|
@@ -996,9 +1172,13 @@ Tests endpoint to get the recorded tests for a build. Will return an array of
|
|
996
1172
|
the tests ran and some details.
|
997
1173
|
|
998
1174
|
```ruby
|
999
|
-
|
1000
|
-
|
1001
|
-
res.
|
1175
|
+
# Use global config with token for user
|
1176
|
+
build = CircleCi::Build.new 'username', 'reponame', nil, 'build'
|
1177
|
+
res = build.tests
|
1178
|
+
|
1179
|
+
# Use a different config with another user token
|
1180
|
+
build = CircleCi::Build.new 'username', 'reponame', nil, 'build', other_build_config
|
1181
|
+
build.tests
|
1002
1182
|
```
|
1003
1183
|
|
1004
1184
|
```javascript
|
@@ -1024,22 +1204,25 @@ res.body
|
|
1024
1204
|
]
|
1025
1205
|
```
|
1026
1206
|
|
1027
|
-
### [
|
1207
|
+
### [recent_builds](#recent_builds)
|
1028
1208
|
|
1029
|
-
#### [
|
1209
|
+
#### [get_recent_builds](#get_recent_builds)
|
1030
1210
|
|
1031
1211
|
Endpoint: `/recent-builds`
|
1032
1212
|
|
1033
1213
|
Build summary for each of the last 30 recent builds, ordered by build_num.
|
1034
1214
|
|
1035
1215
|
```ruby
|
1036
|
-
|
1216
|
+
# Use global config with token for user
|
1217
|
+
recent = CircleCi::RecentBuilds.new
|
1218
|
+
res = recent.get
|
1037
1219
|
|
1038
1220
|
# Params of limit and offset can be passed in
|
1039
|
-
|
1221
|
+
res = recent.get limit: 10, offset: 50
|
1040
1222
|
|
1041
|
-
|
1042
|
-
|
1223
|
+
# Use a different config with another user token
|
1224
|
+
recent = CircleCi::RecentBuilds.new other_builds_config
|
1225
|
+
recent.get
|
1043
1226
|
```
|
1044
1227
|
|
1045
1228
|
```javascript
|
@@ -1081,3 +1264,6 @@ and uses a checked in `.rubocop.yml` for this project.
|
|
1081
1264
|
Tests are using a live CircleCi API token for this repository. Any tests
|
1082
1265
|
should be using this key, which is in the `.env` file. You should not have
|
1083
1266
|
to do anything outside of writing the tests against this repository.
|
1267
|
+
|
1268
|
+
|
1269
|
+
[docs]: http://www.rubydoc.info/gems/circleci
|