module TmConfig
Constants
- API_BASE
- PLUGIN_NAME
Public Instance Methods
Source
# File lib/tm_config.rb, line 9 def api_key(key: nil) resolved = key.to_s.strip resolved = ENV.fetch("IPAUSTRALIA_API_KEY", "").to_s.strip if resolved.empty? if resolved.empty? db = load_db_credentials resolved = db[:api_key].to_s end resolved end
Source
# File lib/tm_config.rb, line 19 def configured?(key: nil) !api_key(key: key).empty? end
Source
# File lib/tm_config.rb, line 23 def load_db_credentials require_relative "rabbot_db" RabbotDb.get_plugin_json(plugin: PLUGIN_NAME, key: "tm_credentials", default: {}) .transform_keys(&:to_sym) rescue StandardError { api_key: "" } end
Source
# File lib/tm_config.rb, line 31 def setup_hint "IP Australia API key required — set IPAUSTRALIA_API_KEY, or store via RabbotDb plugin_data." end