Class: JiraCommand::Jira::Issue
- Defined in:
- lib/jira_command/jira/issue.rb
Constant Summary collapse
- BASE_PATH =
'rest/api/2/issue'.freeze
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #comment(issue_key:, message:) ⇒ Object
- #create(summary:, description:, assignee:, reporter:, project_id:, issuetype_id:) ⇒ Object
Methods inherited from Base
Constructor Details
This class inherits a constructor from JiraCommand::Jira::Base
Instance Method Details
#comment(issue_key:, message:) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/jira_command/jira/issue.rb', line 11 def comment(issue_key:, message:) @conn.post do |req| req.url "rest/api/2/issue/#{issue_key}/comment" req.body = { body: }.to_json end end |
#create(summary:, description:, assignee:, reporter:, project_id:, issuetype_id:) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/jira_command/jira/issue.rb', line 20 def create(summary:, description:, assignee:, reporter:, project_id:, issuetype_id:) fields = { project: { id: project_id }, summary: summary, issuetype: { id: issuetype_id }, reporter: { id: reporter }, description: description } unless assignee.nil? fields.merge!(assignee: { id: assignee }) end res = @conn.post do |req| req.url BASE_PATH req.body = { fields: fields }.to_json end body = JSON.parse(res.body) body['key'] end |