confluencer 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.1
1
+ 0.2.2
data/confluencer.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{confluencer}
8
- s.version = "0.2.1"
8
+ s.version = "0.2.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Gabor Ratky"]
@@ -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
- # parse bookmark_url and description out of content
11
- @bookmark_url = content[/\{bookmark:url=([^\}]+)\}/, 1] if content
12
- @description = content[/\{bookmark.*\}([^\{]*)\{bookmark\}/, 1] if content
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
 
@@ -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, :space
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(pageid)
22
- self.new(client.getPage(pageid))
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(spacekey, title)
26
- self.new(client.getPage(spacekey, title))
26
+ def self.find_by_title(space, title)
27
+ self.new(client.getPage(space, title))
27
28
  end
28
29
  end
29
30
  end
@@ -6,10 +6,10 @@ module Confluence
6
6
  client.token
7
7
  end
8
8
 
9
- def initialize(arguments = {}, &block)
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
- block.call(@client) if block
25
+ yield @client if block_given?
26
26
 
27
27
  Confluence::Record::client = nil
28
28
  rescue RuntimeError => e
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- - 1
9
- version: 0.2.1
8
+ - 2
9
+ version: 0.2.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Gabor Ratky