class DatoDump::Configuration

Attributes

api_host[R]
destination_path[R]
domain[R]
token[R]

Public Class Methods

new(path) click to toggle source
# 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