module Eco module API class Session class Config class People < Hash attr_reader :config def initialize(root:) super(nil) @root = root @config = @root end def cache=(file) self["cache"] = file end def cache self["cache"] end # api queried logs def requests_folder=(folder) self["requests_folder"] = folder end def requests_folder self["requests_folder"] end # people to exclude from update feeds def discarded_file=(file) self["discarded_file"] = file end def discarded_file self["discarded_file"] end # internal-external fields map def fields_mapper=(file) self["fields_mapper"] = file end def fields_mapper self["fields_mapper"] end # person model def default_schema=(name) self["default_schema"] = name end def default_schema self["default_schema"] end def presets_custom=(file) self["presets_custom"] = file end def presets_custom self["presets_custom"] end def presets_map=(file) self["presets_map"] = file end def presets_map self["presets_map"] end # CUSTOM PERSON PARSERS def add_parser(format: :csv) new_parsers = Eco::API::Common::People::PersonParser.new yield(new_parsers, config) parsers[format] ||= Eco::API::Common::People::PersonParser.new parsers[format] = parsers[format] ? parsers[format].merge(new_parsers) : new_parsers end def parsers self["parsers"] ||= {} end def parser(format: :csv) parsers[format] end end end end end end