Module: Legion::Extensions::Jira::Projects::Runners::Components
- Includes:
- Helpers::Lex, Helpers::Client
- Included in:
- Client
- Defined in:
- lib/legion/extensions/jira/projects/runners/components.rb
Instance Method Summary
collapse
#connection, #upload_connection
Instance Method Details
#create_component(project_key:, name:, description: nil, lead_account_id: nil) ⇒ Object
23
24
25
26
27
28
29
|
# File 'lib/legion/extensions/jira/projects/runners/components.rb', line 23
def create_component(project_key:, name:, description: nil, lead_account_id: nil, **)
body = { project: project_key, name: name }
body[:description] = description if description
body[:leadAccountId] = lead_account_id if lead_account_id
resp = connection(**).post('/rest/api/3/component', body)
{ component: resp.body }
end
|
#delete_component(component_id:, move_issues_to: nil) ⇒ Object
40
41
42
43
44
45
46
47
|
# File 'lib/legion/extensions/jira/projects/runners/components.rb', line 40
def delete_component(component_id:, move_issues_to: nil, **)
params = {}
params[:moveIssuesTo] = move_issues_to if move_issues_to
resp = connection(**).delete("/rest/api/3/component/#{component_id}") do |req|
req.params = params
end
{ deleted: resp.status == 204, component_id: component_id }
end
|
#get_component(component_id:) ⇒ Object
18
19
20
21
|
# File 'lib/legion/extensions/jira/projects/runners/components.rb', line 18
def get_component(component_id:, **)
resp = connection(**).get("/rest/api/3/component/#{component_id}")
{ component: resp.body }
end
|
#list_project_components(project_key:) ⇒ Object
13
14
15
16
|
# File 'lib/legion/extensions/jira/projects/runners/components.rb', line 13
def list_project_components(project_key:, **)
resp = connection(**).get("/rest/api/3/project/#{project_key}/components")
{ components: resp.body }
end
|
#update_component(component_id:, name: nil, description: nil, lead_account_id: nil) ⇒ Object
31
32
33
34
35
36
37
38
|
# File 'lib/legion/extensions/jira/projects/runners/components.rb', line 31
def update_component(component_id:, name: nil, description: nil, lead_account_id: nil, **)
body = {}
body[:name] = name if name
body[:description] = description if description
body[:leadAccountId] = lead_account_id if lead_account_id
resp = connection(**).put("/rest/api/3/component/#{component_id}", body)
{ component: resp.body }
end
|