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
-
#password ⇒ Object
readonly
Returns the value of attribute password.
-
#uri ⇒ Object
readonly
Returns the value of attribute uri.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
-
#initialize(uri, username = nil, password = nil) ⇒ Credentials
constructor
You must pass a uri, a username and a password.
- #use_ssl? ⇒ Boolean
Constructor Details
#initialize(uri, username = nil, password = nil) ⇒ Credentials
You must pass a uri, a username and a password
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/rexchange/credentials.rb', line 11 def initialize(uri, username = nil, password = nil) @uri = URI.parse(uri) @use_ssl = (@uri.scheme.downcase == 'https') @user = @uri.userinfo ? @user.userinfo.split(':')[0] : username @password = @uri.userinfo ? @user.userinfo.split(':')[1] : password @port = @uri.port || @uri.default_port if block_given? yield self else return self end end |
Instance Attribute Details
#password ⇒ Object (readonly)
Returns the value of attribute password.
8 9 10 |
# File 'lib/rexchange/credentials.rb', line 8 def password @password end |
#uri ⇒ Object (readonly)
Returns the value of attribute uri.
8 9 10 |
# File 'lib/rexchange/credentials.rb', line 8 def uri @uri 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
#use_ssl? ⇒ Boolean
25 26 27 |
# File 'lib/rexchange/credentials.rb', line 25 def use_ssl? @use_ssl end |