Class: Contentful::Configuration
- Inherits:
-
Object
- Object
- Contentful::Configuration
- Defined in:
- lib/configuration.rb
Instance Attribute Summary collapse
-
#assets_dir ⇒ Object
readonly
Returns the value of attribute assets_dir.
-
#collections_dir ⇒ Object
readonly
Returns the value of attribute collections_dir.
-
#data_dir ⇒ Object
readonly
Returns the value of attribute data_dir.
-
#entries_dir ⇒ Object
readonly
Returns the value of attribute entries_dir.
-
#settings ⇒ Object
readonly
Returns the value of attribute settings.
-
#space_id ⇒ Object
readonly
Returns the value of attribute space_id.
-
#wordpress_xml ⇒ Object
readonly
Returns the value of attribute wordpress_xml.
Instance Method Summary collapse
-
#initialize(settings) ⇒ Configuration
constructor
A new instance of Configuration.
- #validate_required_parameters ⇒ Object
Constructor Details
#initialize(settings) ⇒ Configuration
Returns a new instance of Configuration.
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/configuration.rb', line 12 def initialize(settings) @settings = settings @data_dir = settings['data_dir'] validate_required_parameters @wordpress_xml = settings['wordpress_xml_path'] @collections_dir = "#{data_dir}/collections" @entries_dir = "#{data_dir}/entries" @assets_dir = "#{data_dir}/assets" @space_id = settings['space_id'] end |
Instance Attribute Details
#assets_dir ⇒ Object (readonly)
Returns the value of attribute assets_dir.
4 5 6 |
# File 'lib/configuration.rb', line 4 def assets_dir @assets_dir end |
#collections_dir ⇒ Object (readonly)
Returns the value of attribute collections_dir.
4 5 6 |
# File 'lib/configuration.rb', line 4 def collections_dir @collections_dir end |
#data_dir ⇒ Object (readonly)
Returns the value of attribute data_dir.
4 5 6 |
# File 'lib/configuration.rb', line 4 def data_dir @data_dir end |
#entries_dir ⇒ Object (readonly)
Returns the value of attribute entries_dir.
4 5 6 |
# File 'lib/configuration.rb', line 4 def entries_dir @entries_dir end |
#settings ⇒ Object (readonly)
Returns the value of attribute settings.
4 5 6 |
# File 'lib/configuration.rb', line 4 def settings @settings end |
#space_id ⇒ Object (readonly)
Returns the value of attribute space_id.
4 5 6 |
# File 'lib/configuration.rb', line 4 def space_id @space_id end |
#wordpress_xml ⇒ Object (readonly)
Returns the value of attribute wordpress_xml.
4 5 6 |
# File 'lib/configuration.rb', line 4 def wordpress_xml @wordpress_xml end |
Instance Method Details
#validate_required_parameters ⇒ Object
23 24 25 26 |
# File 'lib/configuration.rb', line 23 def validate_required_parameters fail ArgumentError, 'Set PATH to data_dir. Folder where all data will be stored. View README' if settings['data_dir'].nil? fail ArgumentError, 'Set PATH to Wordpress XML file. View README' if settings['wordpress_xml_path'].nil? end |