Class: MetabaseQuerySync::MetabaseCredentials
- Inherits:
-
Object
- Object
- MetabaseQuerySync::MetabaseCredentials
- Defined in:
- lib/metabase_query_sync/metabase_credentials.rb
Instance Attribute Summary collapse
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#pass ⇒ Object
readonly
Returns the value of attribute pass.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(host:, user:, pass:) ⇒ MetabaseCredentials
constructor
A new instance of MetabaseCredentials.
Constructor Details
#initialize(host:, user:, pass:) ⇒ MetabaseCredentials
Returns a new instance of MetabaseCredentials.
4 5 6 7 8 9 |
# File 'lib/metabase_query_sync/metabase_credentials.rb', line 4 def initialize(host:, user:, pass:) raise "Metabase credentials for host, user, pass must not be empty)" if host == nil || user == nil || pass == nil @host = host @user = user @pass = pass end |
Instance Attribute Details
#host ⇒ Object (readonly)
Returns the value of attribute host.
2 3 4 |
# File 'lib/metabase_query_sync/metabase_credentials.rb', line 2 def host @host end |
#pass ⇒ Object (readonly)
Returns the value of attribute pass.
2 3 4 |
# File 'lib/metabase_query_sync/metabase_credentials.rb', line 2 def pass @pass end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
2 3 4 |
# File 'lib/metabase_query_sync/metabase_credentials.rb', line 2 def user @user end |
Class Method Details
.from_env(host: nil, user: nil, pass: nil, env: ENV) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/metabase_query_sync/metabase_credentials.rb', line 11 def self.from_env(host: nil, user: nil, pass: nil, env: ENV) self.new( host: host || env['METABASE_QUERY_SYNC_HOST'], user: user || env['METABASE_QUERY_SYNC_USER'], pass: pass || env['METABASE_QUERY_SYNC_PASS'], ) end |