confluencer 0.4.3 → 0.4.4
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/session.rb +20 -0
- data/spec/confluence/session_spec.rb +11 -0
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.4
|
data/confluencer.gemspec
CHANGED
data/lib/confluence/session.rb
CHANGED
@@ -46,6 +46,26 @@ module Confluence
|
|
46
46
|
client.token if client
|
47
47
|
end
|
48
48
|
|
49
|
+
# Logs in and acquire a new token after destroying the previous session.
|
50
|
+
#
|
51
|
+
# ==== Parameters
|
52
|
+
# arguments<Hash>:: Described below.
|
53
|
+
#
|
54
|
+
# ==== Arguments
|
55
|
+
# :username - The username.
|
56
|
+
# :password - The password.
|
57
|
+
#
|
58
|
+
def login(arguments)
|
59
|
+
raise ArgumentError, "Required argument 'username' is missing." unless arguments.key? :username
|
60
|
+
raise ArgumentError, "Required argument 'password' is missing." unless arguments.key? :password
|
61
|
+
|
62
|
+
# log out first
|
63
|
+
client.logout if client
|
64
|
+
|
65
|
+
# log in with credentials
|
66
|
+
@client.login(arguments[:username], arguments[:password])
|
67
|
+
end
|
68
|
+
|
49
69
|
# Destroys the session by logging out and resets other classes like Confluence::Page.
|
50
70
|
#
|
51
71
|
def destroy
|
@@ -29,4 +29,15 @@ describe Confluence::Session do
|
|
29
29
|
session.client.should be_nil
|
30
30
|
session.token.should be_nil
|
31
31
|
end
|
32
|
+
|
33
|
+
it "should log in again and acquire new token" do
|
34
|
+
session = Confluence::Session.new config
|
35
|
+
token = session.token
|
36
|
+
|
37
|
+
# log in again
|
38
|
+
session.login(config)
|
39
|
+
session.token.should_not == token
|
40
|
+
|
41
|
+
session.destroy
|
42
|
+
end
|
32
43
|
end
|