supportal 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/lib/supportal/confluence.rb +14 -8
- data/lib/supportal/request.rb +2 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: d12937385e2260679553660d0d0f1f405ca84c2893d405d0bb9e80ac24ce8987
|
4
|
+
data.tar.gz: 339a7bd31e4cf2a9c00b8de373f6160eba7a62cf222a8e6cd6a30bf2f3cf4424
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d68cd26981a017d35e305824bcb148b4d6cb5a57fac44b22e2513a69ee7c8f96e360c4aaec3def934e6df57ef3937b213aae7f4d37df6c918b466d5de09fea77
|
7
|
+
data.tar.gz: ff67e2552c7ae6a0c6bdf669dac3715ce61563a1352a9a04ce710531d8dd572110126c780a93e52b5aae0b2f30e6d1b24415fd107264f48852a319d4fb659dfb
|
data/lib/supportal/confluence.rb
CHANGED
@@ -3,6 +3,8 @@ require 'cgi'
|
|
3
3
|
class Supportal::Confluence
|
4
4
|
|
5
5
|
def initialize(user, pass, instance)
|
6
|
+
@logger = Supportal::MicrosLogger.create(STDOUT)
|
7
|
+
@logger.level = Logger::INFO
|
6
8
|
@host = instance
|
7
9
|
@user = user
|
8
10
|
@pass = pass
|
@@ -39,16 +41,20 @@ class Supportal::Confluence
|
|
39
41
|
def search(str, root_doc_page_ids, space, label)
|
40
42
|
root_page_cql = root_doc_page_ids.map { |root_page| "(container=#{root_page} OR ancestor=#{root_page})" }.join(" OR ")
|
41
43
|
path = '/rest/api/search?limit=10&expand=version&cql='
|
42
|
-
cql = CGI.escape("text~\"#{str}\" AND (space=#{space} OR label=\"#{label}\") AND (((#{root_page_cql}) AND (type=blogpost OR type=page OR type=comment)) OR (type=\"com.atlassian.confluence.plugins.confluence-questions:question\" OR type=\"com.atlassian.confluence.plugins.confluence-questions:answer\"))")
|
44
|
+
cql = CGI.escape("text~\"#{str}\" AND (space=#{space} OR label=\"#{label}\") AND (((#{root_page_cql}) AND (type=blogpost OR type=page OR type=comment)) OR (type=\"ac:com.atlassian.confluence.plugins.confluence-questions:question\" OR type=\"ac:com.atlassian.confluence.plugins.confluence-questions:answer\"))")
|
43
45
|
body = Supportal::Request.get_json(@host + path + cql, @user, @pass)
|
44
|
-
body
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
46
|
+
if body.dig('results')
|
47
|
+
return body['results'].map do |result|
|
48
|
+
{
|
49
|
+
title: highlight_filter(result['title']),
|
50
|
+
link: @host + result['url'],
|
51
|
+
date: result['lastModified'],
|
52
|
+
type: content_type_filter(result['content']['type'])
|
53
|
+
}
|
54
|
+
end
|
51
55
|
end
|
56
|
+
@logger.error body.inspect
|
57
|
+
return false
|
52
58
|
end
|
53
59
|
|
54
60
|
end
|
data/lib/supportal/request.rb
CHANGED
@@ -5,7 +5,7 @@ require 'uri'
|
|
5
5
|
|
6
6
|
class Supportal::Request
|
7
7
|
|
8
|
-
def self.get(url, user, pass)
|
8
|
+
def self.get(url, user, pass, content_type='application/json')
|
9
9
|
logger = Supportal::MicrosLogger.create(STDOUT)
|
10
10
|
logger.level = Logger::DEBUG # FIXME
|
11
11
|
uri = URI(url)
|
@@ -15,6 +15,7 @@ class Supportal::Request
|
|
15
15
|
logger.debug("Requesting: #{url}")
|
16
16
|
request = Net::HTTP::Get.new(url)
|
17
17
|
request.basic_auth(user, pass)
|
18
|
+
request.content_type = content_type
|
18
19
|
body = false
|
19
20
|
begin
|
20
21
|
http.request(request) do |response|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: supportal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Knight
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2018-
|
12
|
+
date: 2018-07-19 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: A library for pulling information from JIRA and Confluence for service
|
15
15
|
entrypoints
|
@@ -45,7 +45,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
45
45
|
version: '0'
|
46
46
|
requirements: []
|
47
47
|
rubyforge_project:
|
48
|
-
rubygems_version: 2.
|
48
|
+
rubygems_version: 2.7.6
|
49
49
|
signing_key:
|
50
50
|
specification_version: 4
|
51
51
|
summary: Supportal
|