circleci 0.2.0 → 0.2.2
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
- data/README.md +49 -0
- data/lib/circleci.rb +14 -12
- data/lib/circleci/build.rb +8 -17
- data/lib/circleci/config.rb +20 -6
- data/lib/circleci/http.rb +24 -17
- data/lib/circleci/project.rb +43 -22
- data/lib/circleci/request_error.rb +7 -6
- data/lib/circleci/response.rb +10 -8
- data/lib/circleci/user.rb +2 -7
- metadata +103 -32
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4a8c8dbe2997c816b48f601d71ca462261071db6
|
4
|
+
data.tar.gz: 65826412f05aca0a009c5e6358c8016b1c54b050
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d6eb8eaf6d13fd82f49274380457ad9f8ee3b653cd7bb1be2a66e2488f8287a08ff0269870e87f6329bc7121361958a3abf1c525f033c5ccd14ec68a0b28435e
|
7
|
+
data.tar.gz: 2598e61e61c78cddb3bdc1ae834de500075fecf8a55e0d75dbcfb2d6253f20d0b6787b2ffb0766e89149edfbcc1a56b34c2c1546d5a455dfe86d81dac0f44267
|
data/README.md
CHANGED
@@ -5,6 +5,7 @@ circleci
|
|
5
5
|
[](https://circleci.com/gh/mtchavez/circleci)
|
6
6
|
[](https://codeclimate.com/github/mtchavez/circleci)
|
7
7
|
[](https://coveralls.io/r/mtchavez/circleci)
|
8
|
+
[](https://gemnasium.com/mtchavez/circleci)
|
8
9
|
|
9
10
|
Circle CI API Wrapper
|
10
11
|
|
@@ -32,6 +33,17 @@ CircleCi.configure do |config|
|
|
32
33
|
end
|
33
34
|
```
|
34
35
|
|
36
|
+
Optionally you can configure your own host and/or port if using an enterprise
|
37
|
+
CircleCi host. The port will default to `80` if not set.
|
38
|
+
|
39
|
+
```ruby
|
40
|
+
CircleCi.configure do |config|
|
41
|
+
config.token = 'my-token'
|
42
|
+
config.host = 'https://ci.mycompany.com'
|
43
|
+
config.port = 1234
|
44
|
+
end
|
45
|
+
```
|
46
|
+
|
35
47
|
## API Endpoints
|
36
48
|
|
37
49
|
* [User](#user)
|
@@ -43,6 +55,7 @@ end
|
|
43
55
|
* [Build SSH Key](#build_ssh_key)
|
44
56
|
* [Clear Cache](#clear_cache)
|
45
57
|
* [Enable](#enable)
|
58
|
+
* [Envvar](#envvar)
|
46
59
|
* [Follow](#follow)
|
47
60
|
* [Delete Checkout Key](#delete_checkout_key)
|
48
61
|
* [Get Checkout Key](#get_checkout_key)
|
@@ -51,6 +64,7 @@ end
|
|
51
64
|
* [Recent Builds](#recent_builds)
|
52
65
|
* [Recent Builds Branch](#recent_builds_branch)
|
53
66
|
* [Settings](#settings)
|
67
|
+
* [Set Envvar](#set_envvar)
|
54
68
|
* [SSH Key](#ssh_key)
|
55
69
|
* [Unfollow](#unfollow)
|
56
70
|
* [Build](#build)
|
@@ -393,6 +407,23 @@ Example response
|
|
393
407
|
}
|
394
408
|
```
|
395
409
|
|
410
|
+
#### [envvar](#envvar)
|
411
|
+
|
412
|
+
Endpoint: `/project/:username/:project/envvar`
|
413
|
+
|
414
|
+
Get a list of environment variables for a project
|
415
|
+
|
416
|
+
```ruby
|
417
|
+
res = CircleCi::Project.envvar 'username', 'repo'
|
418
|
+
res.success?
|
419
|
+
```
|
420
|
+
|
421
|
+
Example response
|
422
|
+
|
423
|
+
```javascript
|
424
|
+
[{"name":"foo","value":"xxxx"}]
|
425
|
+
```
|
426
|
+
|
396
427
|
#### [follow](#follow)
|
397
428
|
|
398
429
|
Endpoint: `/project/:username/:repository/follow`
|
@@ -645,6 +676,24 @@ Example response
|
|
645
676
|
}
|
646
677
|
```
|
647
678
|
|
679
|
+
#### [set_envvar](#set_envvar)
|
680
|
+
|
681
|
+
Endpoint: `/project/:username/:project/envvar`
|
682
|
+
|
683
|
+
Creates a new environment variable for a project
|
684
|
+
|
685
|
+
```ruby
|
686
|
+
environment = { name: 'foo', value: 'bar' }
|
687
|
+
res = CircleCi::Project.envvar 'username', 'repo', environment
|
688
|
+
res.success?
|
689
|
+
```
|
690
|
+
|
691
|
+
Example response
|
692
|
+
|
693
|
+
```javascript
|
694
|
+
{"name":"foo","value":"xxxx"}
|
695
|
+
```
|
696
|
+
|
648
697
|
#### [ssh_key](#ssh_key)
|
649
698
|
|
650
699
|
Endpoint: `/project/:username/:repository/ssh-key`
|
data/lib/circleci.rb
CHANGED
@@ -2,23 +2,25 @@ require 'json'
|
|
2
2
|
require 'rest-client'
|
3
3
|
require 'net/http'
|
4
4
|
|
5
|
-
files = [
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
5
|
+
files = %w[
|
6
|
+
build
|
7
|
+
config
|
8
|
+
http
|
9
|
+
project
|
10
|
+
request_error
|
11
|
+
response
|
12
|
+
user
|
13
13
|
]
|
14
14
|
|
15
15
|
files.each { |path| require_relative "./circleci/#{path}" }
|
16
16
|
|
17
|
-
|
17
|
+
##
|
18
|
+
#
|
19
|
+
# CircleCi module configured to for endpoint interactions
|
18
20
|
module CircleCi
|
21
|
+
module_function
|
19
22
|
|
20
|
-
|
21
|
-
|
23
|
+
##
|
22
24
|
#
|
23
25
|
# @example Configure CircleCi with your token
|
24
26
|
# CircleCi.configure do |config|
|
@@ -29,6 +31,7 @@ module CircleCi
|
|
29
31
|
yield config
|
30
32
|
end
|
31
33
|
|
34
|
+
##
|
32
35
|
#
|
33
36
|
# @return [CircleCi::Config]
|
34
37
|
|
@@ -53,5 +56,4 @@ module CircleCi
|
|
53
56
|
def organization(name, params = {})
|
54
57
|
http.get "/organization/#{name}", params
|
55
58
|
end
|
56
|
-
|
57
59
|
end
|
data/lib/circleci/build.rb
CHANGED
@@ -1,15 +1,8 @@
|
|
1
1
|
module CircleCi
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
# Class for managing builds for a project
|
6
|
-
|
2
|
+
##
|
3
|
+
#
|
4
|
+
# Class for interacting with and managing builds
|
7
5
|
class Build
|
8
|
-
|
9
|
-
##
|
10
|
-
#
|
11
|
-
# Class for interacting with and managing builds
|
12
|
-
|
13
6
|
##
|
14
7
|
#
|
15
8
|
# Get artifacts for a specific build of a project
|
@@ -19,7 +12,7 @@ module CircleCi
|
|
19
12
|
# @param build [String] - Build ID
|
20
13
|
# @return [CircleCi::Response] - Response object
|
21
14
|
|
22
|
-
def self.artifacts
|
15
|
+
def self.artifacts(username, project, build)
|
23
16
|
CircleCi.http.get "/project/#{username}/#{project}/#{build}/artifacts"
|
24
17
|
end
|
25
18
|
|
@@ -32,7 +25,7 @@ module CircleCi
|
|
32
25
|
# @param build [String] - Build ID
|
33
26
|
# @return [CircleCi::Response] - Response object
|
34
27
|
|
35
|
-
def self.cancel
|
28
|
+
def self.cancel(username, project, build)
|
36
29
|
CircleCi.http.post "/project/#{username}/#{project}/#{build}/cancel"
|
37
30
|
end
|
38
31
|
|
@@ -45,7 +38,7 @@ module CircleCi
|
|
45
38
|
# @param build [String] - Build ID
|
46
39
|
# @return [CircleCi::Response] - Response object
|
47
40
|
|
48
|
-
def self.get
|
41
|
+
def self.get(username, project, build)
|
49
42
|
CircleCi.http.get "/project/#{username}/#{project}/#{build}"
|
50
43
|
end
|
51
44
|
|
@@ -58,7 +51,7 @@ module CircleCi
|
|
58
51
|
# @param build [String] - Build ID
|
59
52
|
# @return [CircleCi::Response] - Response object
|
60
53
|
|
61
|
-
def self.retry
|
54
|
+
def self.retry(username, project, build)
|
62
55
|
CircleCi.http.post "/project/#{username}/#{project}/#{build}/retry"
|
63
56
|
end
|
64
57
|
|
@@ -71,10 +64,8 @@ module CircleCi
|
|
71
64
|
# @param build [String] - Build ID
|
72
65
|
# @return [CircleCi::Response] - Response object
|
73
66
|
|
74
|
-
def self.tests
|
67
|
+
def self.tests(username, project, build)
|
75
68
|
CircleCi.http.get "/project/#{username}/#{project}/#{build}/tests"
|
76
69
|
end
|
77
|
-
|
78
70
|
end
|
79
|
-
|
80
71
|
end
|
data/lib/circleci/config.rb
CHANGED
@@ -3,14 +3,13 @@ module CircleCi
|
|
3
3
|
#
|
4
4
|
# Config class used internally.
|
5
5
|
# Configure API calls using AlPapi.configure
|
6
|
-
|
7
6
|
class Config
|
8
|
-
|
9
|
-
|
10
|
-
|
7
|
+
DEFAULT_VERSION = 'v1'.freeze
|
8
|
+
DEFAULT_HOST = 'https://circleci.com'.freeze
|
9
|
+
DEFAULT_URI = "#{DEFAULT_HOST}/api/#{DEFAULT_VERSION}".freeze
|
11
10
|
DEFAULT_PORT = 80
|
12
11
|
|
13
|
-
attr_accessor :token, :host, :port
|
12
|
+
attr_accessor :token, :host, :port, :version
|
14
13
|
|
15
14
|
##
|
16
15
|
#
|
@@ -19,8 +18,23 @@ module CircleCi
|
|
19
18
|
def initialize
|
20
19
|
@host = DEFAULT_HOST
|
21
20
|
@port = DEFAULT_PORT
|
21
|
+
@version = DEFAULT_VERSION
|
22
22
|
end
|
23
23
|
|
24
|
-
|
24
|
+
def uri
|
25
|
+
base = @host
|
26
|
+
base += ":#{@port}" unless port_80? || host_has_port?
|
27
|
+
base + "/api/#{@version}"
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
25
31
|
|
32
|
+
def port_80?
|
33
|
+
@port == DEFAULT_PORT
|
34
|
+
end
|
35
|
+
|
36
|
+
def host_has_port?
|
37
|
+
@host =~ /:\d{1,7}$/
|
38
|
+
end
|
39
|
+
end
|
26
40
|
end
|
data/lib/circleci/http.rb
CHANGED
@@ -1,13 +1,18 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
module CircleCi
|
4
|
-
|
4
|
+
##
|
5
|
+
#
|
6
|
+
# Http class handles all HTTP requests
|
5
7
|
class Http # @private
|
6
|
-
|
7
8
|
attr_accessor :errors, :response, :success, :config, :over_limit, :suspended
|
8
9
|
|
9
|
-
def initialize(
|
10
|
-
@config
|
10
|
+
def initialize(config)
|
11
|
+
@config = config
|
12
|
+
@errors = []
|
13
|
+
@success = false
|
14
|
+
@over_limit = false
|
15
|
+
@suspended = false
|
11
16
|
end
|
12
17
|
|
13
18
|
def get(path, params = {})
|
@@ -31,18 +36,15 @@ module CircleCi
|
|
31
36
|
end
|
32
37
|
|
33
38
|
def create_request_args(http_verb, url, body)
|
34
|
-
if http_verb ==
|
35
|
-
return [http_verb, url, body, headers]
|
36
|
-
end
|
37
|
-
|
39
|
+
return [http_verb, url, body, headers] if http_verb == 'post'
|
38
40
|
[http_verb, url, headers]
|
39
41
|
end
|
40
42
|
|
41
43
|
def request(http_verb, path, body = {})
|
42
|
-
url = "#{@config.
|
44
|
+
url = "#{@config.uri}#{path}"
|
43
45
|
args = create_request_args http_verb, url, body
|
44
46
|
|
45
|
-
RestClient.send(*args) do |res,
|
47
|
+
RestClient.send(*args) do |res, _, raw_res|
|
46
48
|
body = res.body.to_s
|
47
49
|
body.force_encoding(Encoding::UTF_8)
|
48
50
|
code = raw_res.code.to_i
|
@@ -55,22 +57,27 @@ module CircleCi
|
|
55
57
|
end
|
56
58
|
end
|
57
59
|
|
60
|
+
def parsed_body(body)
|
61
|
+
JSON.parse(body)
|
62
|
+
rescue
|
63
|
+
nil
|
64
|
+
end
|
65
|
+
|
58
66
|
def handle_response(body, code, path)
|
59
|
-
parsed =
|
60
|
-
successful_code = (200..299).
|
67
|
+
parsed = parsed_body(body)
|
68
|
+
successful_code = (200..299).cover?(code)
|
61
69
|
self.response = parsed if parsed
|
70
|
+
self.success = true
|
62
71
|
|
63
72
|
# Some responses are empty but are successful
|
64
73
|
if body == '""' && successful_code
|
65
74
|
self.response = ''
|
66
|
-
self.success = true
|
67
75
|
elsif parsed && successful_code
|
68
|
-
|
76
|
+
# Response is successful
|
69
77
|
else
|
70
|
-
self.
|
78
|
+
self.success = false
|
79
|
+
self.errors = [RequestError.new(body, code, path)]
|
71
80
|
end
|
72
81
|
end
|
73
|
-
|
74
82
|
end
|
75
|
-
|
76
83
|
end
|
data/lib/circleci/project.rb
CHANGED
@@ -1,11 +1,8 @@
|
|
1
1
|
module CircleCi
|
2
|
-
|
3
2
|
##
|
4
3
|
#
|
5
4
|
# Class for interacting with Projects
|
6
|
-
|
7
5
|
class Project
|
8
|
-
|
9
6
|
##
|
10
7
|
#
|
11
8
|
# Return all projects for your API key
|
@@ -24,7 +21,7 @@ module CircleCi
|
|
24
21
|
# @param project [String] - Name of project
|
25
22
|
# @return [CircleCi::Response] - Response object
|
26
23
|
|
27
|
-
def self.build
|
24
|
+
def self.build(username, project)
|
28
25
|
CircleCi.http.post "/project/#{username}/#{project}"
|
29
26
|
end
|
30
27
|
|
@@ -38,9 +35,9 @@ module CircleCi
|
|
38
35
|
# @param build_parameters [Hash] - Optional Build Parameters
|
39
36
|
# @return [CircleCi::Response] - Response object
|
40
37
|
|
41
|
-
def self.build_branch
|
38
|
+
def self.build_branch(username, project, branch, build_parameters = {})
|
42
39
|
body = {}
|
43
|
-
body[
|
40
|
+
body['build_parameters'] = build_parameters unless build_parameters.empty?
|
44
41
|
CircleCi.http.post "/project/#{username}/#{project}/tree/#{branch}", {}, body
|
45
42
|
end
|
46
43
|
|
@@ -54,7 +51,7 @@ module CircleCi
|
|
54
51
|
# @param key [String] - The ssh private key
|
55
52
|
# @param hostname [String] - The hostname identified by the key
|
56
53
|
# @return [CircleCi::Response] - Response object
|
57
|
-
def self.build_ssh_key
|
54
|
+
def self.build_ssh_key(username, project, build, key, hostname)
|
58
55
|
body = { hostname: hostname, private_key: key }
|
59
56
|
CircleCi.http.post "/project/#{username}/#{project}/#{build}/ssh-users", {}, body
|
60
57
|
end
|
@@ -67,7 +64,7 @@ module CircleCi
|
|
67
64
|
# @param project [String] - Name of project
|
68
65
|
# @return [CircleCi::Response] - Response object
|
69
66
|
|
70
|
-
def self.clear_cache
|
67
|
+
def self.clear_cache(username, project)
|
71
68
|
CircleCi.http.delete "/project/#{username}/#{project}/build-cache"
|
72
69
|
end
|
73
70
|
|
@@ -80,7 +77,7 @@ module CircleCi
|
|
80
77
|
# @param fingerprint [String] - Fingerprint of a checkout key
|
81
78
|
# @return [CircleCi::Response] - Response object
|
82
79
|
|
83
|
-
def self.delete_checkout_key
|
80
|
+
def self.delete_checkout_key(username, project, fingerprint)
|
84
81
|
CircleCi.http.delete "/project/#{username}/#{project}/checkout-key/#{fingerprint}"
|
85
82
|
end
|
86
83
|
|
@@ -93,10 +90,36 @@ module CircleCi
|
|
93
90
|
# @param project [String] - Name of project
|
94
91
|
# @return [CircleCi::Response] - Response object
|
95
92
|
|
96
|
-
def self.enable
|
93
|
+
def self.enable(username, project)
|
97
94
|
CircleCi.http.post "/project/#{username}/#{project}/enable"
|
98
95
|
end
|
99
96
|
|
97
|
+
##
|
98
|
+
#
|
99
|
+
# Get the project envvars
|
100
|
+
#
|
101
|
+
# @param username [String] - User or org name who owns project
|
102
|
+
# @param project [String] - Name of project
|
103
|
+
# @return [CircleCi::Response] - Response object
|
104
|
+
|
105
|
+
def self.envvars(username, project)
|
106
|
+
CircleCi.http.get "/project/#{username}/#{project}/envvar"
|
107
|
+
end
|
108
|
+
|
109
|
+
##
|
110
|
+
#
|
111
|
+
# Sets an envvar for a project
|
112
|
+
#
|
113
|
+
# @param username [String] - User or org name who owns project
|
114
|
+
# @param project [String] - Name of project
|
115
|
+
# @param envvar [Hash] - {name: 'foo', value: 'bar'}
|
116
|
+
# @return [CircleCi::Response] - Response object
|
117
|
+
|
118
|
+
def self.set_envvar(username, project, envvar)
|
119
|
+
body = envvar
|
120
|
+
CircleCi.http.post "/project/#{username}/#{project}/envvar", {}, body
|
121
|
+
end
|
122
|
+
|
100
123
|
##
|
101
124
|
#
|
102
125
|
# Follow the project
|
@@ -105,7 +128,7 @@ module CircleCi
|
|
105
128
|
# @param project [String] - Name of project
|
106
129
|
# @return [CircleCi::Response] - Response object
|
107
130
|
|
108
|
-
def self.follow
|
131
|
+
def self.follow(username, project)
|
109
132
|
CircleCi.http.post "/project/#{username}/#{project}/follow"
|
110
133
|
end
|
111
134
|
|
@@ -118,7 +141,7 @@ module CircleCi
|
|
118
141
|
# @param fingerprint [String] - Fingerprint of a checkout key
|
119
142
|
# @return [CircleCi::Response] - Response object
|
120
143
|
|
121
|
-
def self.get_checkout_key
|
144
|
+
def self.get_checkout_key(username, project, fingerprint)
|
122
145
|
CircleCi.http.get "/project/#{username}/#{project}/checkout-key/#{fingerprint}"
|
123
146
|
end
|
124
147
|
|
@@ -130,7 +153,7 @@ module CircleCi
|
|
130
153
|
# @param project [String] - Name of project
|
131
154
|
# @return [CircleCi::Response] - Response object
|
132
155
|
|
133
|
-
def self.list_checkout_keys
|
156
|
+
def self.list_checkout_keys(username, project)
|
134
157
|
CircleCi.http.get "/project/#{username}/#{project}/checkout-key"
|
135
158
|
end
|
136
159
|
|
@@ -143,7 +166,7 @@ module CircleCi
|
|
143
166
|
# @param type [String] - The type of key to create. Can be 'deploy-key' or 'github-user-key'.
|
144
167
|
# @return [CircleCi::Response] - Response object
|
145
168
|
|
146
|
-
def self.new_checkout_key
|
169
|
+
def self.new_checkout_key(username, project, type)
|
147
170
|
body = { type: type }
|
148
171
|
CircleCi.http.post "/project/#{username}/#{project}/checkout-key", {}, body
|
149
172
|
end
|
@@ -156,7 +179,7 @@ module CircleCi
|
|
156
179
|
# @param project [String] - Name of project
|
157
180
|
# @return [CircleCi::Response] - Response object
|
158
181
|
|
159
|
-
def self.recent_builds
|
182
|
+
def self.recent_builds(username, project)
|
160
183
|
CircleCi.http.get "/project/#{username}/#{project}"
|
161
184
|
end
|
162
185
|
|
@@ -169,7 +192,7 @@ module CircleCi
|
|
169
192
|
# @param branch [String] - Name of branch
|
170
193
|
# @return [CircleCi::Response] - Response object
|
171
194
|
|
172
|
-
def self.recent_builds_branch
|
195
|
+
def self.recent_builds_branch(username, project, branch)
|
173
196
|
CircleCi.http.get "/project/#{username}/#{project}/tree/#{branch}"
|
174
197
|
end
|
175
198
|
|
@@ -181,7 +204,7 @@ module CircleCi
|
|
181
204
|
# @param project [String] - Name of project
|
182
205
|
# @return [CircleCi::Response] - Response object
|
183
206
|
|
184
|
-
def self.settings
|
207
|
+
def self.settings(username, project)
|
185
208
|
CircleCi.http.get "/project/#{username}/#{project}/settings"
|
186
209
|
end
|
187
210
|
|
@@ -194,7 +217,8 @@ module CircleCi
|
|
194
217
|
# @param key [String] - The ssh private key
|
195
218
|
# @param hostname [String] - The hostname identified by the key
|
196
219
|
# @return [CircleCi::Response] - Response object
|
197
|
-
|
220
|
+
|
221
|
+
def self.ssh_key(username, project, key, hostname)
|
198
222
|
body = { hostname: hostname, private_key: key }
|
199
223
|
CircleCi.http.post "/project/#{username}/#{project}/ssh-key", {}, body
|
200
224
|
end
|
@@ -207,11 +231,8 @@ module CircleCi
|
|
207
231
|
# @param project [String] - Name of project
|
208
232
|
# @return [CircleCi::Response] - Response object
|
209
233
|
|
210
|
-
def self.unfollow
|
234
|
+
def self.unfollow(username, project)
|
211
235
|
CircleCi.http.post "/project/#{username}/#{project}/unfollow"
|
212
236
|
end
|
213
|
-
|
214
237
|
end
|
215
|
-
|
216
238
|
end
|
217
|
-
|
@@ -1,13 +1,14 @@
|
|
1
1
|
module CircleCi
|
2
|
-
|
2
|
+
##
|
3
|
+
#
|
4
|
+
# RequestError takes http request info to raise more meaningful errors
|
3
5
|
class RequestError
|
4
|
-
|
5
6
|
attr_reader :message, :code, :path
|
6
7
|
|
7
|
-
def initialize(
|
8
|
-
@message
|
8
|
+
def initialize(err_message, err_code, err_path) # @private
|
9
|
+
@message = err_message
|
10
|
+
@code = err_code
|
11
|
+
@path = err_path
|
9
12
|
end
|
10
|
-
|
11
13
|
end
|
12
|
-
|
13
14
|
end
|
data/lib/circleci/response.rb
CHANGED
@@ -1,16 +1,20 @@
|
|
1
1
|
module CircleCi
|
2
|
-
|
2
|
+
##
|
3
|
+
#
|
4
|
+
# Response class is used to get access to raw HTTP request info
|
3
5
|
class Response
|
4
|
-
|
5
6
|
attr_reader :success, :body, :errors, :code, :path
|
6
7
|
##
|
7
8
|
# Initializing response object to be returned from API calls, used internally.
|
8
9
|
#
|
9
10
|
# @private
|
10
11
|
|
11
|
-
def initialize(http,
|
12
|
-
@success
|
13
|
-
@
|
12
|
+
def initialize(http, resp_code, resp_path) # @private
|
13
|
+
@success = http.success
|
14
|
+
@body = http.response
|
15
|
+
@errors = http.errors
|
16
|
+
@code = resp_code
|
17
|
+
@path = resp_path
|
14
18
|
end
|
15
19
|
|
16
20
|
##
|
@@ -19,7 +23,7 @@ module CircleCi
|
|
19
23
|
# @return [Boolean]
|
20
24
|
|
21
25
|
def success?
|
22
|
-
|
26
|
+
@success == true
|
23
27
|
end
|
24
28
|
|
25
29
|
##
|
@@ -31,7 +35,5 @@ module CircleCi
|
|
31
35
|
def parsed_body
|
32
36
|
@body
|
33
37
|
end
|
34
|
-
|
35
38
|
end
|
36
|
-
|
37
39
|
end
|
data/lib/circleci/user.rb
CHANGED
@@ -1,11 +1,8 @@
|
|
1
1
|
module CircleCi
|
2
|
-
|
3
2
|
##
|
4
3
|
#
|
5
|
-
#
|
6
|
-
|
4
|
+
# User class to access user details for a specific API key
|
7
5
|
class User
|
8
|
-
|
9
6
|
##
|
10
7
|
#
|
11
8
|
# Get user account details
|
@@ -22,11 +19,9 @@ module CircleCi
|
|
22
19
|
#
|
23
20
|
# @param apikey [String] - The Heroku API key
|
24
21
|
# @return [CircleCi::Response] - Response object
|
25
|
-
def self.heroku_key
|
22
|
+
def self.heroku_key(apikey)
|
26
23
|
body = { apikey: apikey }
|
27
24
|
CircleCi.http.post '/user/heroku-key', {}, body
|
28
25
|
end
|
29
|
-
|
30
26
|
end
|
31
|
-
|
32
27
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: circleci
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chavez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-02-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -30,28 +30,40 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.8.
|
33
|
+
version: 0.8.11
|
34
|
+
- - ">="
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: 0.8.11
|
34
37
|
type: :development
|
35
38
|
prerelease: false
|
36
39
|
version_requirements: !ruby/object:Gem::Requirement
|
37
40
|
requirements:
|
38
41
|
- - "~>"
|
39
42
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.8.
|
43
|
+
version: 0.8.11
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 0.8.11
|
41
47
|
- !ruby/object:Gem::Dependency
|
42
48
|
name: dotenv
|
43
49
|
requirement: !ruby/object:Gem::Requirement
|
44
50
|
requirements:
|
45
51
|
- - "~>"
|
46
52
|
- !ruby/object:Gem::Version
|
47
|
-
version: 2.0
|
53
|
+
version: 2.1.0
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: 2.1.0
|
48
57
|
type: :development
|
49
58
|
prerelease: false
|
50
59
|
version_requirements: !ruby/object:Gem::Requirement
|
51
60
|
requirements:
|
52
61
|
- - "~>"
|
53
62
|
- !ruby/object:Gem::Version
|
54
|
-
version: 2.0
|
63
|
+
version: 2.1.0
|
64
|
+
- - ">="
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: 2.1.0
|
55
67
|
- !ruby/object:Gem::Dependency
|
56
68
|
name: gemcutter
|
57
69
|
requirement: !ruby/object:Gem::Requirement
|
@@ -59,6 +71,9 @@ dependencies:
|
|
59
71
|
- - "~>"
|
60
72
|
- !ruby/object:Gem::Version
|
61
73
|
version: 0.7.1
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: 0.7.1
|
62
77
|
type: :development
|
63
78
|
prerelease: false
|
64
79
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -66,6 +81,29 @@ dependencies:
|
|
66
81
|
- - "~>"
|
67
82
|
- !ruby/object:Gem::Version
|
68
83
|
version: 0.7.1
|
84
|
+
- - ">="
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: 0.7.1
|
87
|
+
- !ruby/object:Gem::Dependency
|
88
|
+
name: multi_json
|
89
|
+
requirement: !ruby/object:Gem::Requirement
|
90
|
+
requirements:
|
91
|
+
- - "~>"
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: 1.11.2
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 1.11.2
|
97
|
+
type: :development
|
98
|
+
prerelease: false
|
99
|
+
version_requirements: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 1.11.2
|
104
|
+
- - ">="
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: 1.11.2
|
69
107
|
- !ruby/object:Gem::Dependency
|
70
108
|
name: pry
|
71
109
|
requirement: !ruby/object:Gem::Requirement
|
@@ -73,6 +111,9 @@ dependencies:
|
|
73
111
|
- - "~>"
|
74
112
|
- !ruby/object:Gem::Version
|
75
113
|
version: 0.10.3
|
114
|
+
- - ">="
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: 0.10.3
|
76
117
|
type: :development
|
77
118
|
prerelease: false
|
78
119
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -80,46 +121,49 @@ dependencies:
|
|
80
121
|
- - "~>"
|
81
122
|
- !ruby/object:Gem::Version
|
82
123
|
version: 0.10.3
|
124
|
+
- - ">="
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
version: 0.10.3
|
83
127
|
- !ruby/object:Gem::Dependency
|
84
128
|
name: rake
|
85
129
|
requirement: !ruby/object:Gem::Requirement
|
86
130
|
requirements:
|
87
131
|
- - "~>"
|
88
132
|
- !ruby/object:Gem::Version
|
89
|
-
version: 10.
|
133
|
+
version: 10.5.0
|
90
134
|
- - ">="
|
91
135
|
- !ruby/object:Gem::Version
|
92
|
-
version: 10.
|
136
|
+
version: 10.5.0
|
93
137
|
type: :development
|
94
138
|
prerelease: false
|
95
139
|
version_requirements: !ruby/object:Gem::Requirement
|
96
140
|
requirements:
|
97
141
|
- - "~>"
|
98
142
|
- !ruby/object:Gem::Version
|
99
|
-
version: 10.
|
143
|
+
version: 10.5.0
|
100
144
|
- - ">="
|
101
145
|
- !ruby/object:Gem::Version
|
102
|
-
version: 10.
|
146
|
+
version: 10.5.0
|
103
147
|
- !ruby/object:Gem::Dependency
|
104
148
|
name: redcarpet
|
105
149
|
requirement: !ruby/object:Gem::Requirement
|
106
150
|
requirements:
|
107
151
|
- - "~>"
|
108
152
|
- !ruby/object:Gem::Version
|
109
|
-
version: 3.
|
153
|
+
version: 3.3.4
|
110
154
|
- - ">="
|
111
155
|
- !ruby/object:Gem::Version
|
112
|
-
version: 3.
|
156
|
+
version: 3.3.4
|
113
157
|
type: :development
|
114
158
|
prerelease: false
|
115
159
|
version_requirements: !ruby/object:Gem::Requirement
|
116
160
|
requirements:
|
117
161
|
- - "~>"
|
118
162
|
- !ruby/object:Gem::Version
|
119
|
-
version: 3.
|
163
|
+
version: 3.3.4
|
120
164
|
- - ">="
|
121
165
|
- !ruby/object:Gem::Version
|
122
|
-
version: 3.
|
166
|
+
version: 3.3.4
|
123
167
|
- !ruby/object:Gem::Dependency
|
124
168
|
name: rspec
|
125
169
|
requirement: !ruby/object:Gem::Requirement
|
@@ -140,80 +184,106 @@ dependencies:
|
|
140
184
|
- - ">="
|
141
185
|
- !ruby/object:Gem::Version
|
142
186
|
version: 2.14.1
|
187
|
+
- !ruby/object:Gem::Dependency
|
188
|
+
name: rubocop
|
189
|
+
requirement: !ruby/object:Gem::Requirement
|
190
|
+
requirements:
|
191
|
+
- - "~>"
|
192
|
+
- !ruby/object:Gem::Version
|
193
|
+
version: 0.37.2
|
194
|
+
- - ">="
|
195
|
+
- !ruby/object:Gem::Version
|
196
|
+
version: 0.37.2
|
197
|
+
type: :development
|
198
|
+
prerelease: false
|
199
|
+
version_requirements: !ruby/object:Gem::Requirement
|
200
|
+
requirements:
|
201
|
+
- - "~>"
|
202
|
+
- !ruby/object:Gem::Version
|
203
|
+
version: 0.37.2
|
204
|
+
- - ">="
|
205
|
+
- !ruby/object:Gem::Version
|
206
|
+
version: 0.37.2
|
143
207
|
- !ruby/object:Gem::Dependency
|
144
208
|
name: simplecov
|
145
209
|
requirement: !ruby/object:Gem::Requirement
|
146
210
|
requirements:
|
147
211
|
- - "~>"
|
148
212
|
- !ruby/object:Gem::Version
|
149
|
-
version: 0.11.
|
213
|
+
version: 0.11.2
|
150
214
|
- - ">="
|
151
215
|
- !ruby/object:Gem::Version
|
152
|
-
version: 0.11.
|
216
|
+
version: 0.11.2
|
153
217
|
type: :development
|
154
218
|
prerelease: false
|
155
219
|
version_requirements: !ruby/object:Gem::Requirement
|
156
220
|
requirements:
|
157
221
|
- - "~>"
|
158
222
|
- !ruby/object:Gem::Version
|
159
|
-
version: 0.11.
|
223
|
+
version: 0.11.2
|
160
224
|
- - ">="
|
161
225
|
- !ruby/object:Gem::Version
|
162
|
-
version: 0.11.
|
226
|
+
version: 0.11.2
|
163
227
|
- !ruby/object:Gem::Dependency
|
164
228
|
name: typhoeus
|
165
229
|
requirement: !ruby/object:Gem::Requirement
|
166
230
|
requirements:
|
167
231
|
- - "~>"
|
168
232
|
- !ruby/object:Gem::Version
|
169
|
-
version: 0.
|
233
|
+
version: 1.0.1
|
234
|
+
- - ">="
|
235
|
+
- !ruby/object:Gem::Version
|
236
|
+
version: 1.0.1
|
170
237
|
type: :development
|
171
238
|
prerelease: false
|
172
239
|
version_requirements: !ruby/object:Gem::Requirement
|
173
240
|
requirements:
|
174
241
|
- - "~>"
|
175
242
|
- !ruby/object:Gem::Version
|
176
|
-
version: 0.
|
243
|
+
version: 1.0.1
|
244
|
+
- - ">="
|
245
|
+
- !ruby/object:Gem::Version
|
246
|
+
version: 1.0.1
|
177
247
|
- !ruby/object:Gem::Dependency
|
178
248
|
name: vcr
|
179
249
|
requirement: !ruby/object:Gem::Requirement
|
180
250
|
requirements:
|
181
251
|
- - "~>"
|
182
252
|
- !ruby/object:Gem::Version
|
183
|
-
version:
|
253
|
+
version: 3.0.1
|
184
254
|
- - ">="
|
185
255
|
- !ruby/object:Gem::Version
|
186
|
-
version:
|
256
|
+
version: 3.0.1
|
187
257
|
type: :development
|
188
258
|
prerelease: false
|
189
259
|
version_requirements: !ruby/object:Gem::Requirement
|
190
260
|
requirements:
|
191
261
|
- - "~>"
|
192
262
|
- !ruby/object:Gem::Version
|
193
|
-
version:
|
263
|
+
version: 3.0.1
|
194
264
|
- - ">="
|
195
265
|
- !ruby/object:Gem::Version
|
196
|
-
version:
|
266
|
+
version: 3.0.1
|
197
267
|
- !ruby/object:Gem::Dependency
|
198
268
|
name: webmock
|
199
269
|
requirement: !ruby/object:Gem::Requirement
|
200
270
|
requirements:
|
201
271
|
- - "~>"
|
202
272
|
- !ruby/object:Gem::Version
|
203
|
-
version: 1.
|
273
|
+
version: 1.24.0
|
204
274
|
- - ">="
|
205
275
|
- !ruby/object:Gem::Version
|
206
|
-
version: 1.
|
276
|
+
version: 1.24.0
|
207
277
|
type: :development
|
208
278
|
prerelease: false
|
209
279
|
version_requirements: !ruby/object:Gem::Requirement
|
210
280
|
requirements:
|
211
281
|
- - "~>"
|
212
282
|
- !ruby/object:Gem::Version
|
213
|
-
version: 1.
|
283
|
+
version: 1.24.0
|
214
284
|
- - ">="
|
215
285
|
- !ruby/object:Gem::Version
|
216
|
-
version: 1.
|
286
|
+
version: 1.24.0
|
217
287
|
- !ruby/object:Gem::Dependency
|
218
288
|
name: yard
|
219
289
|
requirement: !ruby/object:Gem::Requirement
|
@@ -223,7 +293,7 @@ dependencies:
|
|
223
293
|
version: 0.8.7
|
224
294
|
- - ">="
|
225
295
|
- !ruby/object:Gem::Version
|
226
|
-
version: 0.8.7
|
296
|
+
version: 0.8.7
|
227
297
|
type: :development
|
228
298
|
prerelease: false
|
229
299
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -233,9 +303,9 @@ dependencies:
|
|
233
303
|
version: 0.8.7
|
234
304
|
- - ">="
|
235
305
|
- !ruby/object:Gem::Version
|
236
|
-
version: 0.8.7
|
306
|
+
version: 0.8.7
|
237
307
|
description: Ruby gem for Circle CI REST API
|
238
|
-
email: chavez
|
308
|
+
email: contact@el-chavez.me
|
239
309
|
executables: []
|
240
310
|
extensions: []
|
241
311
|
extra_rdoc_files:
|
@@ -256,7 +326,8 @@ licenses:
|
|
256
326
|
metadata: {}
|
257
327
|
post_install_message:
|
258
328
|
rdoc_options:
|
259
|
-
- "--charset=UTF-8
|
329
|
+
- "--charset=UTF-8"
|
330
|
+
- "--main=README.md"
|
260
331
|
require_paths:
|
261
332
|
- lib
|
262
333
|
required_ruby_version: !ruby/object:Gem::Requirement
|