assembla_api 0.1.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 +7 -0
- data/LICENSE.txt +20 -0
- data/Rakefile +22 -0
- data/lib/assembla_api.rb +130 -0
- data/lib/assembla_api/api.rb +373 -0
- data/lib/assembla_api/api/actions.rb +58 -0
- data/lib/assembla_api/api/arguments.rb +248 -0
- data/lib/assembla_api/api/config.rb +107 -0
- data/lib/assembla_api/api/config/property.rb +30 -0
- data/lib/assembla_api/api/config/property_set.rb +119 -0
- data/lib/assembla_api/api/factory.rb +33 -0
- data/lib/assembla_api/authorization.rb +76 -0
- data/lib/assembla_api/client.rb +21 -0
- data/lib/assembla_api/client/activity.rb +30 -0
- data/lib/assembla_api/client/authorizations.rb +143 -0
- data/lib/assembla_api/client/authorizations/app.rb +98 -0
- data/lib/assembla_api/client/portfolio.rb +19 -0
- data/lib/assembla_api/client/portfolio/invitations.rb +30 -0
- data/lib/assembla_api/client/portfolio/spaces.rb +13 -0
- data/lib/assembla_api/client/portfolio/standup_reports.rb +34 -0
- data/lib/assembla_api/client/portfolio/tasks.rb +13 -0
- data/lib/assembla_api/client/portfolio/ticket_reports.rb +13 -0
- data/lib/assembla_api/client/portfolio/tickets.rb +13 -0
- data/lib/assembla_api/client/portfolio/users.rb +13 -0
- data/lib/assembla_api/client/spaces.rb +140 -0
- data/lib/assembla_api/client/spaces/documents.rb +87 -0
- data/lib/assembla_api/client/spaces/milestones.rb +102 -0
- data/lib/assembla_api/client/spaces/space_tools.rb +65 -0
- data/lib/assembla_api/client/spaces/space_tools/merge_requests.rb +105 -0
- data/lib/assembla_api/client/spaces/space_tools/merge_requests/versions.rb +41 -0
- data/lib/assembla_api/client/spaces/space_tools/merge_requests/versions/comments.rb +34 -0
- data/lib/assembla_api/client/spaces/space_tools/merge_requests/versions/votes.rb +46 -0
- data/lib/assembla_api/client/spaces/ssh.rb +14 -0
- data/lib/assembla_api/client/spaces/ssh/actions.rb +76 -0
- data/lib/assembla_api/client/spaces/ssh/actions/launches.rb +14 -0
- data/lib/assembla_api/client/spaces/ssh/keys.rb +18 -0
- data/lib/assembla_api/client/spaces/ssh/launches.rb +29 -0
- data/lib/assembla_api/client/spaces/ssh/servers.rb +63 -0
- data/lib/assembla_api/client/spaces/standup_away_reports.rb +41 -0
- data/lib/assembla_api/client/spaces/standup_reports.rb +41 -0
- data/lib/assembla_api/client/spaces/tags.rb +96 -0
- data/lib/assembla_api/client/spaces/tickets.rb +154 -0
- data/lib/assembla_api/client/spaces/tickets/associations.rb +57 -0
- data/lib/assembla_api/client/spaces/tickets/comments.rb +45 -0
- data/lib/assembla_api/client/spaces/tickets/custom_fields.rb +57 -0
- data/lib/assembla_api/client/spaces/tickets/statuses.rb +55 -0
- data/lib/assembla_api/client/spaces/user_roles.rb +61 -0
- data/lib/assembla_api/client/spaces/users.rb +11 -0
- data/lib/assembla_api/client/spaces/webhooks.rb +63 -0
- data/lib/assembla_api/client/spaces/wiki_pages.rb +78 -0
- data/lib/assembla_api/client/spaces/wiki_pages/versions.rb +20 -0
- data/lib/assembla_api/client/tasks.rb +72 -0
- data/lib/assembla_api/client/users.rb +49 -0
- data/lib/assembla_api/client/users/keys.rb +97 -0
- data/lib/assembla_api/configuration.rb +71 -0
- data/lib/assembla_api/connection.rb +66 -0
- data/lib/assembla_api/constants.rb +74 -0
- data/lib/assembla_api/core_ext/array.rb +25 -0
- data/lib/assembla_api/core_ext/hash.rb +92 -0
- data/lib/assembla_api/core_ext/ordered_hash.rb +107 -0
- data/lib/assembla_api/deprecation.rb +39 -0
- data/lib/assembla_api/error.rb +37 -0
- data/lib/assembla_api/error/bad_request.rb +14 -0
- data/lib/assembla_api/error/client_error.rb +20 -0
- data/lib/assembla_api/error/forbidden.rb +14 -0
- data/lib/assembla_api/error/internal_server_error.rb +15 -0
- data/lib/assembla_api/error/invalid_options.rb +18 -0
- data/lib/assembla_api/error/not_acceptable.rb +15 -0
- data/lib/assembla_api/error/not_found.rb +14 -0
- data/lib/assembla_api/error/required_params.rb +18 -0
- data/lib/assembla_api/error/service_error.rb +68 -0
- data/lib/assembla_api/error/service_unavailable.rb +15 -0
- data/lib/assembla_api/error/unauthorized.rb +15 -0
- data/lib/assembla_api/error/unknown_media.rb +18 -0
- data/lib/assembla_api/error/unknown_value.rb +18 -0
- data/lib/assembla_api/error/unprocessable_entity.rb +14 -0
- data/lib/assembla_api/error/validations.rb +18 -0
- data/lib/assembla_api/ext/faraday.rb +38 -0
- data/lib/assembla_api/jsonable.rb +18 -0
- data/lib/assembla_api/middleware.rb +31 -0
- data/lib/assembla_api/mime_type.rb +33 -0
- data/lib/assembla_api/normalizer.rb +25 -0
- data/lib/assembla_api/null_encoder.rb +25 -0
- data/lib/assembla_api/page_iterator.rb +142 -0
- data/lib/assembla_api/page_links.rb +45 -0
- data/lib/assembla_api/paged_request.rb +40 -0
- data/lib/assembla_api/pagination.rb +102 -0
- data/lib/assembla_api/parameter_filter.rb +32 -0
- data/lib/assembla_api/params_hash.rb +101 -0
- data/lib/assembla_api/rate_limit.rb +25 -0
- data/lib/assembla_api/request.rb +85 -0
- data/lib/assembla_api/request/basic_auth.rb +33 -0
- data/lib/assembla_api/request/jsonize.rb +53 -0
- data/lib/assembla_api/request/key_auth.rb +31 -0
- data/lib/assembla_api/request/oauth2.rb +42 -0
- data/lib/assembla_api/request/verbs.rb +60 -0
- data/lib/assembla_api/response.rb +28 -0
- data/lib/assembla_api/response/header.rb +76 -0
- data/lib/assembla_api/response/jsonize.rb +29 -0
- data/lib/assembla_api/response/mashify.rb +24 -0
- data/lib/assembla_api/response/raise_error.rb +18 -0
- data/lib/assembla_api/response/xmlize.rb +26 -0
- data/lib/assembla_api/response_wrapper.rb +157 -0
- data/lib/assembla_api/ssl_certs/cacerts.pem +2183 -0
- data/lib/assembla_api/utils/url.rb +59 -0
- data/lib/assembla_api/validations.rb +25 -0
- data/lib/assembla_api/validations/format.rb +24 -0
- data/lib/assembla_api/validations/presence.rb +30 -0
- data/lib/assembla_api/validations/required.rb +24 -0
- data/lib/assembla_api/validations/token.rb +41 -0
- data/lib/assembla_api/version.rb +12 -0
- metadata +347 -0
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
module Assembla
|
|
2
|
+
class Client::Spaces::SpaceTools::MergeRequests < API
|
|
3
|
+
require_all 'assembla_api/client/spaces/space_tools/merge_requests',
|
|
4
|
+
'versions'
|
|
5
|
+
|
|
6
|
+
namespace :versions
|
|
7
|
+
namespace :votes
|
|
8
|
+
|
|
9
|
+
VALID_PARAMS_NAMES = %w{
|
|
10
|
+
description
|
|
11
|
+
source_cleanup
|
|
12
|
+
source_symbol
|
|
13
|
+
target_space_tool_id
|
|
14
|
+
target_symbol
|
|
15
|
+
title
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
VALID_REQUEST_PARAM_VALUES = {
|
|
19
|
+
'source_cleanup' => [0, 1]
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
# @example
|
|
23
|
+
# api.spaces.space_tools.merge_requests.create 'project1', 'git',
|
|
24
|
+
# merge_request: { title: 'Mobile App V2' }
|
|
25
|
+
def create(*args)
|
|
26
|
+
arguments(args, required: [:space, :space_tool]) do
|
|
27
|
+
permit VALID_PARAMS_NAMES, recursive: true
|
|
28
|
+
assert_required %w[ title source_symbol target_symbol ]
|
|
29
|
+
assert_values VALID_REQUEST_PARAM_VALUES
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
post_request api_uri(arguments), arguments.params
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# @example
|
|
36
|
+
# api.spaces.space_tools.merge_requests.get 'project1', 'git', 7
|
|
37
|
+
def get(*args)
|
|
38
|
+
arguments(args, required: [:space, :space_tool, :id])
|
|
39
|
+
get_request api_uri(arguments), arguments.params
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# @example
|
|
43
|
+
# api.spaces.space_tools.merge_requests.edit 'project1', 'git', 7,
|
|
44
|
+
# merge_request: { description: 'in-production #tickets' }
|
|
45
|
+
def edit(*args)
|
|
46
|
+
arguments(args, required: [:space, :space_tool, :id]) do
|
|
47
|
+
permit VALID_PARAMS_NAMES , recursive: true
|
|
48
|
+
assert_values VALID_REQUEST_PARAM_VALUES
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
put_request api_uri(arguments), arguments.params
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
# Ignore merge request by ID
|
|
55
|
+
# @example
|
|
56
|
+
# api.spaces.space_tools.merge_requests.ignore 'project1', 'git', 7
|
|
57
|
+
def ignore(*args)
|
|
58
|
+
arguments(args, required: [:space, :space_tool, :id])
|
|
59
|
+
put_request api_uri(arguments, :ignore), arguments.params
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
# Merge MR by ID
|
|
63
|
+
# @example
|
|
64
|
+
# api.spaces.space_tools.merge_requests.merge 'project1', 'git', 7
|
|
65
|
+
def merge(*args)
|
|
66
|
+
arguments(args, required: [:space, :space_tool, :id])
|
|
67
|
+
put_request api_uri(arguments, :merge_and_close), arguments.params
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
# @example
|
|
71
|
+
# api.spaces.space_tools.space_tools.merge_requests.list 'project1', 'git'
|
|
72
|
+
def list(*args)
|
|
73
|
+
arguments(args, required: [:space, :space_tool])
|
|
74
|
+
response = get_request api_uri(arguments), arguments.params
|
|
75
|
+
return response unless block_given?
|
|
76
|
+
response.each { |el| yield el }
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
# @example
|
|
80
|
+
# api.spaces.space_tools.space_tools.merge_requests.tickets 'project1', 'git', 7
|
|
81
|
+
def tickets(*args)
|
|
82
|
+
arguments(args, required: [:space, :space_tool, :id])
|
|
83
|
+
response = get_request api_uri(arguments, :tickets), arguments.params
|
|
84
|
+
return response unless block_given?
|
|
85
|
+
response.each { |el| yield el }
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
# @example
|
|
89
|
+
# api.spaces.space_tools.space_tools.merge_requests.comments 'project1', 'git', 7
|
|
90
|
+
def comments(*args)
|
|
91
|
+
arguments(args, required: [:space, :space_tool, :id])
|
|
92
|
+
response = get_request api_uri(arguments, :comments), arguments.params
|
|
93
|
+
return response unless block_given?
|
|
94
|
+
response.each { |el| yield el }
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
private
|
|
98
|
+
def api_uri(arguments, method = nil)
|
|
99
|
+
uri = "/spaces/#{arguments.space}/space_tools/#{arguments.space_tool}/merge_requests"
|
|
100
|
+
uri += "/" + arguments['id'].to_s if arguments['id']
|
|
101
|
+
uri += "/" + method.to_s if method
|
|
102
|
+
uri
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
end
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
module Assembla
|
|
2
|
+
class Client::Spaces::SpaceTools::MergeRequests::Versions < API
|
|
3
|
+
require_all 'assembla_api/client/spaces/space_tools/merge_requests/versions',
|
|
4
|
+
'votes',
|
|
5
|
+
'comments'
|
|
6
|
+
|
|
7
|
+
namespace :comments
|
|
8
|
+
|
|
9
|
+
# @example
|
|
10
|
+
# api.spaces.space_tools.merge_requests.versions.create 'project1', 'git', 7
|
|
11
|
+
def create(*args)
|
|
12
|
+
arguments(args, required: [:space, :space_tool, :mr_id])
|
|
13
|
+
|
|
14
|
+
post_request api_uri(arguments), arguments.params
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
# @example
|
|
18
|
+
# api.spaces.space_tools.merge_requests.versions.get 'project1', 'git', 7, 571
|
|
19
|
+
def get(*args)
|
|
20
|
+
arguments(args, required: [:space, :space_tool, :mr_id, :id])
|
|
21
|
+
get_request api_uri(arguments), arguments.params
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# @example
|
|
25
|
+
# api.spaces.space_tools.space_tools.merge_requests.versions.list 'project1', 'git', 571
|
|
26
|
+
def list(*args)
|
|
27
|
+
arguments(args, required: [:space, :space_tool, :mr_id])
|
|
28
|
+
response = get_request api_uri(arguments), arguments.params
|
|
29
|
+
return response unless block_given?
|
|
30
|
+
response.each { |el| yield el }
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
private
|
|
34
|
+
def api_uri(arguments, method = nil)
|
|
35
|
+
uri = "/spaces/#{arguments.space}/space_tools/#{arguments.space_tool}/merge_requests/#{arguments.mr_id}/versions"
|
|
36
|
+
uri += "/" + arguments['id'].to_s if arguments['id']
|
|
37
|
+
uri += "/" + method.to_s if method
|
|
38
|
+
uri
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
module Assembla
|
|
2
|
+
class Client::Spaces::SpaceTools::MergeRequests::Versions::Comments < API
|
|
3
|
+
|
|
4
|
+
# @example
|
|
5
|
+
# api.spaces.space_tools.merge_requests.versions.comments.create 'project1', 'git', 571, 1,
|
|
6
|
+
# content: 'Looks good to me'
|
|
7
|
+
def create(*args)
|
|
8
|
+
fields = %w[ content ]
|
|
9
|
+
arguments(args, required: [:space, :space_tool, :mr_id, :version]) do
|
|
10
|
+
permit fields
|
|
11
|
+
assert_required fields
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
post_request api_uri(arguments), arguments.params
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
# @example
|
|
18
|
+
# api.spaces.space_tools.space_tools.merge_requests.versions.list 'project1', 'git', 571, 1
|
|
19
|
+
def list(*args)
|
|
20
|
+
arguments(args, required: [:space, :space_tool, :mr_id, :version])
|
|
21
|
+
response = get_request api_uri(arguments), arguments.params
|
|
22
|
+
return response unless block_given?
|
|
23
|
+
response.each { |el| yield el }
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
private
|
|
27
|
+
def api_uri(arguments, method = nil)
|
|
28
|
+
uri = "/spaces/#{arguments.space}/space_tools/#{arguments.space_tool}/merge_requests/#{arguments.mr_id}/versions/#{arguments.version}/comments"
|
|
29
|
+
uri += "/" + arguments['id'].to_s if arguments['id']
|
|
30
|
+
uri += "/" + method.to_s if method
|
|
31
|
+
uri
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
module Assembla
|
|
2
|
+
class Client::Spaces::SpaceTools::MergeRequests::Versions::Votes < API
|
|
3
|
+
|
|
4
|
+
# @example
|
|
5
|
+
# api.spaces.space_tools.merge_requests.versions.votes.up 'project1', 'git', 571, 1
|
|
6
|
+
def up(*args)
|
|
7
|
+
arguments(args, required: [:space, :space_tool, :mr_id, :version])
|
|
8
|
+
post_request api_uri(arguments, :upvote), arguments.params
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
# @example
|
|
12
|
+
# api.spaces.space_tools.merge_requests.versions.votes.down 'project1', 'git', 571, 1
|
|
13
|
+
def down(*args)
|
|
14
|
+
arguments(args, required: [:space, :space_tool, :mr_id, :version])
|
|
15
|
+
post_request api_uri(arguments, :downvote), arguments.params
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# Deletes vote from MR version
|
|
19
|
+
#
|
|
20
|
+
# @example
|
|
21
|
+
# api.spaces.space_tools.merge_requests.versions.votes.delete 'project1', 'git', 571, 1
|
|
22
|
+
def delete(*args)
|
|
23
|
+
arguments(args, required: [:space, :space_tool, :mr_id, :version])
|
|
24
|
+
delete_request api_uri(arguments, :delete), arguments.params
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
alias :remove :delete
|
|
28
|
+
|
|
29
|
+
# @example
|
|
30
|
+
# api.spaces.space_tools.space_tools.merge_requests.versions.list 'project1', 'git', 571, 1
|
|
31
|
+
def list(*args)
|
|
32
|
+
arguments(args, required: [:space, :space_tool, :mr_id, :version])
|
|
33
|
+
response = get_request api_uri(arguments), arguments.params
|
|
34
|
+
return response unless block_given?
|
|
35
|
+
response.each { |el| yield el }
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
private
|
|
39
|
+
def api_uri(arguments, method = nil)
|
|
40
|
+
uri = "/spaces/#{arguments.space}/space_tools/#{arguments.space_tool}/merge_requests/#{arguments.mr_id}/versions/#{arguments.version}/votes"
|
|
41
|
+
uri += "/" + arguments['id'].to_s if arguments['id']
|
|
42
|
+
uri += "/" + method.to_s if method
|
|
43
|
+
uri
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
module Assembla
|
|
2
|
+
class Client::Spaces::Ssh::Actions < API
|
|
3
|
+
require_all 'assembla_api/client/spaces/ssh/actions',
|
|
4
|
+
'launches'
|
|
5
|
+
namespace :launches
|
|
6
|
+
|
|
7
|
+
VALID_PARAMS_NAMES = %w[
|
|
8
|
+
name
|
|
9
|
+
command
|
|
10
|
+
description
|
|
11
|
+
frequency
|
|
12
|
+
username
|
|
13
|
+
position
|
|
14
|
+
ssh_tool_server_id
|
|
15
|
+
].freeze
|
|
16
|
+
|
|
17
|
+
VALID_REQUEST_PARAM_VALUES = {
|
|
18
|
+
'frequency' => [ 0, 1, 2, 10, 11, 12 ],
|
|
19
|
+
'name' => /^[a-zA-Z0-9 _]+$/
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
# @example
|
|
23
|
+
# api.spaces.ssh.actions.create 'project1', ssh_action: { name: 'Stage' }
|
|
24
|
+
def create(*args)
|
|
25
|
+
arguments(args, required: [:space]) do
|
|
26
|
+
permit VALID_PARAMS_NAMES, recursive: true
|
|
27
|
+
assert_required %w[ name command username ]
|
|
28
|
+
assert_values VALID_REQUEST_PARAM_VALUES
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
post_request("/spaces/#{arguments.space}/ssh/actions", arguments.params)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# @example
|
|
35
|
+
# api.spaces.ssh.actions.get 'project1', 7
|
|
36
|
+
def get(*args)
|
|
37
|
+
arguments(args, required: [:space, :id])
|
|
38
|
+
get_request("/spaces/#{arguments.space}/ssh/actions/#{arguments.id}", arguments.params)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# @example
|
|
42
|
+
# api.spaces.ssh.actions.run 'project1', 7
|
|
43
|
+
def run(*args)
|
|
44
|
+
arguments(args, required: [:space, :id])
|
|
45
|
+
get_request("/spaces/#{arguments.space}/ssh/actions/#{arguments.id}/run", arguments.params)
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# @example
|
|
49
|
+
# api.spaces.ssh.actions.edit 'project1', 7, ssh_action: { description: 'Do not deploy!' }
|
|
50
|
+
def edit(*args)
|
|
51
|
+
arguments(args, required: [:space, :id]) do
|
|
52
|
+
permit VALID_PARAMS_NAMES , recursive: true
|
|
53
|
+
assert_values VALID_REQUEST_PARAM_VALUES
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
put_request("/spaces/#{arguments.space}/ssh/actions/#{arguments.id}", arguments.params)
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
# Delete ssh action by ID
|
|
60
|
+
# @example
|
|
61
|
+
# api.spaces.ssh.actions.delete 'project1', 7
|
|
62
|
+
def delete(*args)
|
|
63
|
+
arguments(args, required: [:space, :id])
|
|
64
|
+
delete_request("/spaces/#{arguments.space}/ssh/actions/#{arguments.id}", arguments.params)
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
# @example
|
|
68
|
+
# api.spaces.ssh.actions.list 'project1'
|
|
69
|
+
def list(*args)
|
|
70
|
+
arguments(args, required: [:space])
|
|
71
|
+
response = get_request("/spaces/#{arguments.space}/ssh/actions", arguments.params)
|
|
72
|
+
return response unless block_given?
|
|
73
|
+
response.each { |el| yield el }
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
module Assembla
|
|
2
|
+
class Client::Spaces::Ssh::Actions::Launches < API
|
|
3
|
+
|
|
4
|
+
# @example
|
|
5
|
+
# api.spaces.ssh.actions.launches.list 'project1', 'action-id'
|
|
6
|
+
def list(*args)
|
|
7
|
+
arguments(args, required: [:space, :id])
|
|
8
|
+
|
|
9
|
+
response = get_request("/spaces/#{arguments.space}/ssh/actions/#{arguments.id}/launches", arguments.params)
|
|
10
|
+
return response unless block_given?
|
|
11
|
+
response.each { |el| yield el }
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
module Assembla
|
|
2
|
+
class Client::Spaces::Ssh::Keys < API
|
|
3
|
+
|
|
4
|
+
# @example
|
|
5
|
+
# api.spaces.ssh.keys.generate 'project1'
|
|
6
|
+
def generate(*args)
|
|
7
|
+
arguments(args, required: [:space])
|
|
8
|
+
post_request("/spaces/#{arguments.space}/ssh/generate_key", arguments.params)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
# @example
|
|
12
|
+
# api.spaces.ssh.keys.get 'project1'
|
|
13
|
+
def get(*args)
|
|
14
|
+
arguments(args, required: [:space])
|
|
15
|
+
get_request("/spaces/#{arguments.space}/ssh/key", arguments.params)
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
module Assembla
|
|
2
|
+
class Client::Spaces::Ssh::Launches < API
|
|
3
|
+
|
|
4
|
+
# @example
|
|
5
|
+
# api.spaces.ssh.launches.list 'project1'
|
|
6
|
+
def list(*args)
|
|
7
|
+
arguments(args, required: [:space])
|
|
8
|
+
|
|
9
|
+
response = get_request("/spaces/#{arguments.space}/ssh/launches", arguments.params)
|
|
10
|
+
return response unless block_given?
|
|
11
|
+
response.each { |el| yield el }
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
# @example
|
|
15
|
+
# api.spaces.ssh.launches.get 'project1', 142
|
|
16
|
+
def get(*args)
|
|
17
|
+
arguments(args, required: [:space, :id])
|
|
18
|
+
get_request("/spaces/#{arguments.space}/ssh/launches/#{arguments.id}", arguments.params)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
# Get full output of the command
|
|
22
|
+
# @example
|
|
23
|
+
# api.spaces.ssh.launches.output 'project1', 142
|
|
24
|
+
def output(*args)
|
|
25
|
+
arguments(args, required: [:space, :id])
|
|
26
|
+
get_request("/spaces/#{arguments.space}/ssh/launches/#{arguments.id}/output", arguments.params)
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
module Assembla
|
|
2
|
+
class Client::Spaces::Ssh::Servers < API
|
|
3
|
+
VALID_PARAMS_NAMES = %w[
|
|
4
|
+
name
|
|
5
|
+
remote_port
|
|
6
|
+
remote_host
|
|
7
|
+
description
|
|
8
|
+
].freeze
|
|
9
|
+
|
|
10
|
+
VALID_REQUEST_PARAM_VALUES = {
|
|
11
|
+
'name' => /^[a-zA-Z0-9 _]+$/
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
# @example
|
|
15
|
+
# api.spaces.ssh.servers.create 'project1', ssh_server: { name: 'Stage' }
|
|
16
|
+
def create(*args)
|
|
17
|
+
arguments(args, required: [:space]) do
|
|
18
|
+
permit VALID_PARAMS_NAMES, recursive: true
|
|
19
|
+
assert_required %w[ remote_host name ]
|
|
20
|
+
assert_values VALID_REQUEST_PARAM_VALUES
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
arguments.params['ssh_server']['remote_port'] ||= 22
|
|
24
|
+
|
|
25
|
+
post_request("/spaces/#{arguments.space}/ssh/servers", arguments.params)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# @example
|
|
29
|
+
# api.spaces.ssh.servers.get 'project1', 7
|
|
30
|
+
def get(*args)
|
|
31
|
+
arguments(args, required: [:space, :id])
|
|
32
|
+
get_request("/spaces/#{arguments.space}/ssh/servers/#{arguments.id}", arguments.params)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# @example
|
|
36
|
+
# api.spaces.ssh.servers.edit 'project1', 7, ssh_server: { description: 'Do not deploy!' }
|
|
37
|
+
def edit(*args)
|
|
38
|
+
arguments(args, required: [:space, :id]) do
|
|
39
|
+
permit VALID_PARAMS_NAMES , recursive: true
|
|
40
|
+
assert_values VALID_REQUEST_PARAM_VALUES
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
put_request("/spaces/#{arguments.space}/ssh/servers/#{arguments.id}", arguments.params)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# Delete ssh server by ID
|
|
47
|
+
# @example
|
|
48
|
+
# api.spaces.ssh.servers.delete 'project1', 7
|
|
49
|
+
def delete(*args)
|
|
50
|
+
arguments(args, required: [:space, :id])
|
|
51
|
+
delete_request("/spaces/#{arguments.space}/ssh/servers/#{arguments.id}", arguments.params)
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
# @example
|
|
55
|
+
# api.spaces.ssh.servers.list 'project1'
|
|
56
|
+
def list(*args)
|
|
57
|
+
arguments(args, required: [:space])
|
|
58
|
+
response = get_request("/spaces/#{arguments.space}/ssh/servers", arguments.params)
|
|
59
|
+
return response unless block_given?
|
|
60
|
+
response.each { |el| yield el }
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end
|