Sha256: 17daaf5911405f4cbe9a46eda901c8a1f315c06a464759cb1d32008ac53f589a

Contents?: true

Size: 1.09 KB

Versions: 2

Compression:

Stored size: 1.09 KB

Contents

require 'active_support/core_ext/hash'
module Contentful
  class Configuration
    attr_reader :space_id,
                :config,
                :data_dir,
                :collections_dir,
                :entries_dir,
                :assets_dir,
                :log_files_dir,
                :threads_dir,
                :imported_entries,
                :published_entries,
                :published_assets,
                :space_id

    def initialize(settings)
      @config = settings
      validate_required_parameters
      @data_dir = settings['data_dir']
      @collections_dir = "#{data_dir}/collections"
      @entries_dir = "#{data_dir}/entries"
      @assets_dir = "#{data_dir}/assets"
      @log_files_dir = "#{data_dir}/logs"
      @threads_dir = "#{data_dir}/threads"
      @imported_entries = []
      @published_entries = []
      @published_assets = []
      @space_id = settings['space_id']
    end

    def validate_required_parameters
      fail ArgumentError, 'Set PATH to data_dir. Folder where all data will be stored. View README' if config['data_dir'].nil?
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
contentful-importer-0.0.2 lib/configuration.rb
contentful-importer-0.0.1 lib/configuration.rb