semaphore_client 2.3.1 → 2.4.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
- data/Gemfile.lock +1 -1
- data/lib/semaphore_client.rb +7 -5
- data/lib/semaphore_client/api/config_file.rb +59 -81
- data/lib/semaphore_client/api/env_var.rb +59 -81
- data/lib/semaphore_client/api/org.rb +15 -27
- data/lib/semaphore_client/api/project.rb +42 -73
- data/lib/semaphore_client/api/shared_config.rb +81 -108
- data/lib/semaphore_client/api/team.rb +50 -85
- data/lib/semaphore_client/api/user.rb +34 -64
- data/lib/semaphore_client/exceptions.rb +34 -2
- data/lib/semaphore_client/http_client.rb +73 -53
- data/lib/semaphore_client/version.rb +1 -1
- data/semaphore_client.gemspec +3 -1
- metadata +21 -7
@@ -5,116 +5,85 @@ class SemaphoreClient
|
|
5
5
|
@http_client = http_client
|
6
6
|
end
|
7
7
|
|
8
|
-
def list_for_org(org_id, query = nil)
|
9
|
-
list_for_org!(org_id, query)
|
10
|
-
rescue SemaphoreClient::Exceptions::RequestFailed
|
11
|
-
end
|
12
8
|
|
13
|
-
def
|
14
|
-
|
15
|
-
rescue SemaphoreClient::Exceptions::
|
9
|
+
def list_for_org(org_id, params = nil, options = {})
|
10
|
+
list_for_org!(org_id, params, options)
|
11
|
+
rescue SemaphoreClient::Exceptions::ResponseError
|
16
12
|
end
|
17
13
|
|
18
|
-
def
|
19
|
-
|
20
|
-
rescue SemaphoreClient::Exceptions::RequestFailed
|
21
|
-
end
|
14
|
+
def list_for_org!(org_id, params = nil, options = {})
|
15
|
+
path = "/orgs/#{org_id}/projects"
|
22
16
|
|
23
|
-
|
24
|
-
attach_to_team!(project_id, team_id)
|
25
|
-
rescue SemaphoreClient::Exceptions::RequestFailed
|
17
|
+
@http_client.get(path, params, options = {}).body.map { |e| SemaphoreClient::Model::Project.load(e) }
|
26
18
|
end
|
27
19
|
|
28
|
-
def detach_from_team(project_id, team_id)
|
29
|
-
detach_from_team!(project_id, team_id)
|
30
|
-
rescue SemaphoreClient::Exceptions::RequestFailed
|
31
|
-
end
|
32
20
|
|
33
|
-
|
34
|
-
|
35
|
-
|
21
|
+
|
22
|
+
def create_for_org(org_id, params = nil, options = {})
|
23
|
+
create_for_org!(org_id, params, options)
|
24
|
+
rescue SemaphoreClient::Exceptions::ResponseError
|
36
25
|
end
|
37
26
|
|
38
|
-
def
|
39
|
-
|
40
|
-
|
41
|
-
"?" + query.map { |key, value| "#{key}=#{value}" }.join("&")
|
42
|
-
end
|
27
|
+
def create_for_org!(org_id, params = nil, options = {})
|
28
|
+
path = "/orgs/#{org_id}/projects"
|
29
|
+
response = @http_client.post(path, params, options)
|
43
30
|
|
44
|
-
|
31
|
+
SemaphoreClient::Model::Project.load(response.body)
|
32
|
+
end
|
45
33
|
|
46
|
-
assert_response_status(response, 200)
|
47
34
|
|
48
|
-
content = JSON.parse(response.body)
|
49
35
|
|
50
|
-
|
51
|
-
|
52
|
-
|
36
|
+
def list_for_team(team_id, params = nil, options = {})
|
37
|
+
list_for_team!(team_id, params, options)
|
38
|
+
rescue SemaphoreClient::Exceptions::ResponseError
|
53
39
|
end
|
54
40
|
|
55
|
-
def
|
56
|
-
|
57
|
-
|
58
|
-
assert_response_status(response, 200)
|
41
|
+
def list_for_team!(team_id, params = nil, options = {})
|
42
|
+
path = "/teams/#{team_id}/projects"
|
59
43
|
|
60
|
-
|
61
|
-
|
62
|
-
SemaphoreClient::Model::Project.load(content)
|
44
|
+
@http_client.get(path, params, options = {}).body.map { |e| SemaphoreClient::Model::Project.load(e) }
|
63
45
|
end
|
64
46
|
|
65
|
-
def list_for_team!(team_id, query = nil)
|
66
|
-
query_string =
|
67
|
-
unless query.nil? || query.empty?
|
68
|
-
"?" + query.map { |key, value| "#{key}=#{value}" }.join("&")
|
69
|
-
end
|
70
47
|
|
71
|
-
response = @http_client.get([:teams, team_id, :projects, query_string].compact)
|
72
48
|
|
73
|
-
|
49
|
+
def attach_to_team(project_id, team_id, params = nil, options = {})
|
50
|
+
attach_to_team!(project_id, team_id, params, options)
|
51
|
+
rescue SemaphoreClient::Exceptions::ResponseError
|
52
|
+
end
|
74
53
|
|
75
|
-
|
54
|
+
def attach_to_team!(project_id, team_id, params = nil, options = {})
|
55
|
+
path = "/teams/#{team_id}/projects/#{project_id}"
|
76
56
|
|
77
|
-
|
78
|
-
SemaphoreClient::Model::Project.load(entity)
|
79
|
-
end
|
57
|
+
@http_client.post(path, params, options)
|
80
58
|
end
|
81
59
|
|
82
|
-
def attach_to_team!(project_id, team_id)
|
83
|
-
response = @http_client.post([:teams, team_id, :projects, project_id])
|
84
60
|
|
85
|
-
|
61
|
+
|
62
|
+
def detach_from_team(project_id, team_id, params = nil, options = {})
|
63
|
+
detach_from_team!(project_id, team_id, params, options)
|
64
|
+
rescue SemaphoreClient::Exceptions::ResponseError
|
86
65
|
end
|
87
66
|
|
88
|
-
def detach_from_team!(project_id, team_id)
|
89
|
-
|
67
|
+
def detach_from_team!(project_id, team_id, params = nil, options = {})
|
68
|
+
path = "/teams/#{team_id}/projects/#{project_id}"
|
90
69
|
|
91
|
-
|
70
|
+
@http_client.delete(path, params, options)
|
92
71
|
end
|
93
72
|
|
94
|
-
def list_for_shared_config!(shared_config_id, query = nil)
|
95
|
-
query_string =
|
96
|
-
unless query.nil? || query.empty?
|
97
|
-
"?" + query.map { |key, value| "#{key}=#{value}" }.join("&")
|
98
|
-
end
|
99
73
|
|
100
|
-
response = @http_client.get([:shared_configs, shared_config_id, :projects, query_string].compact)
|
101
74
|
|
102
|
-
|
75
|
+
def list_for_shared_config(shared_config_id, params = nil, options = {})
|
76
|
+
list_for_shared_config!(shared_config_id, params, options)
|
77
|
+
rescue SemaphoreClient::Exceptions::ResponseError
|
78
|
+
end
|
103
79
|
|
104
|
-
|
80
|
+
def list_for_shared_config!(shared_config_id, params = nil, options = {})
|
81
|
+
path = "/shared_configs/#{shared_config_id}/projects"
|
105
82
|
|
106
|
-
|
107
|
-
SemaphoreClient::Model::Project.load(entity)
|
108
|
-
end
|
83
|
+
@http_client.get(path, params, options = {}).body.map { |e| SemaphoreClient::Model::Project.load(e) }
|
109
84
|
end
|
110
85
|
|
111
|
-
private
|
112
|
-
|
113
|
-
def assert_response_status(response, expected_status)
|
114
|
-
return if response.status == expected_status
|
115
86
|
|
116
|
-
raise SemaphoreClient::Exceptions::RequestFailed, response.status
|
117
|
-
end
|
118
87
|
end
|
119
88
|
end
|
120
89
|
end
|
@@ -5,179 +5,152 @@ class SemaphoreClient
|
|
5
5
|
@http_client = http_client
|
6
6
|
end
|
7
7
|
|
8
|
-
def list_for_org(org_id, query = nil)
|
9
|
-
list_for_org!(org_id, query)
|
10
|
-
rescue SemaphoreClient::Exceptions::RequestFailed
|
11
|
-
end
|
12
8
|
|
13
|
-
def
|
14
|
-
|
15
|
-
rescue SemaphoreClient::Exceptions::
|
9
|
+
def list_for_org(org_id, params = nil, options = {})
|
10
|
+
list_for_org!(org_id, params, options)
|
11
|
+
rescue SemaphoreClient::Exceptions::ResponseError
|
16
12
|
end
|
17
13
|
|
18
|
-
def
|
19
|
-
|
20
|
-
rescue SemaphoreClient::Exceptions::RequestFailed
|
21
|
-
end
|
14
|
+
def list_for_org!(org_id, params = nil, options = {})
|
15
|
+
path = "/orgs/#{org_id}/shared_configs"
|
22
16
|
|
23
|
-
|
24
|
-
attach_to_team!(shared_config_id, team_id)
|
25
|
-
rescue SemaphoreClient::Exceptions::RequestFailed
|
17
|
+
@http_client.get(path, params, options = {}).body.map { |e| SemaphoreClient::Model::SharedConfig.load(e) }
|
26
18
|
end
|
27
19
|
|
28
|
-
def detach_from_team(shared_config_id, team_id)
|
29
|
-
detach_from_team!(shared_config_id, team_id)
|
30
|
-
rescue SemaphoreClient::Exceptions::RequestFailed
|
31
|
-
end
|
32
20
|
|
33
|
-
def list_for_project(project_id, query = nil)
|
34
|
-
list_for_project!(project_id, query)
|
35
|
-
rescue SemaphoreClient::Exceptions::RequestFailed
|
36
|
-
end
|
37
21
|
|
38
|
-
def
|
39
|
-
|
40
|
-
rescue SemaphoreClient::Exceptions::
|
22
|
+
def create_for_org(org_id, params = nil, options = {})
|
23
|
+
create_for_org!(org_id, params, options)
|
24
|
+
rescue SemaphoreClient::Exceptions::ResponseError
|
41
25
|
end
|
42
26
|
|
43
|
-
def
|
44
|
-
|
45
|
-
|
46
|
-
end
|
27
|
+
def create_for_org!(org_id, params = nil, options = {})
|
28
|
+
path = "/orgs/#{org_id}/shared_configs"
|
29
|
+
response = @http_client.post(path, params, options)
|
47
30
|
|
48
|
-
|
49
|
-
get!(id)
|
50
|
-
rescue SemaphoreClient::Exceptions::RequestFailed
|
31
|
+
SemaphoreClient::Model::SharedConfig.load(response.body)
|
51
32
|
end
|
52
33
|
|
53
|
-
def delete(id)
|
54
|
-
delete!(id)
|
55
|
-
rescue SemaphoreClient::Exceptions::RequestFailed
|
56
|
-
end
|
57
34
|
|
58
|
-
|
59
|
-
|
60
|
-
|
35
|
+
|
36
|
+
def list_for_team(team_id, params = nil, options = {})
|
37
|
+
list_for_team!(team_id, params, options)
|
38
|
+
rescue SemaphoreClient::Exceptions::ResponseError
|
61
39
|
end
|
62
40
|
|
63
|
-
def
|
64
|
-
|
65
|
-
unless query.nil? || query.empty?
|
66
|
-
"?" + query.map { |key, value| "#{key}=#{value}" }.join("&")
|
67
|
-
end
|
41
|
+
def list_for_team!(team_id, params = nil, options = {})
|
42
|
+
path = "/teams/#{team_id}/shared_configs"
|
68
43
|
|
69
|
-
|
44
|
+
@http_client.get(path, params, options = {}).body.map { |e| SemaphoreClient::Model::SharedConfig.load(e) }
|
45
|
+
end
|
70
46
|
|
71
|
-
assert_response_status(response, 200)
|
72
47
|
|
73
|
-
content = JSON.parse(response.body)
|
74
48
|
|
75
|
-
|
76
|
-
|
77
|
-
|
49
|
+
def attach_to_team(shared_config_id, team_id, params = nil, options = {})
|
50
|
+
attach_to_team!(shared_config_id, team_id, params, options)
|
51
|
+
rescue SemaphoreClient::Exceptions::ResponseError
|
78
52
|
end
|
79
53
|
|
80
|
-
def
|
81
|
-
|
54
|
+
def attach_to_team!(shared_config_id, team_id, params = nil, options = {})
|
55
|
+
path = "/teams/#{team_id}/shared_configs/#{shared_config_id}"
|
56
|
+
|
57
|
+
@http_client.post(path, params, options)
|
58
|
+
end
|
82
59
|
|
83
|
-
assert_response_status(response, 200)
|
84
60
|
|
85
|
-
content = JSON.parse(response.body)
|
86
61
|
|
87
|
-
|
62
|
+
def detach_from_team(shared_config_id, team_id, params = nil, options = {})
|
63
|
+
detach_from_team!(shared_config_id, team_id, params, options)
|
64
|
+
rescue SemaphoreClient::Exceptions::ResponseError
|
88
65
|
end
|
89
66
|
|
90
|
-
def
|
91
|
-
|
92
|
-
unless query.nil? || query.empty?
|
93
|
-
"?" + query.map { |key, value| "#{key}=#{value}" }.join("&")
|
94
|
-
end
|
67
|
+
def detach_from_team!(shared_config_id, team_id, params = nil, options = {})
|
68
|
+
path = "/teams/#{team_id}/shared_configs/#{shared_config_id}"
|
95
69
|
|
96
|
-
|
70
|
+
@http_client.delete(path, params, options)
|
71
|
+
end
|
97
72
|
|
98
|
-
assert_response_status(response, 200)
|
99
73
|
|
100
|
-
content = JSON.parse(response.body)
|
101
74
|
|
102
|
-
|
103
|
-
|
104
|
-
|
75
|
+
def list_for_project(project_id, params = nil, options = {})
|
76
|
+
list_for_project!(project_id, params, options)
|
77
|
+
rescue SemaphoreClient::Exceptions::ResponseError
|
105
78
|
end
|
106
79
|
|
107
|
-
def
|
108
|
-
|
80
|
+
def list_for_project!(project_id, params = nil, options = {})
|
81
|
+
path = "/projects/#{project_id}/shared_configs"
|
109
82
|
|
110
|
-
|
83
|
+
@http_client.get(path, params, options = {}).body.map { |e| SemaphoreClient::Model::SharedConfig.load(e) }
|
111
84
|
end
|
112
85
|
|
113
|
-
def detach_from_team!(shared_config_id, team_id)
|
114
|
-
response = @http_client.delete([:teams, team_id, :shared_configs, shared_config_id])
|
115
86
|
|
116
|
-
|
87
|
+
|
88
|
+
def attach_to_project(shared_config_id, project_id, params = nil, options = {})
|
89
|
+
attach_to_project!(shared_config_id, project_id, params, options)
|
90
|
+
rescue SemaphoreClient::Exceptions::ResponseError
|
117
91
|
end
|
118
92
|
|
119
|
-
def
|
120
|
-
|
121
|
-
unless query.nil? || query.empty?
|
122
|
-
"?" + query.map { |key, value| "#{key}=#{value}" }.join("&")
|
123
|
-
end
|
93
|
+
def attach_to_project!(shared_config_id, project_id, params = nil, options = {})
|
94
|
+
path = "/projects/#{project_id}/shared_configs/#{shared_config_id}"
|
124
95
|
|
125
|
-
|
96
|
+
@http_client.post(path, params, options)
|
97
|
+
end
|
126
98
|
|
127
|
-
assert_response_status(response, 200)
|
128
99
|
|
129
|
-
content = JSON.parse(response.body)
|
130
100
|
|
131
|
-
|
132
|
-
|
133
|
-
|
101
|
+
def detach_from_project(shared_config_id, project_id, params = nil, options = {})
|
102
|
+
detach_from_project!(shared_config_id, project_id, params, options)
|
103
|
+
rescue SemaphoreClient::Exceptions::ResponseError
|
134
104
|
end
|
135
105
|
|
136
|
-
def
|
137
|
-
|
106
|
+
def detach_from_project!(shared_config_id, project_id, params = nil, options = {})
|
107
|
+
path = "/projects/#{project_id}/shared_configs/#{shared_config_id}"
|
138
108
|
|
139
|
-
|
109
|
+
@http_client.delete(path, params, options)
|
140
110
|
end
|
141
111
|
|
142
|
-
def detach_from_project!(shared_config_id, project_id)
|
143
|
-
response = @http_client.delete([:projects, project_id, :shared_configs, shared_config_id])
|
144
112
|
|
145
|
-
|
113
|
+
|
114
|
+
def get(id, params = nil, options = {})
|
115
|
+
get!(id, params, options)
|
116
|
+
rescue SemaphoreClient::Exceptions::ResponseError
|
146
117
|
end
|
147
118
|
|
148
|
-
def get!(id)
|
149
|
-
|
119
|
+
def get!(id, params = nil, options = {})
|
120
|
+
path = "/shared_configs/#{id}"
|
121
|
+
response = @http_client.get(path, params = {})
|
122
|
+
|
123
|
+
SemaphoreClient::Model::SharedConfig.load(response.body)
|
124
|
+
end
|
150
125
|
|
151
|
-
assert_response_status(response, 200)
|
152
126
|
|
153
|
-
content = JSON.parse(response.body)
|
154
127
|
|
155
|
-
|
128
|
+
def delete(id, params = nil, options = {})
|
129
|
+
delete!(id, params, options)
|
130
|
+
rescue SemaphoreClient::Exceptions::ResponseError
|
156
131
|
end
|
157
132
|
|
158
|
-
def delete!(id)
|
159
|
-
|
133
|
+
def delete!(id, params = nil, options = {})
|
134
|
+
path = "/shared_configs/#{id}"
|
160
135
|
|
161
|
-
|
136
|
+
@http_client.delete(path, params)
|
162
137
|
end
|
163
138
|
|
164
|
-
def update!(id, params)
|
165
|
-
response = @http_client.patch([:shared_configs, id], params.to_json)
|
166
|
-
|
167
|
-
assert_response_status(response, 200)
|
168
139
|
|
169
|
-
content = JSON.parse(response.body)
|
170
140
|
|
171
|
-
|
141
|
+
def update(id, params = nil, options = {})
|
142
|
+
update!(id, params, options)
|
143
|
+
rescue SemaphoreClient::Exceptions::ResponseError
|
172
144
|
end
|
173
145
|
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
return if response.status == expected_status
|
146
|
+
def update!(id, params = nil, options = {})
|
147
|
+
path = "/shared_configs/#{id}"
|
148
|
+
response = @http_client.patch(path, params)
|
178
149
|
|
179
|
-
|
150
|
+
SemaphoreClient::Model::SharedConfig.load(response.body)
|
180
151
|
end
|
152
|
+
|
153
|
+
|
181
154
|
end
|
182
155
|
end
|
183
156
|
end
|
@@ -5,135 +5,100 @@ class SemaphoreClient
|
|
5
5
|
@http_client = http_client
|
6
6
|
end
|
7
7
|
|
8
|
-
def list_for_org(org_id, query = nil)
|
9
|
-
list_for_org!(org_id, query)
|
10
|
-
rescue SemaphoreClient::Exceptions::RequestFailed
|
11
|
-
end
|
12
8
|
|
13
|
-
def
|
14
|
-
|
15
|
-
rescue SemaphoreClient::Exceptions::
|
9
|
+
def list_for_org(org_id, params = nil, options = {})
|
10
|
+
list_for_org!(org_id, params, options)
|
11
|
+
rescue SemaphoreClient::Exceptions::ResponseError
|
16
12
|
end
|
17
13
|
|
18
|
-
def
|
19
|
-
|
20
|
-
rescue SemaphoreClient::Exceptions::RequestFailed
|
21
|
-
end
|
14
|
+
def list_for_org!(org_id, params = nil, options = {})
|
15
|
+
path = "/orgs/#{org_id}/teams"
|
22
16
|
|
23
|
-
|
24
|
-
delete!(id)
|
25
|
-
rescue SemaphoreClient::Exceptions::RequestFailed
|
17
|
+
@http_client.get(path, params, options = {}).body.map { |e| SemaphoreClient::Model::Team.load(e) }
|
26
18
|
end
|
27
19
|
|
28
|
-
def update(id, params)
|
29
|
-
update!(id, params)
|
30
|
-
rescue SemaphoreClient::Exceptions::RequestFailed
|
31
|
-
end
|
32
20
|
|
33
|
-
def list_for_project(project_id, query = nil)
|
34
|
-
list_for_project!(project_id, query)
|
35
|
-
rescue SemaphoreClient::Exceptions::RequestFailed
|
36
|
-
end
|
37
21
|
|
38
|
-
def
|
39
|
-
|
40
|
-
rescue SemaphoreClient::Exceptions::
|
22
|
+
def create_for_org(org_id, params = nil, options = {})
|
23
|
+
create_for_org!(org_id, params, options)
|
24
|
+
rescue SemaphoreClient::Exceptions::ResponseError
|
41
25
|
end
|
42
26
|
|
43
|
-
def
|
44
|
-
|
45
|
-
|
46
|
-
"?" + query.map { |key, value| "#{key}=#{value}" }.join("&")
|
47
|
-
end
|
27
|
+
def create_for_org!(org_id, params = nil, options = {})
|
28
|
+
path = "/orgs/#{org_id}/teams"
|
29
|
+
response = @http_client.post(path, params, options)
|
48
30
|
|
49
|
-
|
31
|
+
SemaphoreClient::Model::Team.load(response.body)
|
32
|
+
end
|
50
33
|
|
51
|
-
assert_response_status(response, 200)
|
52
34
|
|
53
|
-
content = JSON.parse(response.body)
|
54
35
|
|
55
|
-
|
56
|
-
|
57
|
-
|
36
|
+
def get(id, params = nil, options = {})
|
37
|
+
get!(id, params, options)
|
38
|
+
rescue SemaphoreClient::Exceptions::ResponseError
|
58
39
|
end
|
59
40
|
|
60
|
-
def
|
61
|
-
|
62
|
-
|
63
|
-
assert_response_status(response, 200)
|
64
|
-
|
65
|
-
content = JSON.parse(response.body)
|
41
|
+
def get!(id, params = nil, options = {})
|
42
|
+
path = "/teams/#{id}"
|
43
|
+
response = @http_client.get(path, params = {})
|
66
44
|
|
67
|
-
SemaphoreClient::Model::Team.load(
|
45
|
+
SemaphoreClient::Model::Team.load(response.body)
|
68
46
|
end
|
69
47
|
|
70
|
-
def get!(id)
|
71
|
-
response = @http_client.get([:teams, id])
|
72
48
|
|
73
|
-
assert_response_status(response, 200)
|
74
49
|
|
75
|
-
|
76
|
-
|
77
|
-
|
50
|
+
def delete(id, params = nil, options = {})
|
51
|
+
delete!(id, params, options)
|
52
|
+
rescue SemaphoreClient::Exceptions::ResponseError
|
78
53
|
end
|
79
54
|
|
80
|
-
def delete!(id)
|
81
|
-
|
55
|
+
def delete!(id, params = nil, options = {})
|
56
|
+
path = "/teams/#{id}"
|
82
57
|
|
83
|
-
|
58
|
+
@http_client.delete(path, params)
|
84
59
|
end
|
85
60
|
|
86
|
-
def update!(id, params)
|
87
|
-
response = @http_client.patch([:teams, id], params.to_json)
|
88
|
-
|
89
|
-
assert_response_status(response, 200)
|
90
61
|
|
91
|
-
content = JSON.parse(response.body)
|
92
62
|
|
93
|
-
|
63
|
+
def update(id, params = nil, options = {})
|
64
|
+
update!(id, params, options)
|
65
|
+
rescue SemaphoreClient::Exceptions::ResponseError
|
94
66
|
end
|
95
67
|
|
96
|
-
def
|
97
|
-
|
98
|
-
|
99
|
-
"?" + query.map { |key, value| "#{key}=#{value}" }.join("&")
|
100
|
-
end
|
68
|
+
def update!(id, params = nil, options = {})
|
69
|
+
path = "/teams/#{id}"
|
70
|
+
response = @http_client.patch(path, params)
|
101
71
|
|
102
|
-
|
72
|
+
SemaphoreClient::Model::Team.load(response.body)
|
73
|
+
end
|
103
74
|
|
104
|
-
assert_response_status(response, 200)
|
105
75
|
|
106
|
-
content = JSON.parse(response.body)
|
107
76
|
|
108
|
-
|
109
|
-
|
110
|
-
|
77
|
+
def list_for_project(project_id, params = nil, options = {})
|
78
|
+
list_for_project!(project_id, params, options)
|
79
|
+
rescue SemaphoreClient::Exceptions::ResponseError
|
111
80
|
end
|
112
81
|
|
113
|
-
def
|
114
|
-
|
115
|
-
unless query.nil? || query.empty?
|
116
|
-
"?" + query.map { |key, value| "#{key}=#{value}" }.join("&")
|
117
|
-
end
|
82
|
+
def list_for_project!(project_id, params = nil, options = {})
|
83
|
+
path = "/projects/#{project_id}/teams"
|
118
84
|
|
119
|
-
|
85
|
+
@http_client.get(path, params, options = {}).body.map { |e| SemaphoreClient::Model::Team.load(e) }
|
86
|
+
end
|
120
87
|
|
121
|
-
assert_response_status(response, 200)
|
122
88
|
|
123
|
-
content = JSON.parse(response.body)
|
124
89
|
|
125
|
-
|
126
|
-
|
127
|
-
|
90
|
+
def list_for_shared_config(shared_config_id, params = nil, options = {})
|
91
|
+
list_for_shared_config!(shared_config_id, params, options)
|
92
|
+
rescue SemaphoreClient::Exceptions::ResponseError
|
128
93
|
end
|
129
94
|
|
130
|
-
|
95
|
+
def list_for_shared_config!(shared_config_id, params = nil, options = {})
|
96
|
+
path = "/shared_configs/#{shared_config_id}/teams"
|
131
97
|
|
132
|
-
|
133
|
-
return if response.status == expected_status
|
134
|
-
|
135
|
-
raise SemaphoreClient::Exceptions::RequestFailed, response.status
|
98
|
+
@http_client.get(path, params, options = {}).body.map { |e| SemaphoreClient::Model::Team.load(e) }
|
136
99
|
end
|
100
|
+
|
101
|
+
|
137
102
|
end
|
138
103
|
end
|
139
104
|
end
|