File Coverage

blib/lib/WebService/TypePad/Object/Link.pm
Criterion Covered Total %
statement 12 92 13.0
branch 0 32 0.0
condition n/a
subroutine 4 20 20.0
pod 16 16 100.0
total 32 160 20.0


line stmt bran cond sub pod time code
1             package WebService::TypePad::Object::Link;
2 1     1   1409 use strict;
  1         2  
  1         129  
3 1     1   6 use warnings;
  1         2  
  1         23  
4 1     1   5 use WebService::TypePad::Util::Coerce;
  1         2  
  1         21  
5 1     1   5 use base qw(WebService::TypePad::Object::Asset);
  1         1  
  1         1190  
6              
7             sub target_url {
8 0     0 1   my $self = shift;
9 0 0         if (@_) {
10 0           $self->{data}{targetUrl} = WebService::TypePad::Util::Coerce::coerce_string_in($_[0]);
11 0           return $_[0];
12             }
13             else {
14 0           return $self->{data}{targetUrl};
15             }
16             }
17              
18             sub id {
19 0     0 1   my $self = shift;
20 0 0         if (@_) {
21 0           $self->{data}{id} = WebService::TypePad::Util::Coerce::coerce_string_in($_[0]);
22 0           return $_[0];
23             }
24             else {
25 0           return $self->{data}{id};
26             }
27             }
28              
29             sub url_id {
30 0     0 1   my $self = shift;
31 0 0         if (@_) {
32 0           $self->{data}{urlId} = WebService::TypePad::Util::Coerce::coerce_string_in($_[0]);
33 0           return $_[0];
34             }
35             else {
36 0           return $self->{data}{urlId};
37             }
38             }
39              
40             sub permalink_url {
41 0     0 1   my $self = shift;
42 0 0         if (@_) {
43 0           $self->{data}{permalinkUrl} = WebService::TypePad::Util::Coerce::coerce_string_in($_[0]);
44 0           return $_[0];
45             }
46             else {
47 0           return $self->{data}{permalinkUrl};
48             }
49             }
50              
51             sub author {
52 0     0 1   my $self = shift;
53 0 0         if (@_) {
54 0           $self->{data}{author} = WebService::TypePad::Util::Coerce::coerce_User_in($_[0]);
55 0           return $_[0];
56             }
57             else {
58 0           return WebService::TypePad::Util::Coerce::coerce_User_out($self->{data}{author});
59             }
60             }
61              
62             sub published {
63 0     0 1   my $self = shift;
64 0 0         if (@_) {
65 0           $self->{data}{published} = WebService::TypePad::Util::Coerce::coerce_string_in($_[0]);
66 0           return $_[0];
67             }
68             else {
69 0           return $self->{data}{published};
70             }
71             }
72              
73             sub content {
74 0     0 1   my $self = shift;
75 0 0         if (@_) {
76 0           $self->{data}{content} = WebService::TypePad::Util::Coerce::coerce_string_in($_[0]);
77 0           return $_[0];
78             }
79             else {
80 0           return $self->{data}{content};
81             }
82             }
83              
84             sub text_format {
85 0     0 1   my $self = shift;
86 0 0         if (@_) {
87 0           $self->{data}{textFormat} = WebService::TypePad::Util::Coerce::coerce_string_in($_[0]);
88 0           return $_[0];
89             }
90             else {
91 0           return $self->{data}{textFormat};
92             }
93             }
94              
95             sub groups {
96 0     0 1   my $self = shift;
97 0 0         if (@_) {
98 0           $self->{data}{groups} = WebService::TypePad::Util::Coerce::coerce_array_in($_[0], \&WebService::TypePad::Util::Coerce::coerce_string_in);
99 0           return $_[0];
100             }
101             else {
102 0           return WebService::TypePad::Util::Coerce::coerce_array_out($self->{data}{groups});
103             }
104             }
105              
106             sub source {
107 0     0 1   my $self = shift;
108 0 0         if (@_) {
109 0           $self->{data}{source} = WebService::TypePad::Util::Coerce::coerce_AssetSource_in($_[0]);
110 0           return $_[0];
111             }
112             else {
113 0           return WebService::TypePad::Util::Coerce::coerce_AssetSource_out($self->{data}{source});
114             }
115             }
116              
117             sub links {
118 0     0 1   my $self = shift;
119 0 0         if (@_) {
120 0           $self->{data}{links} = WebService::TypePad::Util::Coerce::coerce_array_in($_[0], \&WebService::TypePad::Util::Coerce::coerce_LegacyHyperlink_in);
121 0           return $_[0];
122             }
123             else {
124 0           return WebService::TypePad::Util::Coerce::coerce_array_out($self->{data}{links}, \&WebService::TypePad::Util::Coerce::coerce_LegacyHyperlink_out);
125             }
126             }
127              
128             sub object_types {
129 0     0 1   my $self = shift;
130 0 0         if (@_) {
131 0           $self->{data}{objectTypes} = WebService::TypePad::Util::Coerce::coerce_set_in($_[0], \&WebService::TypePad::Util::Coerce::coerce_string_in);
132 0           return $_[0];
133             }
134             else {
135 0           return WebService::TypePad::Util::Coerce::coerce_set_out($self->{data}{objectTypes});
136             }
137             }
138              
139             sub is_favorite_for_current_user {
140 0     0 1   my $self = shift;
141 0 0         if (@_) {
142 0           $self->{data}{isFavoriteForCurrentUser} = WebService::TypePad::Util::Coerce::coerce_boolean_in($_[0]);
143 0           return $_[0];
144             }
145             else {
146 0           return WebService::TypePad::Util::Coerce::coerce_boolean_out($self->{data}{isFavoriteForCurrentUser});
147             }
148             }
149              
150             sub favorite_count {
151 0     0 1   my $self = shift;
152 0 0         if (@_) {
153 0           $self->{data}{favoriteCount} = WebService::TypePad::Util::Coerce::coerce_integer_in($_[0]);
154 0           return $_[0];
155             }
156             else {
157 0           return $self->{data}{favoriteCount};
158             }
159             }
160              
161             sub comment_count {
162 0     0 1   my $self = shift;
163 0 0         if (@_) {
164 0           $self->{data}{commentCount} = WebService::TypePad::Util::Coerce::coerce_integer_in($_[0]);
165 0           return $_[0];
166             }
167             else {
168 0           return $self->{data}{commentCount};
169             }
170             }
171              
172             sub allowed_methods {
173 0     0 1   my $self = shift;
174 0 0         if (@_) {
175 0           $self->{data}{allowedMethods} = WebService::TypePad::Util::Coerce::coerce_set_in($_[0], \&WebService::TypePad::Util::Coerce::coerce_string_in);
176 0           return $_[0];
177             }
178             else {
179 0           return WebService::TypePad::Util::Coerce::coerce_set_out($self->{data}{allowedMethods});
180             }
181             }
182              
183             1;
184              
185             =head1 NAME
186              
187             WebService::TypePad::Object::Link - Perl representation of TypePad's Link object type
188              
189             =head1 SYNOPSIS
190              
191             use WebService::TypePad::Object::Link;
192             my $link = WebService::TypePad::Object::Link->new();
193              
194             =head1 DESCRIPTION
195              
196             This is a Perl representation of TypePad's Link object type.
197             For more information about this type and its parameters, see L.
198              
199             This is a subtype of L.
200              
201             =head1 PROPERTIES
202              
203             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.
204              
205             =head2 $link->allowed_methods
206              
207             Set of strings containing the HTTP methods that the currently-authenticated client is allowed to apply to this asset.
208              
209             Returns a set of C values.
210              
211             =head2 $link->author
212              
213             The user that created the selected asset.
214              
215             Returns a single L object.
216              
217             =head2 $link->comment_count
218              
219             The number of comments that have been posted in the comment tree beneath this asset.
220              
221             Returns a single C value.
222              
223             =head2 $link->content
224              
225             The raw asset content. The C property defines what format this data is in.
226              
227             Returns a single C value.
228              
229             =head2 $link->favorite_count
230              
231             The number of distinct users who have added this asset as a favorite.
232              
233             Returns a single C value.
234              
235             =head2 $link->groups
236              
237             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.
238              
239             Returns an array of C values.
240              
241             =head2 $link->id
242              
243             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.
244              
245             Returns a single C value.
246              
247             =head2 $link->is_favorite_for_current_user
248              
249             C if this asset is a favorite for the current user, or C otherwise. This property is not set for responses to anonymous requests.
250              
251             Returns a single C value.
252              
253             =head2 $link->links
254              
255             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.
256              
257             Returns an array of L objects.
258              
259             =head2 $link->object_types
260              
261             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.
262              
263             Returns a set of C values.
264              
265             =head2 $link->permalink_url
266              
267             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.
268              
269             Returns a single C value.
270              
271             =head2 $link->published
272              
273             The time that the asset was created, as an RFC3339 timestamp.
274              
275             Returns a single C value.
276              
277             =head2 $link->source
278              
279             An object describing the site from which this asset was retrieved, for assets obtained from external feeds.
280              
281             Returns a single L object.
282              
283             =head2 $link->target_url
284              
285             The URL that is the target of this link.
286              
287             Returns a single C value.
288              
289             =head2 $link->text_format
290              
291             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.
292              
293             Returns a single C value.
294              
295             =head2 $link->url_id
296              
297             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.
298              
299             Returns a single C value.
300              
301             =head1 SEE ALSO
302              
303             =over 1
304              
305             =item * L
306              
307             =back