confluencer 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,8 @@
1
1
  = confluencer
2
2
 
3
- Description goes here.
3
+ Easy to use, ActiveRecord-like classes to find spaces, pages and bookmarks as well as adding new ones and updating existing ones. Very much work in progress, every version will most likely break your code. I will update the README when the codebase is more stable.
4
+
5
+ Uses the Confluence XMLRPC API (v1).
4
6
 
5
7
  == Note on Patches/Pull Requests
6
8
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.0
1
+ 0.3.1
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{confluencer}
8
- s.version = "0.3.0"
8
+ s.version = "0.3.1"
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"]
12
- s.date = %q{2010-05-11}
12
+ s.date = %q{2010-05-12}
13
13
  s.description = %q{ActiveRecord-like classes to access Confluence through XMLRPC.}
14
14
  s.email = %q{rgabo@rgabostyle.com}
15
15
  s.extra_rdoc_files = [
@@ -83,9 +83,15 @@ module Confluence
83
83
  else
84
84
  log.debug "#{method_name}(#{(args.collect {|a| a.inspect}).join(', ')})"
85
85
  end
86
- result = proxy.send(method_name, *([@token] + args))
87
- log.debug(result.inspect)
88
- result
86
+
87
+ begin
88
+ result = proxy.send(method_name, *([@token] + args))
89
+ log.debug(result.inspect)
90
+ result
91
+ rescue EOFError => e
92
+ log.warn "Could not complete XMLRPC call, retrying... Error: #{e.inspect}"
93
+ retry
94
+ end
89
95
  end
90
96
  end
91
97
 
@@ -118,7 +124,7 @@ module Confluence
118
124
  begin
119
125
  block.call
120
126
  rescue XMLRPC::FaultException => e
121
- log.warn message = e.faultString.rpartition(':').last
127
+ log.warn message = e.faultString.rpartition(':').last.strip
122
128
 
123
129
  case message
124
130
  when /Transaction rolled back/
@@ -8,7 +8,7 @@ module Confluence
8
8
  record_attr_accessor :title, :creator, :modifier, :content
9
9
  record_attr_accessor :created, :modified, :version
10
10
  record_attr_accessor :url
11
-
11
+
12
12
  def children(klass = self.class)
13
13
  children = client.getChildren(page_id)
14
14
  children.collect { |child| klass.find(:id => child["id"]) } if children
@@ -44,13 +44,17 @@ module Confluence
44
44
  end
45
45
  end
46
46
 
47
+ def client
48
+ Record.client
49
+ end
50
+
47
51
  attr_accessor :attributes
48
52
 
49
53
  # Initializes a new record.
50
54
  #
51
55
  # ==== Parameters
52
56
  # hash<Hash>:: A hash containing the attributes and its values. Keys can be Strings or Symbols.
53
- def initialize(hash)
57
+ def initialize(hash = {})
54
58
  @attributes = {}
55
59
 
56
60
  # iterate through each key/value pair and set attribute keyed by symbol
@@ -86,11 +90,5 @@ module Confluence
86
90
 
87
91
  @labels = value
88
92
  end
89
-
90
- private
91
-
92
- def client
93
- Record.client
94
- end
95
93
  end
96
94
  end
@@ -13,7 +13,7 @@ module Confluence
13
13
  end
14
14
 
15
15
  def bookmarks
16
- bookmark_page ? bookmark_page.children(Bookmark) : []
16
+ @bookmarks ||= bookmark_page ? bookmark_page.children(Bookmark) : []
17
17
  end
18
18
 
19
19
  def blog_entries
@@ -1,9 +1,23 @@
1
1
  require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
2
2
 
3
3
  describe Confluence::Record do
4
- it "should initialize new record from Confluence hash" do
5
- record = Confluence::Record.new :foo => 'bar'
4
+ it "should store the client" do
5
+ Confluence::Record.client = 'client'
6
+
7
+ Confluence::Record.client.should == 'client'
8
+ Confluence::Record.new.client.should == 'client'
9
+ end
10
+
11
+ it "should initialize new record from hash" do
12
+ record = Confluence::Record.new(:foo => 'bar', 'string' => 'works')
6
13
 
7
14
  record[:foo].should == 'bar'
15
+ record[:string].should == 'works'
16
+ end
17
+
18
+ it "should return the id of the record" do
19
+ record = Confluence::Record.new 'id' => '12345'
20
+
21
+ record.record_id.should == '12345'
8
22
  end
9
23
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 3
8
- - 0
9
- version: 0.3.0
8
+ - 1
9
+ version: 0.3.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Gabor Ratky
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-05-11 00:00:00 +02:00
17
+ date: 2010-05-12 00:00:00 +02:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency