lib/eco/api/session.rb in eco-helpers-1.0.8 vs lib/eco/api/session.rb in eco-helpers-1.0.9
- old
+ new
@@ -111,9 +111,20 @@
logger: logger
})
self
end
+ # Allows to use the defined parsers
+ # @note the use of these method requires to know which is the expected format of `source`
+ # @param attr [String] type (`Symbol`) or attribute (`String`) to target a specific parser.
+ # @param source [Any] source value to be parsed.
+ def parse_attribute(attr, source)
+ unless parsers = @entry_factory.person_parser
+ raise "There are no parsers defined"
+ end
+ parsers.parse(attr, source)
+ end
+
# Builds the presets using the usergroup ids of the input.
# @note for each flag/ability it will take the highest among those mapped for the present usergroups.
# @param [Ecoportal::API::Internal::Person, Array<String>] the array should be of usegroup names or ids.
# @return [Hash] with custom presets.
def new_preset(input)