StackExchange/Answers.pm

filter: Statementstmt 100% 18 / 18 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 3 / 3 Podpod n/a totaltotal 100% 21 / 21 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« StackExchange.pm ↑ Summary StackExchange/Owner.pm »
1 package Net::StackExchange::Answers;
2 4 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
3 4 $Net::StackExchange::Answers::VERSION = '0.102740';
4 }
5  
6 # ABSTRACT: Provides accessors for an answer
7  
8 4 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 4 has [
11 qw{
12 answer_id
13 question_id
14 creation_date
15 up_vote_count
16 down_vote_count
17 view_count score
18 }
19 ] => (
20 is => 'ro',
21 isa => 'Int',
22 required => 1,
23 );
24  
25 4 has 'accepted' => (
26 is => 'ro',
27 isa => 'Boolean',
28 required => 1,
29 coerce => 1,
30 );
31  
32 4 has [
33 qw{
34 answer_comments_url
35 title
36 }
37 ] => (
38 is => 'ro',
39 isa => 'Str',
40 required => 1,
41 );
42  
43 4 has [
44 qw{
45 locked_date
46 last_edit_date
47 last_activity_date
48 }
49 ] => (
50 is => 'ro',
51 isa => 'Int',
52 );
53  
54 4 has 'owner' => (
55 is => 'ro',
56 isa => 'Net::StackExchange::Owner',
57 );
58  
59 4 has 'community_owned' => (
60 is => 'ro',
61 isa => 'Boolean',
62 required => 1,
63 coerce => 1,
64 );
65  
66 4 has 'body' => (
67 is => 'ro',
68 isa => 'Str',
69 );
70  
71 4 has 'comments' => (
72 is => 'ro',
73 isa => 'ArrayRef[Net::StackExchange::Comments]',
74 );
75  
76 4 has '_NSE' => (
77 is => 'ro',
78 isa => 'Net::StackExchange',
79 required => 1,
80 );
81  
82 4 __PACKAGE__->meta()->make_immutable();
83  
84 4 ▶no Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
85  
86 4 1;
87  
88  
89  
90 =pod
91  
92 =head1 NAME
93  
94 Net::StackExchange::Answers - Provides accessors for an answer
95  
96 =head1 VERSION
97  
98 version 0.102740
99  
100 =head1 SYNOPSIS
101  
102 use Net::StackExchange;
103  
104 my $se = Net::StackExchange->new( {
105 'network' => 'stackoverflow.com',
106 'version' => '1.0',
107 } );
108  
109 my $answers_route = $se->route('answers');
110 my $answers_request = $answers_route->prepare_request( { 'id' => '1036353' } );
111  
112 $answers_request->body(1);
113  
114 my $answers_response = $answers_request ->execute( );
115 my $answer = $answers_response->answers(0);
116  
117 print "__Answer__\n";
118 print "Title: ", $answer->title(), "\n";
119 print "Body: ", $answer->body (), "\n";
120  
121 =head1 ATTRIBUTES
122  
123 =head2 C<answer_id>
124  
125 Returns id of the answer.
126  
127 =head2 C<accepted>
128  
129 Returns whether this answer is the accepted answer on its question.
130  
131 =head2 C<answer_comments_url>
132  
133 Returns a link to the method that returns comments on this answer.
134  
135 =head2 C<question_id>
136  
137 Returns id of the question this post is or is on.
138  
139 =head2 C<locked_date>
140  
141 Returns date this question was locked.
142  
143 =head2 C<owner>
144  
145 Returns a L<Net::StackExchange::Owner> object.
146  
147 =head2 C<creation_date>
148  
149 Returns date this post was created.
150  
151 =head2 C<last_edit_date>
152  
153 Returns last time this post was edited.
154  
155 =head2 C<last_activity_date>
156  
157 Returns last time this post had any activity.
158  
159 =head2 C<up_vote_count>
160  
161 Returns number of up votes on this post.
162  
163 =head2 C<down_vote_count>
164  
165 Returns number of down votes on this post.
166  
167 =head2 C<view_count>
168  
169 Returns number of times this post has been viewed.
170  
171 =head2 C<score>
172  
173 Returns score of this post.
174  
175 =head2 C<community_owned>
176  
177 Returns whether this post is community owned.
178  
179 =head2 C<title>
180  
181 Returns title of this post, in plaintext.
182  
183 =head2 C<body>
184  
185 Returns body of this post, rendered as HTML.
186  
187 =head2 C<comments>
188  
189 Returns a L<Net::StackExchange::Comments> object.
190  
191 =head1 AUTHOR
192  
193 Alan Haggai Alavi <alanhaggai@alanhaggai.org>
194  
195 =head1 COPYRIGHT AND LICENSE
196  
197 This software is copyright (c) 2010 by Alan Haggai Alavi.
198  
199 This is free software; you can redistribute it and/or modify it under
200 the same terms as the Perl 5 programming language system itself.
201  
202 =cut
203  
204  
205 __END__
« StackExchange.pm ↑ Summary StackExchange/Owner.pm »