wercker_api 0.1.7 → 0.1.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/wercker_api/application/workflow.rb +83 -0
- data/lib/wercker_api/application/workflow_collection.rb +7 -0
- data/lib/wercker_api/application.rb +3 -37
- data/lib/wercker_api/client.rb +21 -0
- data/lib/wercker_api/owner.rb +35 -0
- data/lib/wercker_api/pipeline.rb +25 -0
- data/lib/wercker_api/run.rb +57 -0
- data/lib/wercker_api/run_collection.rb +5 -0
- data/lib/wercker_api/scm.rb +9 -0
- data/lib/wercker_api/version.rb +1 -1
- data/lib/wercker_api.rb +7 -0
- metadata +8 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fbcea0114dde6a76e5f0b6ca16e92b5b28173dd6
|
4
|
+
data.tar.gz: f6dc02766a548e7c3ac6eea58899471c43a3afca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e0a73f7f89379a92f556c9def31516f17e48457a9a545f242d0e885d15de5080d24683e02cdf826b10bd9c36ec7b9ac18eacea88e4e173a73462e2720d926d57
|
7
|
+
data.tar.gz: 743494ca9e7ddcc5dcc5f9e5418562d83f983fef30a54770abffb9772c134d0c6e289cb9c34e487b6f1c85a36599ba3fa28333769f43d4ccbbe6f8b004532651
|
@@ -0,0 +1,83 @@
|
|
1
|
+
module WerckerAPI
|
2
|
+
class Application
|
3
|
+
class Data
|
4
|
+
include Virtus.model
|
5
|
+
attribute :branch, String
|
6
|
+
attribute :commitHash, String
|
7
|
+
attribute :message, String
|
8
|
+
attribute :scm, SCM
|
9
|
+
|
10
|
+
def commit_hash
|
11
|
+
commitHash
|
12
|
+
end
|
13
|
+
end
|
14
|
+
class PipelineItem
|
15
|
+
include Virtus.model
|
16
|
+
|
17
|
+
attribute :targetName, String
|
18
|
+
attribute :pipelineId, String
|
19
|
+
attribute :restricted, Boolean
|
20
|
+
attribute :totalSteps, Integer
|
21
|
+
attribute :currentStep, Integer
|
22
|
+
attribute :stepName, String
|
23
|
+
attribute :runId, String
|
24
|
+
|
25
|
+
def step_name
|
26
|
+
stepName
|
27
|
+
end
|
28
|
+
|
29
|
+
def run_id
|
30
|
+
runId
|
31
|
+
end
|
32
|
+
|
33
|
+
def pipeline_id
|
34
|
+
pipelineId
|
35
|
+
end
|
36
|
+
|
37
|
+
def total_steps
|
38
|
+
totalSteps
|
39
|
+
end
|
40
|
+
|
41
|
+
def current_step
|
42
|
+
currentStep
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
class Item
|
47
|
+
include Virtus.model
|
48
|
+
|
49
|
+
attribute :data, PipelineItem
|
50
|
+
attribute :id, String
|
51
|
+
attribute :progress, Integer
|
52
|
+
attribute :result, String
|
53
|
+
attribute :status, String
|
54
|
+
attribute :type, String
|
55
|
+
attribute :updatedAt, Time
|
56
|
+
|
57
|
+
def updated_at
|
58
|
+
updatedAt
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
class Workflow
|
63
|
+
INDEX = -> (version) { "/api/#{version}/workflows" }
|
64
|
+
SHOW = -> (version, workflow_id) { "/api/#{version}/workflows/#{workflow_id}" }
|
65
|
+
|
66
|
+
include Virtus.model
|
67
|
+
|
68
|
+
attribute :id, String
|
69
|
+
attribute :url, String
|
70
|
+
attribute :theme, String
|
71
|
+
attribute :trigger, String
|
72
|
+
attribute :application, Application
|
73
|
+
attribute :createdAt, Time
|
74
|
+
attribute :updatedAt, Time
|
75
|
+
attribute :startedAt, Time
|
76
|
+
attribute :privacy, Boolean
|
77
|
+
attribute :stack, Integer
|
78
|
+
attribute :data, Data
|
79
|
+
attribute :items, Array[Item]
|
80
|
+
attribute :user, User
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
@@ -1,41 +1,4 @@
|
|
1
1
|
module WerckerAPI
|
2
|
-
class Meta
|
3
|
-
include Virtus.model
|
4
|
-
attribute :username, String
|
5
|
-
attribute :type, String
|
6
|
-
attribute :werckerEmployee, Boolean
|
7
|
-
|
8
|
-
def wercker_employee
|
9
|
-
werckerEmployee
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
class Avatar
|
14
|
-
include Virtus.model
|
15
|
-
attribute :gravatar, String
|
16
|
-
|
17
|
-
end
|
18
|
-
class Owner
|
19
|
-
include Virtus.model
|
20
|
-
attribute :type, String
|
21
|
-
attribute :userId, String
|
22
|
-
attribute :name, String
|
23
|
-
attribute :avatar, Avatar
|
24
|
-
attribute :meta, Meta
|
25
|
-
|
26
|
-
def user_id
|
27
|
-
userId
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
class SCM
|
32
|
-
include Virtus.model
|
33
|
-
attribute :type, String
|
34
|
-
attribute :owner, String
|
35
|
-
attribute :domain, String
|
36
|
-
attribute :repository, String
|
37
|
-
end
|
38
|
-
|
39
2
|
class Settings
|
40
3
|
include Virtus.model
|
41
4
|
attribute :privacy, String
|
@@ -65,6 +28,9 @@ module WerckerAPI
|
|
65
28
|
attribute :allowedActions, Array[String]
|
66
29
|
attribute :theme, String
|
67
30
|
attribute :settings, Settings
|
31
|
+
attribute :privacy, String
|
32
|
+
attribute :stack, Integer
|
33
|
+
attribute :userId, String
|
68
34
|
|
69
35
|
def badge_key
|
70
36
|
badgeKey
|
data/lib/wercker_api/client.rb
CHANGED
@@ -42,6 +42,27 @@ EOM
|
|
42
42
|
request build_get_request(Application::Deploy::INDEX[api_version, user_name, application]), Application::DeployCollection
|
43
43
|
end
|
44
44
|
|
45
|
+
def application_workflows(application_id)
|
46
|
+
request build_get_request(Application::Workflow::INDEX[api_version], applicationId: application_id), Application::WorkflowCollection
|
47
|
+
end
|
48
|
+
|
49
|
+
def application_workflow(workflow_id)
|
50
|
+
request build_get_request(Application::Workflow::SHOW[api_version, workflow_id]), Application::Workflow
|
51
|
+
end
|
52
|
+
|
53
|
+
def runs(application_id: nil, pipeline_id: nil)
|
54
|
+
params = if application_id
|
55
|
+
{ applicationId: application_id }
|
56
|
+
elsif pipeline_id
|
57
|
+
{ pipelineId: pipeline_id }
|
58
|
+
end
|
59
|
+
request build_get_request(Run::INDEX[api_version], params), RunCollection
|
60
|
+
end
|
61
|
+
|
62
|
+
def run(run_id)
|
63
|
+
request build_get_request(Run::SHOW[api_version, run_id]), Run
|
64
|
+
end
|
65
|
+
|
45
66
|
private
|
46
67
|
attr_accessor :api_token, :api_version
|
47
68
|
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module WerckerAPI
|
2
|
+
|
3
|
+
class Meta
|
4
|
+
include Virtus.model
|
5
|
+
attribute :username, String
|
6
|
+
attribute :type, String
|
7
|
+
attribute :werckerEmployee, Boolean
|
8
|
+
|
9
|
+
def wercker_employee
|
10
|
+
werckerEmployee
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
class Avatar
|
15
|
+
include Virtus.model
|
16
|
+
attribute :gravatar, String
|
17
|
+
|
18
|
+
end
|
19
|
+
|
20
|
+
class Owner
|
21
|
+
include Virtus.model
|
22
|
+
attribute :type, String
|
23
|
+
attribute :userId, String
|
24
|
+
attribute :name, String
|
25
|
+
attribute :avatar, Avatar
|
26
|
+
attribute :meta, Meta
|
27
|
+
|
28
|
+
def user_id
|
29
|
+
userId
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
class User < Owner; end
|
34
|
+
|
35
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module WerckerAPI
|
2
|
+
class Pipeline
|
3
|
+
include Virtus.model
|
4
|
+
attribute :id, String
|
5
|
+
attribute :url, String
|
6
|
+
attribute :createdAt, Time
|
7
|
+
attribute :name, String
|
8
|
+
attribute :permissions, String
|
9
|
+
attribute :pipelineName, String
|
10
|
+
attribute :setScmProviderStatus, Boolean
|
11
|
+
attribute :type, String
|
12
|
+
|
13
|
+
def created_at
|
14
|
+
createdAt
|
15
|
+
end
|
16
|
+
|
17
|
+
def pipeline_name
|
18
|
+
pipelineName
|
19
|
+
end
|
20
|
+
|
21
|
+
def set_scm_provider_status
|
22
|
+
setScmProviderStatus
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
module WerckerAPI
|
2
|
+
class Commit
|
3
|
+
|
4
|
+
include Virtus.model
|
5
|
+
|
6
|
+
attribute :_id, String
|
7
|
+
attribute :commit, String
|
8
|
+
attribute :message, String
|
9
|
+
attribute :by, String
|
10
|
+
|
11
|
+
end
|
12
|
+
|
13
|
+
class Run
|
14
|
+
INDEX = -> (version) { "/api/#{version}/runs" }
|
15
|
+
SHOW = -> (version, run_id) { "/api/#{version}/runs/#{run_id}" }
|
16
|
+
|
17
|
+
include Virtus.model
|
18
|
+
|
19
|
+
attribute :id, String
|
20
|
+
attribute :url, String
|
21
|
+
attribute :branch, String
|
22
|
+
attribute :commitHash, String
|
23
|
+
attribute :createdAt, Time
|
24
|
+
attribute :envVars, Array[String]
|
25
|
+
attribute :finishedAt, Time
|
26
|
+
attribute :message, String
|
27
|
+
attribute :progress, Integer
|
28
|
+
attribute :result, String
|
29
|
+
attribute :startedAt, Time
|
30
|
+
attribute :status, String
|
31
|
+
attribute :pullRequest, Hash
|
32
|
+
attribute :commits, Array[Commit]
|
33
|
+
attribute :sourceRun, Run
|
34
|
+
attribute :user, User
|
35
|
+
attribute :pipeline, Pipeline
|
36
|
+
|
37
|
+
def source_run
|
38
|
+
sourceRun
|
39
|
+
end
|
40
|
+
|
41
|
+
def commit_hash
|
42
|
+
commitHash
|
43
|
+
end
|
44
|
+
|
45
|
+
def created_at
|
46
|
+
createdAt
|
47
|
+
end
|
48
|
+
|
49
|
+
def finished_at
|
50
|
+
finishedAt
|
51
|
+
end
|
52
|
+
|
53
|
+
def env_vars
|
54
|
+
envVars
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
data/lib/wercker_api/version.rb
CHANGED
data/lib/wercker_api.rb
CHANGED
@@ -1,12 +1,19 @@
|
|
1
1
|
require "virtus"
|
2
2
|
require "wercker_api/version"
|
3
3
|
require "wercker_api/api_collection"
|
4
|
+
require "wercker_api/scm"
|
5
|
+
require "wercker_api/owner"
|
6
|
+
require "wercker_api/pipeline"
|
7
|
+
require "wercker_api/run_collection"
|
8
|
+
require "wercker_api/run"
|
4
9
|
require "wercker_api/application"
|
5
10
|
require "wercker_api/application_collection"
|
6
11
|
require "wercker_api/application/build"
|
7
12
|
require "wercker_api/application/build_collection"
|
8
13
|
require "wercker_api/application/deploy"
|
9
14
|
require "wercker_api/application/deploy_collection"
|
15
|
+
require "wercker_api/application/workflow"
|
16
|
+
require "wercker_api/application/workflow_collection"
|
10
17
|
require "wercker_api/client"
|
11
18
|
|
12
19
|
module WerckerAPI; end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wercker_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- yann marquet
|
@@ -187,8 +187,15 @@ files:
|
|
187
187
|
- lib/wercker_api/application/build_collection.rb
|
188
188
|
- lib/wercker_api/application/deploy.rb
|
189
189
|
- lib/wercker_api/application/deploy_collection.rb
|
190
|
+
- lib/wercker_api/application/workflow.rb
|
191
|
+
- lib/wercker_api/application/workflow_collection.rb
|
190
192
|
- lib/wercker_api/application_collection.rb
|
191
193
|
- lib/wercker_api/client.rb
|
194
|
+
- lib/wercker_api/owner.rb
|
195
|
+
- lib/wercker_api/pipeline.rb
|
196
|
+
- lib/wercker_api/run.rb
|
197
|
+
- lib/wercker_api/run_collection.rb
|
198
|
+
- lib/wercker_api/scm.rb
|
192
199
|
- lib/wercker_api/version.rb
|
193
200
|
- wercker.yml
|
194
201
|
- wercker_api.gemspec
|