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

Instance Method Details

#bug_data(bug_id) ⇒ JSON

Get bug data of bug

Parameters:

  • bug_id (String, Integer)

    id of bug

Returns:

  • (JSON)

    data



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

Parameters:

  • bug_id (Integer)

    is bug exists

Returns:

  • (Boolean)


24
25
26
27
28
29
# File 'lib/onlyoffice_bugzilla_helper/bug_data.rb', line 24

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

Parameters:

  • bug_id (String, Integer)

    id of bug

Returns:

  • (String)

    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