lib/eco/api/session/config/people.rb in eco-helpers-0.6.17 vs lib/eco/api/session/config/people.rb in eco-helpers-0.7.1

- old
+ new

@@ -17,10 +17,19 @@ def cache self["cache"] end + # specifies if people search should be strict or not + def strict_search=(value) + self["strict_search"] = !!value + end + + def strict_search? + self["strict_search"] + end + # api queried logs def requests_folder=(folder) self["requests_folder"] = folder end @@ -69,22 +78,26 @@ def presets_map self["presets_map"] end - # CUSTOM PERSON PARSERS + # Defines an `ParserSerializer` for a `PersonParser` of certain `format` + # @param format [Symbol] the target format this parser/serializer is made for. 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 + parsers[format].tap do |prs| + yield(prs, config) + end end + # @return [Hash] with defined pairs format `key` and Person parsers. def parsers self["parsers"] ||= {} end + # The person parser/serializer for a given format (default `csv`). + # @param format [Symbol] the format this parser/serializer recognizes. + # @return [Eco::API::Common::People::PersonParser] parser/serializer for the defined `format`. def parser(format: :csv) parsers[format] end end