Class: RExchange::Credentials
- Inherits:
-
Object
- Object
- RExchange::Credentials
- Defined in:
- lib/rexchange/credentials.rb
Overview
Credentials are passed around between Folders to emulate a stateful connection with the RExchange::Session
Instance Attribute Summary collapse
-
#auth_cookie ⇒ Object
Returns the value of attribute auth_cookie.
-
#dav_uri ⇒ Object
readonly
Returns the value of attribute dav_uri.
-
#owa_uri ⇒ Object
readonly
Returns the value of attribute owa_uri.
-
#password ⇒ Object
readonly
Returns the value of attribute password.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
- #dav_use_ssl? ⇒ Boolean
-
#initialize(dav_uri = nil, owa_uri = nil, username = nil, password = nil) ⇒ Credentials
constructor
You must pass a dav_uri, owa_uri, a username and a password.
- #is_owa? ⇒ Boolean
Constructor Details
#initialize(dav_uri = nil, owa_uri = nil, username = nil, password = nil) ⇒ Credentials
You must pass a dav_uri, owa_uri, a username and a password
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/rexchange/credentials.rb', line 12 def initialize(dav_uri = nil, owa_uri = nil, username = nil, password = nil) owa_uri = nil if owa_uri && owa_uri.blank? @dav_uri = URI.parse(dav_uri) if dav_uri @owa_uri = URI.parse(owa_uri) if owa_uri @dav_use_ssl = @dav_uri.scheme ? (@dav_uri.scheme.downcase == 'https') : false @user = username || (@dav_uri && @dav_uri.userinfo ? @dav_uri.userinfo.split(':')[0] : nil) || (@owa_uri && @owa_uri.userinfo ? @owa_uri.userinfo.split(':')[0] : nil) @password = password || (@dav_uri && @dav_uri.userinfo ? @dav_uri.userinfo.split(':')[1] : nil) || (@owa_uri && @owa_uri.userinfo ? @owa_uri.userinfo.split(':')[1] : nil) @dav_port = (@dav_uri.port || @dav_uri.default_port) if @dav_uri @owa_port = (@owa_uri.port || @owa_uri.default_port) if @owa_uri if block_given? yield self else return self end end |
Instance Attribute Details
#auth_cookie ⇒ Object
Returns the value of attribute auth_cookie.
9 10 11 |
# File 'lib/rexchange/credentials.rb', line 9 def end |
#dav_uri ⇒ Object (readonly)
Returns the value of attribute dav_uri.
8 9 10 |
# File 'lib/rexchange/credentials.rb', line 8 def dav_uri @dav_uri end |
#owa_uri ⇒ Object (readonly)
Returns the value of attribute owa_uri.
8 9 10 |
# File 'lib/rexchange/credentials.rb', line 8 def owa_uri @owa_uri end |
#password ⇒ Object (readonly)
Returns the value of attribute password.
8 9 10 |
# File 'lib/rexchange/credentials.rb', line 8 def password @password end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
8 9 10 |
# File 'lib/rexchange/credentials.rb', line 8 def user @user end |
Instance Method Details
#dav_use_ssl? ⇒ Boolean
28 29 30 |
# File 'lib/rexchange/credentials.rb', line 28 def dav_use_ssl? @dav_use_ssl end |
#is_owa? ⇒ Boolean
32 33 34 |
# File 'lib/rexchange/credentials.rb', line 32 def is_owa? @owa_uri && @owa_uri.scheme && @owa_uri.host end |