confluencer 0.2.1 → 0.2.2
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.
- data/VERSION +1 -1
- data/confluencer.gemspec +1 -1
- data/lib/confluence/bookmark.rb +13 -6
- data/lib/confluence/page.rb +6 -5
- data/lib/confluence/session.rb +3 -3
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.2
|
data/confluencer.gemspec
CHANGED
data/lib/confluence/bookmark.rb
CHANGED
@@ -3,13 +3,19 @@ module Confluence
|
|
3
3
|
BOOKMARKS_PAGE_TITLE = ".bookmarks"
|
4
4
|
|
5
5
|
attr_reader :bookmark_url, :description
|
6
|
-
|
6
|
+
|
7
7
|
def initialize(hash)
|
8
8
|
super(hash)
|
9
|
-
|
10
|
-
#
|
11
|
-
|
12
|
-
|
9
|
+
|
10
|
+
# if no content, try to use hash to initialize, delete in the process
|
11
|
+
unless content
|
12
|
+
self.bookmark_url = attributes.delete :bookmark_url
|
13
|
+
self.description = attributes.delete :description
|
14
|
+
else
|
15
|
+
# parse bookmark_url and description out of content
|
16
|
+
@bookmark_url = content[/\{bookmark:url=([^\}]+)\}/, 1]
|
17
|
+
@description = content[/\{bookmark.*\}([^\{]*)\{bookmark\}/, 1]
|
18
|
+
end
|
13
19
|
end
|
14
20
|
|
15
21
|
def bookmark_url=(value)
|
@@ -28,8 +34,9 @@ module Confluence
|
|
28
34
|
|
29
35
|
def store
|
30
36
|
# always set .bookmarks as the parent page
|
31
|
-
parent_id = Page.find_by_title(space, BOOKMARKS_PAGE_TITLE).page_id
|
37
|
+
self.parent_id = Page.find_by_title(space, BOOKMARKS_PAGE_TITLE).page_id
|
32
38
|
|
39
|
+
# continue with storing the page
|
33
40
|
super
|
34
41
|
end
|
35
42
|
|
data/lib/confluence/page.rb
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
module Confluence
|
2
2
|
class Page < Record
|
3
3
|
record_attr_accessor :id => :page_id
|
4
|
-
record_attr_accessor :parentId
|
4
|
+
record_attr_accessor :parentId => :parent_id
|
5
|
+
record_attr_accessor :space
|
5
6
|
record_attr_accessor :title, :creator, :modifier, :content
|
6
7
|
record_attr_accessor :created, :modified
|
7
8
|
record_attr_accessor :url
|
@@ -18,12 +19,12 @@ module Confluence
|
|
18
19
|
client.removePage(page_id)
|
19
20
|
end
|
20
21
|
|
21
|
-
def self.find_by_id(
|
22
|
-
self.new(client.getPage(
|
22
|
+
def self.find_by_id(page_id)
|
23
|
+
self.new(client.getPage(page_id))
|
23
24
|
end
|
24
25
|
|
25
|
-
def self.find_by_title(
|
26
|
-
self.new(client.getPage(
|
26
|
+
def self.find_by_title(space, title)
|
27
|
+
self.new(client.getPage(space, title))
|
27
28
|
end
|
28
29
|
end
|
29
30
|
end
|
data/lib/confluence/session.rb
CHANGED
@@ -6,10 +6,10 @@ module Confluence
|
|
6
6
|
client.token
|
7
7
|
end
|
8
8
|
|
9
|
-
def initialize(arguments = {}
|
9
|
+
def initialize(arguments = {})
|
10
10
|
raise ArgumentError, "Required argument 'url' is missing." unless arguments.key? :url
|
11
11
|
|
12
|
-
@client = Client.new(arguments)
|
12
|
+
@client = Confluence::Client.new(arguments)
|
13
13
|
|
14
14
|
unless @client.has_token?
|
15
15
|
raise ArgumentError, "Required argument 'username' is missing." unless arguments.key? :username
|
@@ -22,7 +22,7 @@ module Confluence
|
|
22
22
|
# set client for records
|
23
23
|
Confluence::Record::client = @client
|
24
24
|
|
25
|
-
|
25
|
+
yield @client if block_given?
|
26
26
|
|
27
27
|
Confluence::Record::client = nil
|
28
28
|
rescue RuntimeError => e
|