Class: WCC::Contentful::App::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/wcc/contentful/app/configuration.rb

Overview

This object contains all the configuration options for the ‘wcc-contentful` gem.

Defined Under Namespace

Classes: FrozenConfiguration

Constant Summary collapse

ATTRIBUTES =

TODO: things to configure in the app?

%i[
  preview_password
].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(wcc_contentful_config) ⇒ Configuration

Returns a new instance of Configuration.



20
21
22
23
# File 'lib/wcc/contentful/app/configuration.rb', line 20

def initialize(wcc_contentful_config)
  @wcc_contentful_config = wcc_contentful_config
  @preview_password = ENV.fetch('CONTENTFUL_PREVIEW_PASSWORD', nil)
end

Instance Attribute Details

#preview_passwordObject

Sets the password that will be checked when the query string contains ‘preview=`, if it matches, then the Contentful entries are fetched via the preview API.



12
13
14
# File 'lib/wcc/contentful/app/configuration.rb', line 12

def preview_password
  @preview_password
end

#wcc_contentful_configObject (readonly)

Returns the value of attribute wcc_contentful_config.



14
15
16
# File 'lib/wcc/contentful/app/configuration.rb', line 14

def wcc_contentful_config
  @wcc_contentful_config
end

Instance Method Details

#frozen?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/wcc/contentful/app/configuration.rb', line 31

def frozen?
  false
end

#validate!Object

Validates the configuration, raising ArgumentError if anything is wrong. This is called by WCC::Contentful::App.init!



27
28
29
# File 'lib/wcc/contentful/app/configuration.rb', line 27

def validate!
  wcc_contentful_config.validate!
end