implicit def bundleMapper: OctopusBundle => StoryBundle =()

in src/main/scala/com/gu/octopusthrift/models/OctopusBundle.scala [54:71]


  implicit def bundleMapper: OctopusBundle => StoryBundle = (octopusBundle: OctopusBundle) => {

    val bodyText = ArticleFinder.findBodyText(octopusBundle)
    val article = bodyText.get.as[Article]
    val headline = None

    StoryBundle(
      octopusBundle.id,
      // the PayloadValidator has confirmed before this point there there _is_ a Composer ID, so it should not be possible for a None value to be returned here
      octopusBundle.composerId.getOrElse(""),
      octopusBundle.pubcode,
      octopusBundle.sectioncode,
      article,
      headline,
      bodyText.flatMap(_.pageNumber),
      octopusBundle.pubDateEpochDays,
      bodyText.flatMap(_.attached_to.map(_.toString)))
  }