Module: Nucleus::VendorParser
- Extended by:
- Logging
- Defined in:
- lib/nucleus/core/import/vendor_parser.rb
Class Method Summary collapse
-
.parse(adapter_config) ⇒ Nucleus::Vendor
Get a parsed vendor instance from the adapter_config file.
Methods included from Logging
configure_logger_for, log, logger_for
Class Method Details
.parse(adapter_config) ⇒ Nucleus::Vendor
Get a parsed vendor instance from the adapter_config file
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/nucleus/core/import/vendor_parser.rb', line 9 def self.parse(adapter_config) schema_file = "#{Nucleus.root}/schemas/api.adapter.schema.yml" schema = Kwalify::Yaml.load_file(schema_file, untabify: true, preceding_alias: true) validator = Kwalify::Validator.new(schema) config_parser = Kwalify::Yaml::Parser.new(validator, data_binding: true, preceding_alias: true) vendor = config_parser.parse_file(adapter_config) errors = config_parser.errors # show errors if errors && !errors.empty? errors.each do |e| log.error "[#{e.path}] #{e.}" end end # vendor is not valid and shall not be returned return nil if errors && !errors.empty? vendor end |