| 1 | package Net::Plurk::Plurk; | ||
| 2 | 0 | ▶ | use Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=2.6
| |||
| 3 | use Moose::Util::TypeConstraints; | ||
| 4 | use DateTime::Format::Strptime; | ||
| 5 | |||
| 6 | =head1 NAME | ||
| 7 | |||
| 8 | Net::Plurk::Plurk | ||
| 9 | |||
| 10 | =head1 SYNOPSIS | ||
| 11 | |||
| 12 | Single Plurk data | ||
| 13 | |||
| 14 | plurk_id: The unique Plurk id, used for identification of the plurk. | ||
| 15 | qualifier: The English qualifier, can be "says", show all: | ||
| 16 | qw/ loves likes shares gives hates wants has will asks wishes was / | ||
| 17 | qw/ feels thinks says is : freestyle hopes needs wonders / | ||
| 18 | qualifier_translated: Only set if the language is not English, | ||
| 19 | will be the translated qualifier. Can be "siger" if plurk.lang is "da" (Danish). | ||
| 20 | is_unread: Specifies if the plurk is read, unread or muted. Show example data | ||
| 21 | is_unread=0 //Read | ||
| 22 | is_unread=1 //Unread | ||
| 23 | is_unread=2 //Muted | ||
| 24 | plurk_type: | ||
| 25 | plurk_type=0 //Public plurk | ||
| 26 | plurk_type=1 //Private plurk | ||
| 27 | plurk_type=2 //Public plurk (responded by the logged in user) | ||
| 28 | plurk_type=3 //Private plurk (responded by the logged in user) | ||
| 29 | user_id: Which timeline does this Plurk belong to. | ||
| 30 | owner_id: Who is the owner/poster of this plurk. | ||
| 31 | posted: The date this plurk was posted. | ||
| 32 | no_comments: | ||
| 33 | If set to 1, then responses are disabled for this plurk. | ||
| 34 | If set to 2, then only friends can respond to this plurk. | ||
| 35 | content: The formatted content, emoticons and images will be turned into IMG tags etc. | ||
| 36 | content_raw: The raw content as user entered it | ||
| 37 | response_count: How many responses does the plurk have. | ||
| 38 | responses_seen: How many of the responses have the user read. | ||
| 39 | limited_to: If the Plurk is public limited_to is null. | ||
| 40 | If the Plurk is posted to a user's friends then limited_to is [0]. | ||
| 41 | If limited_to is [1,2,6,3] then it's posted only to these user ids. V | ||
| 42 | =cut | ||
| 43 | |||
| 44 | my $Strp = new DateTime::Format::Strptime( | ||
| 45 | # Fri, 05 Jun 2009 23:07:13 GMT | ||
| 46 | # %a, %d %b %Y %T %Z | ||
| 47 | pattern => '%a, %d %b %Y %T %Z', | ||
| 48 | ); | ||
| 49 | |||
| 50 | subtype 'Net::Plurk::Value::DateTime' => as class_type('DateTime'); | ||
| 51 | coerce 'Net::Plurk::Value::DateTime' | ||
| 52 | => from 'DateTime' | ||
| 53 | => via { DateTime->new( $_ ) } | ||
| 54 | => from 'Str' | ||
| 55 | => via { $Strp->parse_datetime($_) }; | ||
| 56 | |||
| 57 | has 'plurk_id' => (is => 'ro', isa => 'Int'); | ||
| 58 | has 'qualifier' => (is => 'ro', isa => enum([qw | ||
| 59 | [ loves likes shares gives hates wants has will asks wishes was feels thinks says is : freestyle hopes needs wonders ] | ||
| 60 | ])); | ||
| 61 | has 'qualifier' => (is => 'ro', isa => 'Str'); | ||
| 62 | has 'lang' => (is => 'ro', isa => 'Str'); | ||
| 63 | has 'is_unread' => (is => 'ro', isa => 'Int'); | ||
| 64 | has 'plurk_type' => (is => 'ro', isa => 'Int'); | ||
| 65 | has 'user_id' => (is => 'ro', isa => 'Str'); | ||
| 66 | has 'owner_id' => (is => 'ro', isa => 'Str'); | ||
| 67 | has 'posted' => (is => 'rw', isa => 'Net::Plurk::Value::DateTime', coerce => 1); | ||
| 68 | has 'no_comments' => (is => 'ro', isa => 'Int'); | ||
| 69 | has 'content' => (is => 'ro', isa => 'Str'); | ||
| 70 | has 'content_raw' => (is => 'ro', isa => 'Str'); | ||
| 71 | has 'response_count' => (is => 'ro', isa => 'Int'); | ||
| 72 | has 'responses_seen' => (is => 'ro', isa => 'Int'); | ||
| 73 | has 'limited_to' => (is => 'ro', isa => 'ArrayRef[Int] | Undef'); | ||
| 74 | |||
| 75 | no Moose::Util::TypeConstraints; | ||
| 76 | no Moose; | ||
| 77 | __PACKAGE__->meta->make_immutable; | ||
| 78 | 1; | ||