Module: Yourub::Config

Extended by:
Forwardable
Defined in:
lib/yourub/config.rb

Constant Summary collapse

MANDATORY_KEYS =
[:developer_key, :application_name, :application_version, :log_level]
USER_CONFIG_KEYS =

Only these keys are read from YAML or from Client.new(opts). The API is always YouTube Data API v3 via google-apis-youtube_v3 (+YouTubeService+).

%i[developer_key application_name application_version log_level].freeze

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.config ⇒ Object

Returns the value of attribute config.



10
11
12
# File 'lib/yourub/config.rb', line 10

def config
  @config
end

Class Method Details

.load!(file_path, environment) ⇒ Object



21
22
23
24
# File 'lib/yourub/config.rb', line 21

def load!(file_path, environment)
  raw = YAML.load_file(file_path)[environment]
  @config = OpenStruct.new(prune_config_hash(raw))
end

.override_config_file(hash) ⇒ Object



26
27
28
29
# File 'lib/yourub/config.rb', line 26

def override_config_file(hash)
  opt = valid_options(hash)
  @config = OpenStruct.new opt
end