Class: Umami::Configuration
- Inherits:
-
Object
- Object
- Umami::Configuration
- Defined in:
- lib/umami/configuration.rb
Constant Summary collapse
- UMAMI_CLOUD_URL =
"https://api.umami.is".freeze
Instance Attribute Summary collapse
-
#access_token ⇒ Object
Returns the value of attribute access_token.
-
#password ⇒ Object
readonly
Returns the value of attribute password.
-
#request_timeout ⇒ Object
readonly
Returns the value of attribute request_timeout.
-
#uri_base ⇒ Object
Returns the value of attribute uri_base.
-
#username ⇒ Object
readonly
Returns the value of attribute username.
Instance Method Summary collapse
- #cloud? ⇒ Boolean
- #credentials=(creds) ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
7 8 9 10 11 12 13 |
# File 'lib/umami/configuration.rb', line 7 def initialize @uri_base = nil @request_timeout = 120 @access_token = nil @username = nil @password = nil end |
Instance Attribute Details
#access_token ⇒ Object
Returns the value of attribute access_token.
5 6 7 |
# File 'lib/umami/configuration.rb', line 5 def access_token @access_token end |
#password ⇒ Object (readonly)
Returns the value of attribute password.
5 6 7 |
# File 'lib/umami/configuration.rb', line 5 def password @password end |
#request_timeout ⇒ Object (readonly)
Returns the value of attribute request_timeout.
5 6 7 |
# File 'lib/umami/configuration.rb', line 5 def request_timeout @request_timeout end |
#uri_base ⇒ Object
Returns the value of attribute uri_base.
5 6 7 |
# File 'lib/umami/configuration.rb', line 5 def uri_base @uri_base end |
#username ⇒ Object (readonly)
Returns the value of attribute username.
5 6 7 |
# File 'lib/umami/configuration.rb', line 5 def username @username end |
Instance Method Details
#cloud? ⇒ Boolean
36 37 38 |
# File 'lib/umami/configuration.rb', line 36 def cloud? @access_token && @uri_base.nil? end |
#credentials=(creds) ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/umami/configuration.rb', line 27 def credentials=(creds) raise Umami::ConfigurationError, "Both username and password are required" unless creds[:username] && creds[:password] @username = creds[:username] @password = creds[:password] @access_token = nil validate_configuration end |