Class: Peekj::JiraApi
- Inherits:
-
Object
- Object
- Peekj::JiraApi
- Defined in:
- lib/peekj/jira_api.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.add_comment(issue_key, comment_body) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/peekj/jira_api.rb', line 19 def self.add_comment(issue_key, comment_body) params = {body: comment_body} response = new.post("issue/#{issue_key}/comment", params) post_succeeded = !response['created'].nil? post_succeeded end |
.get_issue(issue_key) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/peekj/jira_api.rb', line 6 def self.get_issue(issue_key) response = new.get("issue/#{issue_key}") OpenStruct.new( status: response['fields']['status']['name'], summary: response['fields']['summary'], description: response['fields']['description'], comments: response['fields']['comment']['comments'].map { |c| {author: c['author']['displayName'], body: c['body']} } ) end |
Instance Method Details
#get(relative_path) ⇒ Object
26 27 28 |
# File 'lib/peekj/jira_api.rb', line 26 def get(relative_path) HTTP.basic_auth(auth_params).get("#{base_url}#{relative_path}").parse end |
#post(relative_path, params) ⇒ Object
30 31 32 |
# File 'lib/peekj/jira_api.rb', line 30 def post(relative_path, params) HTTP.basic_auth(auth_params).post("#{base_url}#{relative_path}", json: params).parse end |