NAME

WebService::TDWTF::Article - Class representing information about a TDWTF article

SYNOPSIS

  use WebService::TDWTF;
  my $article = tdwtf_article 8301;

  say $article->Id;                 # 8301
  say $article->Slug;               # your-recommended-virus
  say $article->SummaryHtml;
  say $article->BodyHtml;
  say $article->Body;
  say $article->Title;              # Your Recommended Virus
  say $article->CoalescedCommentCount;
  say $article->DiscourseThreadUrl; # http://what.thedailywtf.com/t/your-recommended-virus/52541
  say $article->PublishedDate;      # 2015-11-12T06:30:00
  say $article->DisplayDate;        # 2015-11-12
  say $article->Url;                # http://thedailywtf.com/articles/your-recommended-virus
  say $article->CommentsUrl;        # http://thedailywtf.com/articles/comments/your-recommended-virus
  say $article->PreviousArticleId;  # 8299
  say $article->PreviousArticleUrl; # //thedailywtf.com/articles/confession-rect-contains-point
  say $article->NextArticleId;      # 8302
  say $article->NextArticleUrl;     # //thedailywtf.com/articles/who-stole-the-search-box

  say $article->AuthorName;             # Ellis Morning
  say $article->AuthorShortDescription; # Editor
  say $article->AuthorDescriptionHtml;
  say $article->AuthorSlug;             # ellis-morning
  say $article->AuthorImageUrl;         # http://img.thedailywtf.com/images/remy/ellis01.jpg

  say $article->SeriesSlug;  # feature-articles
  say $article->SeriesTitle; # Feature Articles
  say $article->SeriesDescription;

  say $article->PreviousArticle->Title # Confession: rect.Contains(point)
  say $article->NextArticle->Title     # Who Stole the Search Box?!

DESCRIPTION

A WebService::TDWTF::Article object represents an article on http://thedailywtf.com. Objects of this class are returned by the functions in WebService::TDWTF. Each such object is guaranteed to be a blessed hashref corresponding to the JSON returned by the TDWTF API (possibly with some extra keys), so the data inside can be obtained by simply dereferencing the object.

The ArticleModel class in the TDWTF source code might be helpful in finding the available attributes and understanding their meaning. It can be found here: https://github.com/tdwtf/WtfWebApp/blob/master/TheDailyWtf/Models/ArticleModel.cs

Several accessors and convenience functions are provided for accessing the most common attributes. See the SYNOPSIS for usage examples.

Id

The numerical ID of the article.

Slug

The string ID of the article.

Title

The title of the article

Url

URL of the article itself.

SummaryHtml

The summary (first 1-2 paragraphs) of the article.

BodyHtml

The body of the article. If the object comes from a tdwtf_list_* function, this method returns "".

Body

The body of the article. If the object comes from a tdwtf_list_* function, this method retreives the body from the server, saves it in the object and returns it.

FooterAdHtml

The advertisment in the footer of the article. If the object comes from a list_ function, this method returns "".

CoalescedCommentCount

The number of comments of the article.

CommentsUrl

URL to the featured comments list. See DiscourseThreadUrl for the URL to the full comment thread.

DiscourseThreadUrl

URL of the full comment thread on what.thedailywtf.com.

PublishedDate

Date and time when the article was published in ISO 8601 format, with no timezone.

DisplayDate

Date when the article was published in ISO 8601 format, with no timezone.

AuthorName

Name of the article's author.

AuthorShortDescription

A one-line description of the article's author.

AuthorDescriptionHtml

A longer description of the article's author.

AuthorSlug

The ID of the article's author, suitable for passing to the tdwtf_list_author function of WebService::TDWTF.

AuthorImageUrl

URL to an image of the article's author.

SeriesSlug

The ID of the article's series, suitable for passing to the tdwtf_list_series function of WebService::TDWTF

SeriesTitle

The name of the article's series.

SeriesDescription

A description of the article's series.

PreviousArticleId

The numerical ID of the previous article.

PreviousArticleUrl

URL of the previous article.

PreviousArticle

Retrieves the previous article using WebService::TDWTF and returns it as a WebService::TDWTF::Article object.

NextArticleId

The numerical ID of the next article.

NextArticleUrl

URL of the next article.

NextArticle

Retrieves the next article using WebService::TDWTF and returns it as a WebService::TDWTF::Article object.

AUTHOR

Marius Gavrilescu, <marius@ieval.ro>

COPYRIGHT AND LICENSE

Copyright (C) 2016 by Marius Gavrilescu

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.20.2 or, at your option, any later version of Perl 5 you may have available.