Class: Synotion::Configuration
- Inherits:
-
Object
- Object
- Synotion::Configuration
- Defined in:
- lib/synotion/configuration.rb
Instance Attribute Summary collapse
-
#database_id ⇒ Object
Returns the value of attribute database_id.
-
#notion_api_key ⇒ Object
Returns the value of attribute notion_api_key.
-
#page_id ⇒ Object
Returns the value of attribute page_id.
-
#sync_metadata ⇒ Object
Returns the value of attribute sync_metadata.
-
#title_from ⇒ Object
Returns the value of attribute title_from.
-
#unique_property ⇒ Object
Returns the value of attribute unique_property.
-
#update_mode ⇒ Object
Returns the value of attribute update_mode.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #validate! ⇒ Object
Constructor Details
#initialize ⇒ Configuration
11 12 13 14 15 16 17 18 19 |
# File 'lib/synotion/configuration.rb', line 11 def initialize @notion_api_key = ENV.fetch('NOTION_API_KEY', nil) @database_id = nil @page_id = nil @unique_property = 'source_file' @update_mode = UpdateMode::UPSERT @title_from = :first_heading @sync_metadata = true end |
Instance Attribute Details
#database_id ⇒ Object
Returns the value of attribute database_id.
3 4 5 |
# File 'lib/synotion/configuration.rb', line 3 def database_id @database_id end |
#notion_api_key ⇒ Object
Returns the value of attribute notion_api_key.
3 4 5 |
# File 'lib/synotion/configuration.rb', line 3 def notion_api_key @notion_api_key end |
#page_id ⇒ Object
Returns the value of attribute page_id.
3 4 5 |
# File 'lib/synotion/configuration.rb', line 3 def page_id @page_id end |
#sync_metadata ⇒ Object
Returns the value of attribute sync_metadata.
3 4 5 |
# File 'lib/synotion/configuration.rb', line 3 def @sync_metadata end |
#title_from ⇒ Object
Returns the value of attribute title_from.
3 4 5 |
# File 'lib/synotion/configuration.rb', line 3 def title_from @title_from end |
#unique_property ⇒ Object
Returns the value of attribute unique_property.
3 4 5 |
# File 'lib/synotion/configuration.rb', line 3 def unique_property @unique_property end |
#update_mode ⇒ Object
Returns the value of attribute update_mode.
3 4 5 |
# File 'lib/synotion/configuration.rb', line 3 def update_mode @update_mode end |
Instance Method Details
#validate! ⇒ Object
21 22 23 24 25 |
# File 'lib/synotion/configuration.rb', line 21 def validate! raise ConfigurationError, 'notion_api_key is required' if notion_api_key.nil? || notion_api_key.empty? raise ConfigurationError, 'Either database_id or page_id must be specified' if database_id.nil? && page_id.nil? raise ConfigurationError, "Invalid update_mode: #{update_mode}" unless UpdateMode.valid?(update_mode) end |