Class: DatoDump::Configuration
- Inherits:
-
Object
- Object
- DatoDump::Configuration
- Defined in:
- lib/dato_dump/configuration.rb
Instance Attribute Summary collapse
-
#api_host ⇒ Object
readonly
Returns the value of attribute api_host.
-
#destination_path ⇒ Object
readonly
Returns the value of attribute destination_path.
-
#domain ⇒ Object
readonly
Returns the value of attribute domain.
-
#token ⇒ Object
readonly
Returns the value of attribute token.
Instance Method Summary collapse
-
#initialize(path) ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize(path) ⇒ Configuration
Returns a new instance of Configuration.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/dato_dump/configuration.rb', line 7 def initialize(path) File.exist?(path) or raise RuntimeError, "config file #{path} is missing" data = YAML.load_file(path) data.is_a? Hash or raise RuntimeError, "config file #{path} must be a hash" @domain = data.fetch('domain') @token = data.fetch('token') @api_host = data.fetch('api_host', 'http://api.datocms.com') @destination_path = data.fetch('destination_path', '_data') end |
Instance Attribute Details
#api_host ⇒ Object (readonly)
Returns the value of attribute api_host.
5 6 7 |
# File 'lib/dato_dump/configuration.rb', line 5 def api_host @api_host end |
#destination_path ⇒ Object (readonly)
Returns the value of attribute destination_path.
5 6 7 |
# File 'lib/dato_dump/configuration.rb', line 5 def destination_path @destination_path end |
#domain ⇒ Object (readonly)
Returns the value of attribute domain.
5 6 7 |
# File 'lib/dato_dump/configuration.rb', line 5 def domain @domain end |
#token ⇒ Object (readonly)
Returns the value of attribute token.
5 6 7 |
# File 'lib/dato_dump/configuration.rb', line 5 def token @token end |