Exisbn.Tasks.Isbn.UpdateRanges (Exisbn v2.2.6)

Copy Markdown View Source

Uses for library needs to regenerate datasets.

Summary

Functions

Renders the Exisbn.Regions module source from a dataset map.

Parses an ISBN RangeMessage XML binary and returns a list of group maps.

Functions

generate_module(dataset, module_name \\ "Exisbn.Regions")

@spec generate_module(map(), String.t()) :: String.t()

Renders the Exisbn.Regions module source from a dataset map.

module_name defaults to "Exisbn.Regions" and can be overridden in tests to avoid redefining the live module.

parse_range_message(xml)

@spec parse_range_message(binary()) :: [
  %{prefix: String.t(), agency: String.t(), ranges: [[String.t()]]}
]

Parses an ISBN RangeMessage XML binary and returns a list of group maps.

Each map has keys :prefix, :agency, and :ranges, where :ranges is a list of [lo, hi] string pairs with leading zeros preserved.