line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
package WWW::Kickstarter::Data::Project; |
3
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
9
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
37
|
|
5
|
1
|
|
|
1
|
|
9
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
36
|
|
6
|
1
|
|
|
1
|
|
8
|
no autovivification; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
7
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
65
|
use WWW::Kickstarter::Data qw( ); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
26
|
|
10
|
1
|
|
|
1
|
|
375
|
use WWW::Kickstarter::Data::User qw( ); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
1179
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our @ISA = 'WWW::Kickstarter::Data'; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub _new { |
17
|
0
|
0
|
|
0
|
|
|
my_croak(400, "Incorrect usage") if @_ < 3; |
18
|
0
|
|
|
|
|
|
my ($class, $ks, $data, %opts) = @_; |
19
|
|
|
|
|
|
|
|
20
|
0
|
0
|
|
|
|
|
if (my @unrecognized = keys(%opts)) { |
21
|
0
|
|
|
|
|
|
my_croak(400, "Unrecognized parameters @unrecognized"); |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
0
|
|
|
|
|
|
my $self = $class->SUPER::_new($ks, $data); |
25
|
0
|
0
|
|
|
|
|
$self->{creator } = WWW::Kickstarter::Data::User ->_new($ks, $self->{creator }) if exists($self->{creator }); |
26
|
0
|
0
|
|
|
|
|
$self->{category} = WWW::Kickstarter::Data::Category->_new($ks, $self->{category}) if exists($self->{category}); |
27
|
0
|
0
|
|
|
|
|
$self->{location} = WWW::Kickstarter::Data::Location->_new($ks, $self->{location}) if exists($self->{location}); |
28
|
|
|
|
|
|
|
|
29
|
0
|
0
|
|
|
|
|
if (exists($self->{rewards})) { |
30
|
0
|
|
|
|
|
|
for my $reward (@{ $self->{rewards} }) { |
|
0
|
|
|
|
|
|
|
31
|
0
|
|
|
|
|
|
$reward = WWW::Kickstarter::Data::Reward->_new($ks, $reward); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
0
|
|
|
|
|
|
return $self; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
|
39
|
0
|
|
|
0
|
1
|
|
sub id { $_[0]{id} } |
40
|
0
|
|
|
0
|
1
|
|
sub slug { $_[0]{slug} } |
41
|
0
|
|
|
0
|
1
|
|
sub name { $_[0]{name} } |
42
|
0
|
|
|
0
|
1
|
|
sub url { $_[0]{urls}{web}{project} } |
43
|
0
|
|
|
0
|
1
|
|
sub blurb { $_[0]{blurb} } |
44
|
0
|
|
|
0
|
1
|
|
sub launched_at { $_[0]{launched_at} } # When project started |
45
|
0
|
|
|
0
|
1
|
|
sub deadline { $_[0]{deadline} } # When project ends |
46
|
0
|
|
|
0
|
1
|
|
sub backers_count { $_[0]{backers_count} } |
47
|
0
|
|
|
0
|
1
|
|
sub currency { $_[0]{currency} } |
48
|
0
|
|
|
0
|
1
|
|
sub goal { $_[0]{goal} } |
49
|
0
|
|
|
0
|
1
|
|
sub pledged { $_[0]{pledged} } |
50
|
0
|
|
|
0
|
1
|
|
sub progress { $_[0]{pledged} / $_[0]{goal} } |
51
|
0
|
|
|
0
|
1
|
|
sub progress_pct { int( $_[0]{pledged} / $_[0]{goal} * 100 ) } |
52
|
0
|
|
|
0
|
1
|
|
sub creator { $_[0]{creator} } |
53
|
0
|
|
|
0
|
1
|
|
sub location { $_[0]{location} } |
54
|
0
|
|
|
0
|
1
|
|
sub category { $_[0]{category} } |
55
|
0
|
|
|
0
|
1
|
|
sub category_id { $_[0]{category}{id} } |
56
|
0
|
|
|
0
|
1
|
|
sub category_name { $_[0]{category}{name} } |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
|
59
|
0
|
|
|
0
|
1
|
|
sub refetch { my $self = shift; return $self->ks->project($self->id, @_); } |
|
0
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub rewards { |
62
|
0
|
|
|
0
|
1
|
|
my ($self, %opts) = @_; |
63
|
0
|
|
|
|
|
|
my $force = delete($opts{force}); |
64
|
0
|
0
|
0
|
|
|
|
return @{ $self->{rewards} } if !$force && $self->{rewards}; |
|
0
|
|
|
|
|
|
|
65
|
0
|
|
|
|
|
|
return $self->ks->project_rewards($self->id, %opts); |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
1; |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
__END__ |