GunsNPrices.ProductInfo (GunsNPrices v0.1.0)

Copy Markdown View Source

Result of GunsNPrices.parse_title/2. Fields that don't apply or weren't found are nil (or empty).

  • title - the title as given
  • kind - :firearm or :ammo
  • brand - brand of the identified model, else the :brand option, else ""
  • model - a GunsNPrices.ModelMatch, firearms only
  • caliber - first caliber in the title (GunsNPrices.Caliber)
  • calibers - every caliber in the title (".357 Mag / .38 Special"), in order
  • capacity - magazine capacity, firearms only (for "15+1" it is 15)
  • barrel_length - barrel length in inches (float), firearms only
  • rounds - rounds per box, ammo only
  • cost_per_round - price per round, ammo only; needs the :price option

Encodes to JSON with the same field names as the Python and JavaScript packages.

Summary

Types

t()

@type t() :: %GunsNPrices.ProductInfo{
  barrel_length: float() | nil,
  brand: String.t(),
  caliber: GunsNPrices.Caliber.t() | nil,
  calibers: [GunsNPrices.Caliber.t()],
  capacity: pos_integer() | nil,
  cost_per_round: float() | nil,
  kind: :firearm | :ammo,
  model: GunsNPrices.ModelMatch.t() | nil,
  rounds: pos_integer() | nil,
  title: String.t()
}