Class: SpotifyExporter::ConfigManager

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/spotifyexporter/config.rb

Constant Summary collapse

DEFAULT_CONFIG_DIR =
".config/spotifyexporter"
FILE_CLI_CONFIG =
"config.yml"

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#config_pathObject (readonly)

Returns the value of attribute config_path.



46
47
48
# File 'lib/spotifyexporter/config.rb', line 46

def config_path
  @config_path
end

Instance Method Details

#configAppConfig

Retrieves the AppConfig

Returns:



71
72
73
74
75
# File 'lib/spotifyexporter/config.rb', line 71

def config
  load_config_file unless config_loaded?

  @app_config
end

#save_credentials(client_id:, secret:) ⇒ Boolean

Loads and saves the credentials to the main configuration

Returns:

  • (Boolean)


57
58
59
60
61
62
63
64
# File 'lib/spotifyexporter/config.rb', line 57

def save_credentials(client_id:, secret:)
  load_config_file unless config_loaded?

  @app_config.spotify_client_id = client_id
  @app_config.spotify_client_secret = secret

  save_config!
end