Class: Blocks::Sdk::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/blocks/sdk/configuration.rb

Overview

Configuration for Blocks SDK

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/blocks/sdk/configuration.rb', line 11

def initialize
  @uilm_base_url        = ENV.fetch("UILM_BASE_URL", nil)
  @uilm_project_key     = ENV.fetch("UILM_PROJECT_KEY", nil)
  @webhook_secret       = ENV.fetch("BLOCKS_WEBHOOK_SECRET", nil)
  @webhook_path_prefix  = "/blocks/webhooks"
  @cache_enabled        = true
  @logger               = nil
  @install_i18n_backend = false
  @default_module_name  = ENV.fetch("BLOCKS_DEFAULT_MODULE_NAME", nil)
  @translation_modules  = nil
  @translation_languages = nil
end

Instance Attribute Details

#cache_enabledObject

Returns the value of attribute cache_enabled.



7
8
9
# File 'lib/blocks/sdk/configuration.rb', line 7

def cache_enabled
  @cache_enabled
end

#default_module_nameObject

Returns the value of attribute default_module_name.



8
9
10
# File 'lib/blocks/sdk/configuration.rb', line 8

def default_module_name
  @default_module_name
end

#install_i18n_backendObject

Returns the value of attribute install_i18n_backend.



8
9
10
# File 'lib/blocks/sdk/configuration.rb', line 8

def install_i18n_backend
  @install_i18n_backend
end

#loggerObject

Returns the value of attribute logger.



7
8
9
# File 'lib/blocks/sdk/configuration.rb', line 7

def logger
  @logger
end

#translation_languagesObject

Returns the value of attribute translation_languages.



9
10
11
# File 'lib/blocks/sdk/configuration.rb', line 9

def translation_languages
  @translation_languages
end

#translation_modulesObject

Returns the value of attribute translation_modules.



9
10
11
# File 'lib/blocks/sdk/configuration.rb', line 9

def translation_modules
  @translation_modules
end

#uilm_base_urlObject

Returns the value of attribute uilm_base_url.



5
6
7
# File 'lib/blocks/sdk/configuration.rb', line 5

def uilm_base_url
  @uilm_base_url
end

#uilm_project_keyObject

Returns the value of attribute uilm_project_key.



5
6
7
# File 'lib/blocks/sdk/configuration.rb', line 5

def uilm_project_key
  @uilm_project_key
end

#webhook_path_prefixObject

Returns the value of attribute webhook_path_prefix.



6
7
8
# File 'lib/blocks/sdk/configuration.rb', line 6

def webhook_path_prefix
  @webhook_path_prefix
end

#webhook_secretObject

Returns the value of attribute webhook_secret.



6
7
8
# File 'lib/blocks/sdk/configuration.rb', line 6

def webhook_secret
  @webhook_secret
end

Instance Method Details

#to_hObject



24
25
26
27
28
29
30
31
32
33
34
# File 'lib/blocks/sdk/configuration.rb', line 24

def to_h
  {
    uilm_base_url: @uilm_base_url,
    uilm_project_key: @uilm_project_key,
    webhook_secret: @webhook_secret,
    webhook_path_prefix: @webhook_path_prefix,
    cache_enabled: @cache_enabled,
    install_i18n_backend: @install_i18n_backend,
    default_module_name: @default_module_name
  }
end