Class: RubyTapasDownloader::Config
- Inherits:
-
Object
- Object
- RubyTapasDownloader::Config
- Defined in:
- lib/ruby_tapas_downloader/config.rb
Overview
Retrieve configurations.
Constant Summary collapse
- CONFIG_KEYS =
[ EMAIL = 'RUBY_TAPAS_DOWNLOADER_EMAIL', PASSWORD = 'RUBY_TAPAS_DOWNLOADER_PASSWORD', DOWNLOAD_PATH = 'RUBY_TAPAS_DOWNLOADER_DOWNLOAD_PATH' ]
Class Method Summary collapse
-
.default_download_path ⇒ Object
Default Download path.
-
.default_email ⇒ Object
Default Email.
-
.default_password ⇒ Object
Default Password.
-
.update(email: nil, password: nil, download_path: nil) ⇒ Object
Updates user preferences.
-
.urls ⇒ Hash
Retrieve urls stored in ‘urls.yml`.
Class Method Details
.default_download_path ⇒ Object
Default Download path
29 30 31 |
# File 'lib/ruby_tapas_downloader/config.rb', line 29 def default_download_path user_configurations[DOWNLOAD_PATH] end |
.default_email ⇒ Object
Default Email
19 20 21 |
# File 'lib/ruby_tapas_downloader/config.rb', line 19 def default_email user_configurations[EMAIL] end |
.default_password ⇒ Object
Default Password
24 25 26 |
# File 'lib/ruby_tapas_downloader/config.rb', line 24 def default_password user_configurations[PASSWORD] end |
.update(email: nil, password: nil, download_path: nil) ⇒ Object
Updates user preferences
34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/ruby_tapas_downloader/config.rb', line 34 def update(email: nil, password: nil, download_path: nil) download_path = absolute_path(download_path) new_configs = { EMAIL => email, PASSWORD => password, DOWNLOAD_PATH => download_path } user_configurations[EMAIL] = email user_configurations[PASSWORD] = password user_configurations[DOWNLOAD_PATH] = download_path user_configurations.store new_configs end |
.urls ⇒ Hash
Retrieve urls stored in ‘urls.yml`.
14 15 16 |
# File 'lib/ruby_tapas_downloader/config.rb', line 14 def urls @urls ||= YAML.load_file urls_config_path end |