Module: OnlyofficeBugzillaHelper::BugData
- Included in:
- BugzillaHelper
- Defined in:
- lib/onlyoffice_bugzilla_helper/bug_data.rb
Overview
Method to work with bug data
Instance Method Summary collapse
-
#bug_data(bug_id) ⇒ JSON
Get bug data of bug.
-
#bug_exists?(bug_id) ⇒ Boolean
Check if bug exists.
-
#bug_status(bug_id) ⇒ String
Get status of bug.
-
#get_bug_history(bug_id) ⇒ Array
Get history of bug.
-
#get_bugs_by_filter(filters) ⇒ Array
Get list of bugs filtered by parameters.
Instance Method Details
#bug_data(bug_id) ⇒ JSON
Get bug data of bug
9 10 11 12 |
# File 'lib/onlyoffice_bugzilla_helper/bug_data.rb', line 9 def bug_data(bug_id) res = get_bug_result(bug_id) JSON.parse(res.body)['bugs'].first end |
#bug_exists?(bug_id) ⇒ Boolean
Check if bug exists
25 26 27 28 29 30 |
# File 'lib/onlyoffice_bugzilla_helper/bug_data.rb', line 25 def bug_exists?(bug_id) bug_status(bug_id) true rescue JSON::ParserError, NoMethodError false end |
#bug_status(bug_id) ⇒ String
Get status of bug
17 18 19 20 |
# File 'lib/onlyoffice_bugzilla_helper/bug_data.rb', line 17 def bug_status(bug_id) parsed_json = bug_data(bug_id) parsed_json['status'] end |
#get_bug_history(bug_id) ⇒ Array
Get history of bug
43 44 45 46 |
# File 'lib/onlyoffice_bugzilla_helper/bug_data.rb', line 43 def get_bug_history(bug_id) result = get_bug_history_result(bug_id) JSON.parse(result.body).fetch('bugs', []).first.fetch('history', []) end |
#get_bugs_by_filter(filters) ⇒ Array
Get list of bugs filtered by parameters
35 36 37 38 |
# File 'lib/onlyoffice_bugzilla_helper/bug_data.rb', line 35 def get_bugs_by_filter(filters) result = get_bugs_result(filters) JSON.parse(result.body).fetch('bugs', []) end |