<commit_before># encoding: utf-8

class Api::StoryRepresenter < Api::BaseRepresenter

  property :id
  property :title
  property :short_description
  property :episode_number
  property :episode_identifier
  property :published_at
  property :produced_on

  property :duration, writeable: false
  property :points, writeable: false
  property :app_version, writeable: false

  property :description
  property :related_website
  property :broadcast_history
  property :timing_and_cues
  property :content_advisory
  property :tags

  property :license, class: License, decorator: Api::LicenseRepresenter

  link rel: :account, writeable: true do
    {
      href: api_account_path(represented.account),
      title: represented.account.name,
      profile: prx_model_uri(represented.account)
    } if represented.account
  end
  embed :account, class: Account, decorator: Api::Min::AccountRepresenter

  link rel: :series, writeable: true do
    {
      href: api_series_path(represented.series),
      title: represented.series.title
    } if represented.series_id
  end
  embed :series, class: Series, decorator: Api::Min::SeriesRepresenter

  link :image do
    {
      href: polymorphic_path([:api, represented.default_image]),
      profile: prx_model_uri(represented.default_image)
    } if represented.default_image
  end
  embed :default_image, as: :image, decorator: Api::ImageRepresenter

  link :audio do
    {
      href: api_story_audio_files_path(represented.id),
      count: represented.default_audio.count
    } if represented.id<commit_msg>add publish and unpublish links<commit_after># encoding: utf-8

class Api::StoryRepresenter < Api::BaseRepresenter

  property :id
  property :title
  property :short_description
  property :episode_number
  property :episode_identifier
  property :published_at
  property :produced_on

  property :duration, writeable: false
  property :points, writeable: false
  property :app_version, writeable: false

  property :description
  property :related_website
  property :broadcast_history
  property :timing_and_cues
  property :content_advisory
  property :tags

  property :license, class: License, decorator: Api::LicenseRepresenter

  link rel: :publish, writeable: false do
    {
      href: publish_api_story_path(represented)
    } if !represented.published?
  end

  link rel: :unpublish, writeable: false do
    {
      href: unpublish_api_story_path(represented)
    } if represented.published?
  end

  link rel: :account, writeable: true do
    {
      href: api_account_path(represented.account),
      title: represented.account.name,
      profile: prx_model_uri(represented.account)
    } if represented.account
  end
  embed :account, class: Account, decorator: Api::Min::AccountRepresenter

  link rel: :series, writeable: true do
    {
      href: api_series_path(represented.series),
      title: represented.series.title
    } if represented.series_id
  end
  embed :series, class: Series, decorator: Api::Min::SeriesRepresenter

  link :image do
    {
      href: polymorphic_path([:api, represented.default_image]),
      profile: prx_model_uri(represented.default_image)
    } if represented.default_image
  end
  embed :default_image, as: :image, decorator: Api::ImageRepresenter

  link :audio do
    {
      href: api_story_audio_files_path(represented.id),
      count: represented.default_audio.count
    } if represented.id
{'fraction_non_alphanumeric': 0.08296687188507769, 'fraction_numerical': 0.0005863383172090296, 'mean_word_length': 4.2411674347158215, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1446477', 'n_tokens_mistral': 1057, 'n_tokens_neox': 994, 'n_words': 257}