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 CHANGED
@@ -1 +1 @@
1
- 0.4.3
1
+ 0.4.4
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{confluencer}
8
- s.version = "0.4.3"
8
+ s.version = "0.4.4"
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"]
@@ -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
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 4
8
- - 3
9
- version: 0.4.3
8
+ - 4
9
+ version: 0.4.4
10
10
  platform: ruby
11
11
  authors:
12
12
  - Gabor Ratky