Class: Boechat::Core::Config::Reader

Inherits:
Object
  • Object
show all
Defined in:
lib/boechat/core/config/reader.rb

Overview

Class responsible for read the boechat.yml file, that describes all endpoints to call

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeReader

Returns a new instance of Reader.



14
15
16
17
# File 'lib/boechat/core/config/reader.rb', line 14

def initialize
  app_root = Pathname.new(File.expand_path('../../../../', __dir__))
  @config_path = File.join(app_root, 'config', 'boechat.yml')
end

Instance Attribute Details

#config_pathObject (readonly)

Returns the value of attribute config_path.



12
13
14
# File 'lib/boechat/core/config/reader.rb', line 12

def config_path
  @config_path
end

Instance Method Details

#callObject



19
20
21
22
23
# File 'lib/boechat/core/config/reader.rb', line 19

def call
  result = validate_config_schema
  output = result.success? ? result.output : {}
  Wrapper.new(output, result.errors)
end