Class: Harvest::Credentials
- Inherits:
-
Object
- Object
- Harvest::Credentials
- Defined in:
- lib/harvest/credentials.rb
Instance Attribute Summary (collapse)
-
- (Object) password
Returns the value of attribute password.
-
- (Object) ssl
Returns the value of attribute ssl.
-
- (Object) subdomain
Returns the value of attribute subdomain.
-
- (Object) username
Returns the value of attribute username.
Instance Method Summary (collapse)
- - (Object) basic_auth
- - (Object) host
-
- (Credentials) initialize(subdomain, username, password, ssl = true)
constructor
A new instance of Credentials.
- - (Boolean) valid?
Constructor Details
- (Credentials) initialize(subdomain, username, password, ssl = true)
A new instance of Credentials
5 6 7 |
# File 'lib/harvest/credentials.rb', line 5 def initialize(subdomain, username, password, ssl = true) @subdomain, @username, @password, @ssl = subdomain, username, password, ssl end |
Instance Attribute Details
- (Object) password
Returns the value of attribute password
3 4 5 |
# File 'lib/harvest/credentials.rb', line 3 def password @password end |
- (Object) ssl
Returns the value of attribute ssl
3 4 5 |
# File 'lib/harvest/credentials.rb', line 3 def ssl @ssl end |
- (Object) subdomain
Returns the value of attribute subdomain
3 4 5 |
# File 'lib/harvest/credentials.rb', line 3 def subdomain @subdomain end |
- (Object) username
Returns the value of attribute username
3 4 5 |
# File 'lib/harvest/credentials.rb', line 3 def username @username end |
Instance Method Details
- (Object) basic_auth
13 14 15 |
# File 'lib/harvest/credentials.rb', line 13 def basic_auth Base64.encode64("#{username}:#{password}").delete("\r\n") end |
- (Object) host
17 18 19 |
# File 'lib/harvest/credentials.rb', line 17 def host "#{ssl ? "https" : "http"}://#{subdomain}.harvestapp.com" end |
- (Boolean) valid?
9 10 11 |
# File 'lib/harvest/credentials.rb', line 9 def valid? !subdomain.nil? && !username.nil? && !password.nil? end |