confluence-client 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/HISTORY +5 -0
- data/README.rdoc +13 -0
- data/lib/confluence-client.rb +47 -3
- data/lib/confluence-client/version.rb +1 -1
- metadata +3 -3
data/HISTORY
CHANGED
data/README.rdoc
CHANGED
@@ -30,6 +30,19 @@
|
|
30
30
|
puts "unable to remove space: #{c.error}"
|
31
31
|
end
|
32
32
|
|
33
|
+
user = confluence.get_user('stan')
|
34
|
+
if user
|
35
|
+
puts "found user: #{user.inspect}"
|
36
|
+
else
|
37
|
+
user = confluence.add_user( 'stan', 'stan has a name', 'stan@example.com' )
|
38
|
+
end
|
39
|
+
|
40
|
+
if confluence.remove_user('stan')
|
41
|
+
puts 'removed user'
|
42
|
+
else
|
43
|
+
puts "unable to remove user: #{c.error}"
|
44
|
+
end
|
45
|
+
|
33
46
|
confluence.logout
|
34
47
|
end
|
35
48
|
|
data/lib/confluence-client.rb
CHANGED
@@ -33,6 +33,19 @@ module Confluence # :nodoc:
|
|
33
33
|
# puts "unable to remove space: #{c.error}"
|
34
34
|
# end
|
35
35
|
#
|
36
|
+
# user = confluence.get_user('stan')
|
37
|
+
# if user
|
38
|
+
# puts "found user: #{user.inspect}"
|
39
|
+
# else
|
40
|
+
# user = confluence.add_user( 'stan', 'stan has a name', 'stan@example.com' )
|
41
|
+
# end
|
42
|
+
#
|
43
|
+
# if confluence.remove_user('stan')
|
44
|
+
# puts 'removed user'
|
45
|
+
# else
|
46
|
+
# puts "unable to remove user: #{c.error}"
|
47
|
+
# end
|
48
|
+
#
|
36
49
|
# confluence.logout
|
37
50
|
# end
|
38
51
|
#
|
@@ -63,7 +76,7 @@ module Confluence # :nodoc:
|
|
63
76
|
yield self if block_given?
|
64
77
|
end
|
65
78
|
|
66
|
-
# Create Confluence space.
|
79
|
+
# Create Confluence space. Return space hash or nil.
|
67
80
|
#
|
68
81
|
# Params:
|
69
82
|
# +key+:: Key for space.
|
@@ -75,21 +88,44 @@ module Confluence # :nodoc:
|
|
75
88
|
nil
|
76
89
|
end
|
77
90
|
|
91
|
+
# Create Confluence user. Return user hash or nil.
|
92
|
+
#
|
93
|
+
# Params:
|
94
|
+
# +login+:: User login.
|
95
|
+
# +name+:: User name.
|
96
|
+
# +email+:: User email.
|
97
|
+
# +password+:: User password. Defaults to +Time.now.to_i.to_s+.
|
98
|
+
def add_user(login, name, email, password = nil )
|
99
|
+
addUser( { 'email' => email, 'fullname' => name, 'name' => login }, password || Time.now.to_i.to_s )
|
100
|
+
return get_user(login) if ok?
|
101
|
+
nil
|
102
|
+
end
|
103
|
+
|
78
104
|
# Was there an error on the last request?
|
79
105
|
def error?
|
80
106
|
!ok?
|
81
107
|
end
|
82
108
|
|
83
|
-
# Return Confluence space or nil.
|
109
|
+
# Return Confluence space hash or nil.
|
84
110
|
#
|
85
111
|
# Params:
|
86
|
-
# +key+::
|
112
|
+
# +key+:: Fetch this space.
|
87
113
|
def get_space(key)
|
88
114
|
space = getSpace(key)
|
89
115
|
return space if ok?
|
90
116
|
nil
|
91
117
|
end
|
92
118
|
|
119
|
+
# Return Confluence user hash or nil.
|
120
|
+
#
|
121
|
+
# Params:
|
122
|
+
# +login+:: Fetch this user.
|
123
|
+
def get_user(login)
|
124
|
+
user = getUser(login)
|
125
|
+
return user if ok?
|
126
|
+
nil
|
127
|
+
end
|
128
|
+
|
93
129
|
# Login to the Confluence XML/RPC API.
|
94
130
|
def login(user, password)
|
95
131
|
raise ArgumentError if user.nil? || password.nil?
|
@@ -134,6 +170,14 @@ module Confluence # :nodoc:
|
|
134
170
|
return removeSpace(key)
|
135
171
|
end
|
136
172
|
|
173
|
+
# Remove Confluence user. Returns boolean.
|
174
|
+
#
|
175
|
+
# Params:
|
176
|
+
# +login+:: Remove this user.
|
177
|
+
def remove_user(login)
|
178
|
+
return removeUser(login)
|
179
|
+
end
|
180
|
+
|
137
181
|
# Make the Confluence exceptions more readable.
|
138
182
|
#
|
139
183
|
# Params:
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: confluence-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -14,7 +14,7 @@ default_executable:
|
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rspec
|
17
|
-
requirement: &
|
17
|
+
requirement: &2154665360 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
@@ -22,7 +22,7 @@ dependencies:
|
|
22
22
|
version: 2.5.0
|
23
23
|
type: :development
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *2154665360
|
26
26
|
description: Ruby client for the Confluence XML::RPC API
|
27
27
|
email:
|
28
28
|
- blair.christensen@gmail.com
|