onlyoffice_bugzilla_helper 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8546f46503248d965497169d720b46bb608883a248a22338fc9d56a82082c857
4
- data.tar.gz: 9ac958331df297a80cfcb709a3539f0ff6d744d800d9c1ef3a9416296d7527c8
3
+ metadata.gz: acbaa61a748e1d1b3e298fe2f9efde9777563108d19c5d23cc673d4dfa23b228
4
+ data.tar.gz: af6d86186bf9ab27adf4e748f5d7f5918dd45b2cc3a7d27a046423010fd6c790
5
5
  SHA512:
6
- metadata.gz: 20534e8b08c71fbb9d2e4beb8ec3bdde5404508d32b08510d010663af2f195547f79bb1c72d847a67a1c1274b2546621a99978a3cca383b8a66c512f87b22a72
7
- data.tar.gz: '0369bca03402e01e59a0ad7a423ea02952c5baaba5b7164ab47f0bb5fcfdd433c5cd9118fc25d291368b07386ce46705922514d97bb2f386d8b20ff00432c776'
6
+ metadata.gz: b8dbff38b2430541cced2acb312a20f651bc2e07bbb59b48a782b6119b7936876a76060992bedea6942323965c415850035686f31d6ff23dd2acbd3bd4dedf95
7
+ data.tar.gz: ebb566a1a4590baa7df29062c654fe73653404bfa5e92d21c86a7a099f263e5baf7fa0f8698724752107e2c11a692407c53c12e520b0cd734e82db8cfa01c5a0
data/Changelog.md CHANGED
@@ -2,6 +2,11 @@
2
2
 
3
3
  ## master (unreleased)
4
4
 
5
+ ## 0.2.0 (2018-05-15)
6
+ ### New features
7
+ * New method `BugzillaHelper#bug_exists?`
8
+ * Extract `BugzillaHelper#bug_data` to separate method
9
+
5
10
  ## 0.1.1 (2018-05-15)
6
11
  * Fix getting id from string with spaces
7
12
 
@@ -2,12 +2,14 @@ require 'cgi'
2
2
  require 'json'
3
3
  require 'net/http'
4
4
  require 'uri'
5
+ require 'onlyoffice_bugzilla_helper/bug_data'
5
6
  require 'onlyoffice_bugzilla_helper/version'
6
7
 
7
8
  # Helper for bugzilla, used in QA
8
9
  module OnlyofficeBugzillaHelper
9
10
  # Class to check bugzilla via http
10
11
  class BugzillaHelper
12
+ include BugData
11
13
  attr_reader :url
12
14
 
13
15
  def initialize(bugzilla_url: 'bugzilla.onlyoffice.com',
@@ -18,16 +20,6 @@ module OnlyofficeBugzillaHelper
18
20
  @show_bug_param = 'id'
19
21
  end
20
22
 
21
- # Get status of bug
22
- # @param bug_id [String, Integer] id of bug
23
- # @return [String] status of bug
24
- def bug_status(bug_id)
25
- res = get_bug_result(bug_id, 80)
26
- res = get_bug_result(bug_id, 443) if response_redirect?(res)
27
- parsed_json = JSON.parse(res.body)
28
- parsed_json['bugs'].first['status']
29
- end
30
-
31
23
  # Get bug id from url
32
24
  # @param string [String] string for error
33
25
  # @return [Integer, Nil] result of bug id from url
@@ -0,0 +1,30 @@
1
+ module OnlyofficeBugzillaHelper
2
+ # Method to work with bug data
3
+ module BugData
4
+ # Get bug data of bug
5
+ # @param bug_id [String, Integer] id of bug
6
+ # @return [JSON] data
7
+ def bug_data(bug_id)
8
+ res = get_bug_result(bug_id, 80)
9
+ res = get_bug_result(bug_id, 443) if response_redirect?(res)
10
+ JSON.parse(res.body)['bugs'].first
11
+ end
12
+
13
+ # Get status of bug
14
+ # @param bug_id [String, Integer] id of bug
15
+ # @return [String] status of bug
16
+ def bug_status(bug_id)
17
+ parsed_json = bug_data(bug_id)
18
+ parsed_json['status']
19
+ end
20
+
21
+ # @param bug_id [Integer] is bug exists
22
+ # @return [Boolean]
23
+ def bug_exists?(bug_id)
24
+ bug_status(bug_id)
25
+ true
26
+ rescue JSON::ParserError
27
+ false
28
+ end
29
+ end
30
+ end
@@ -1,3 +1,3 @@
1
1
  module OnlyofficeBugzillaHelper
2
- VERSION = '0.1.1'.freeze
2
+ VERSION = '0.2.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: onlyoffice_bugzilla_helper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavel Lobashov
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-05-15 00:00:00.000000000 Z
12
+ date: 2018-06-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -73,6 +73,7 @@ files:
73
73
  - README.md
74
74
  - Rakefile
75
75
  - lib/onlyoffice_bugzilla_helper.rb
76
+ - lib/onlyoffice_bugzilla_helper/bug_data.rb
76
77
  - lib/onlyoffice_bugzilla_helper/version.rb
77
78
  - onlyoffice_bugzilla_helper.gemspec
78
79
  homepage: http://rubygems.org/gems/onlyoffice_bugzilla_helper