File Coverage

blib/lib/WebService/TypePad/Object/Asset.pm
Criterion Covered Total %
statement 12 87 13.7
branch 0 30 0.0
condition n/a
subroutine 4 19 21.0
pod 15 15 100.0
total 31 151 20.5


line stmt bran cond sub pod time code
1             package WebService::TypePad::Object::Asset;
2 1     1   1558 use strict;
  1         2  
  1         35  
3 1     1   7 use warnings;
  1         2  
  1         25  
4 1     1   5 use WebService::TypePad::Util::Coerce;
  1         3  
  1         36  
5 1     1   5 use base qw(WebService::TypePad::Object::Base);
  1         2  
  1         1254  
6              
7             sub id {
8 0     0 1   my $self = shift;
9 0 0         if (@_) {
10 0           $self->{data}{id} = WebService::TypePad::Util::Coerce::coerce_string_in($_[0]);
11 0           return $_[0];
12             }
13             else {
14 0           return $self->{data}{id};
15             }
16             }
17              
18             sub url_id {
19 0     0 1   my $self = shift;
20 0 0         if (@_) {
21 0           $self->{data}{urlId} = WebService::TypePad::Util::Coerce::coerce_string_in($_[0]);
22 0           return $_[0];
23             }
24             else {
25 0           return $self->{data}{urlId};
26             }
27             }
28              
29             sub permalink_url {
30 0     0 1   my $self = shift;
31 0 0         if (@_) {
32 0           $self->{data}{permalinkUrl} = WebService::TypePad::Util::Coerce::coerce_string_in($_[0]);
33 0           return $_[0];
34             }
35             else {
36 0           return $self->{data}{permalinkUrl};
37             }
38             }
39              
40             sub author {
41 0     0 1   my $self = shift;
42 0 0         if (@_) {
43 0           $self->{data}{author} = WebService::TypePad::Util::Coerce::coerce_User_in($_[0]);
44 0           return $_[0];
45             }
46             else {
47 0           return WebService::TypePad::Util::Coerce::coerce_User_out($self->{data}{author});
48             }
49             }
50              
51             sub published {
52 0     0 1   my $self = shift;
53 0 0         if (@_) {
54 0           $self->{data}{published} = WebService::TypePad::Util::Coerce::coerce_string_in($_[0]);
55 0           return $_[0];
56             }
57             else {
58 0           return $self->{data}{published};
59             }
60             }
61              
62             sub content {
63 0     0 1   my $self = shift;
64 0 0         if (@_) {
65 0           $self->{data}{content} = WebService::TypePad::Util::Coerce::coerce_string_in($_[0]);
66 0           return $_[0];
67             }
68             else {
69 0           return $self->{data}{content};
70             }
71             }
72              
73             sub text_format {
74 0     0 1   my $self = shift;
75 0 0         if (@_) {
76 0           $self->{data}{textFormat} = WebService::TypePad::Util::Coerce::coerce_string_in($_[0]);
77 0           return $_[0];
78             }
79             else {
80 0           return $self->{data}{textFormat};
81             }
82             }
83              
84             sub groups {
85 0     0 1   my $self = shift;
86 0 0         if (@_) {
87 0           $self->{data}{groups} = WebService::TypePad::Util::Coerce::coerce_array_in($_[0], \&WebService::TypePad::Util::Coerce::coerce_string_in);
88 0           return $_[0];
89             }
90             else {
91 0           return WebService::TypePad::Util::Coerce::coerce_array_out($self->{data}{groups});
92             }
93             }
94              
95             sub source {
96 0     0 1   my $self = shift;
97 0 0         if (@_) {
98 0           $self->{data}{source} = WebService::TypePad::Util::Coerce::coerce_AssetSource_in($_[0]);
99 0           return $_[0];
100             }
101             else {
102 0           return WebService::TypePad::Util::Coerce::coerce_AssetSource_out($self->{data}{source});
103             }
104             }
105              
106             sub links {
107 0     0 1   my $self = shift;
108 0 0         if (@_) {
109 0           $self->{data}{links} = WebService::TypePad::Util::Coerce::coerce_array_in($_[0], \&WebService::TypePad::Util::Coerce::coerce_LegacyHyperlink_in);
110 0           return $_[0];
111             }
112             else {
113 0           return WebService::TypePad::Util::Coerce::coerce_array_out($self->{data}{links}, \&WebService::TypePad::Util::Coerce::coerce_LegacyHyperlink_out);
114             }
115             }
116              
117             sub object_types {
118 0     0 1   my $self = shift;
119 0 0         if (@_) {
120 0           $self->{data}{objectTypes} = WebService::TypePad::Util::Coerce::coerce_set_in($_[0], \&WebService::TypePad::Util::Coerce::coerce_string_in);
121 0           return $_[0];
122             }
123             else {
124 0           return WebService::TypePad::Util::Coerce::coerce_set_out($self->{data}{objectTypes});
125             }
126             }
127              
128             sub is_favorite_for_current_user {
129 0     0 1   my $self = shift;
130 0 0         if (@_) {
131 0           $self->{data}{isFavoriteForCurrentUser} = WebService::TypePad::Util::Coerce::coerce_boolean_in($_[0]);
132 0           return $_[0];
133             }
134             else {
135 0           return WebService::TypePad::Util::Coerce::coerce_boolean_out($self->{data}{isFavoriteForCurrentUser});
136             }
137             }
138              
139             sub favorite_count {
140 0     0 1   my $self = shift;
141 0 0         if (@_) {
142 0           $self->{data}{favoriteCount} = WebService::TypePad::Util::Coerce::coerce_integer_in($_[0]);
143 0           return $_[0];
144             }
145             else {
146 0           return $self->{data}{favoriteCount};
147             }
148             }
149              
150             sub comment_count {
151 0     0 1   my $self = shift;
152 0 0         if (@_) {
153 0           $self->{data}{commentCount} = WebService::TypePad::Util::Coerce::coerce_integer_in($_[0]);
154 0           return $_[0];
155             }
156             else {
157 0           return $self->{data}{commentCount};
158             }
159             }
160              
161             sub allowed_methods {
162 0     0 1   my $self = shift;
163 0 0         if (@_) {
164 0           $self->{data}{allowedMethods} = WebService::TypePad::Util::Coerce::coerce_set_in($_[0], \&WebService::TypePad::Util::Coerce::coerce_string_in);
165 0           return $_[0];
166             }
167             else {
168 0           return WebService::TypePad::Util::Coerce::coerce_set_out($self->{data}{allowedMethods});
169             }
170             }
171              
172             1;
173              
174             =head1 NAME
175              
176             WebService::TypePad::Object::Asset - Perl representation of TypePad's Asset object type
177              
178             =head1 SYNOPSIS
179              
180             use WebService::TypePad::Object::Asset;
181             my $asset = WebService::TypePad::Object::Asset->new();
182              
183             =head1 DESCRIPTION
184              
185             This is a Perl representation of TypePad's Asset object type.
186             For more information about this type and its parameters, see L.
187              
188             =head1 PROPERTIES
189              
190             Each of these properties has an accessor method which will retrieve the property's value when called with no arguments or set the property's value when called with one argument.
191              
192             =head2 $asset->allowed_methods
193              
194             Set of strings containing the HTTP methods that the currently-authenticated client is allowed to apply to this asset.
195              
196             Returns a set of C values.
197              
198             =head2 $asset->author
199              
200             The user that created the selected asset.
201              
202             Returns a single L object.
203              
204             =head2 $asset->comment_count
205              
206             The number of comments that have been posted in the comment tree beneath this asset.
207              
208             Returns a single C value.
209              
210             =head2 $asset->content
211              
212             The raw asset content. The C property defines what format this data is in.
213              
214             Returns a single C value.
215              
216             =head2 $asset->favorite_count
217              
218             The number of distinct users who have added this asset as a favorite.
219              
220             Returns a single C value.
221              
222             =head2 $asset->groups
223              
224             An array of strings containing the id URIs of the groups that this asset is mapped into, if any. At present an asset can only be added to one group, but this may change in future.
225              
226             Returns an array of C values.
227              
228             =head2 $asset->id
229              
230             A URI that serves as a globally-unique id for the user. This can be used to recognise where the same user is returned in response to different requests, and as a mapping key for an application's local data store.
231              
232             Returns a single C value.
233              
234             =head2 $asset->is_favorite_for_current_user
235              
236             C if this asset is a favorite for the current user, or C otherwise. This property is not set for responses to anonymous requests.
237              
238             Returns a single C value.
239              
240             =head2 $asset->links
241              
242             B The hyperlinks for the user object. The "alternate" hyperlink of type "text/html" points at the user's TypePad profile page. This property has been deprecated in favor of the separate link properties defined by the subclasses of L.
243              
244             Returns an array of L objects.
245              
246             =head2 $asset->object_types
247              
248             An array of object type identifier URIs. At the present time, only one object type is returned per asset, but this may be extended in future. Clients should scan this list and ignore any types that are not recognised. This list also includes appropriate type URIs as defined by the ActivityStrea.ms schema specification.
249              
250             Returns a set of C values.
251              
252             =head2 $asset->permalink_url
253              
254             The URL which is considered to be this asset's permalink. This might be C if the asset does not have a permalink of its own (for example, if it's embedded in another asset), or if TypePad does not know its permalink.
255              
256             Returns a single C value.
257              
258             =head2 $asset->published
259              
260             The time that the asset was created, as an RFC3339 timestamp.
261              
262             Returns a single C value.
263              
264             =head2 $asset->source
265              
266             An object describing the site from which this asset was retrieved, for assets obtained from external feeds.
267              
268             Returns a single L object.
269              
270             =head2 $asset->text_format
271              
272             A keyword which indicates what formatting mode is used for the content of this asset. This can currently be "html", for assets whose content is HTML, or "text", for assets whose content is plain text. Other formatting modes may be added in future.
273              
274             Returns a single C value.
275              
276             =head2 $asset->url_id
277              
278             A string containing the canonical identifier that can be used as the "id" for this object in URLs. However, this should not be used as a database key to avoid collisions when an application is switched to a different backend server; use the "id" property instead.
279              
280             Returns a single C value.
281              
282             =head1 SEE ALSO
283              
284             =over 1
285              
286             =item * L
287              
288             =item * L
289              
290             =back