File Coverage

blib/lib/WebService/PivotalTracker/ProjectMembership.pm
Criterion Covered Total %
statement 21 23 91.3
branch n/a
condition n/a
subroutine 7 8 87.5
pod n/a
total 28 31 90.3


line stmt bran cond sub pod time code
1             package WebService::PivotalTracker::ProjectMembership;
2              
3 1     1   7 use strict;
  1         2  
  1         30  
4 1     1   4 use warnings;
  1         2  
  1         25  
5 1     1   6 use namespace::autoclean;
  1         2  
  1         7  
6              
7             our $VERSION = '0.12';
8              
9 1     1   83 use WebService::PivotalTracker::Person ();
  1         2  
  1         25  
10 1     1   6 use WebService::PivotalTracker::PropertyAttributes;
  1         2  
  1         52  
11 1         10 use WebService::PivotalTracker::Types qw(
12             Bool
13             DateTimeObject
14             NonEmptyStr
15             PersonObject
16             PositiveInt
17 1     1   5 );
  1         3  
18              
19 1     1   1618 use Moo;
  1         3  
  1         6  
20              
21             has( @{$_} ) for props_to_attributes(
22             kind => NonEmptyStr,
23             project_id => PositiveInt,
24             id => PositiveInt,
25             last_viewed_at => {
26             type => DateTimeObject,
27             inflator => '_inflate_iso8601_datetime',
28             },
29             created_at => {
30             type => DateTimeObject,
31             inflator => '_inflate_iso8601_datetime',
32             },
33             updated_at => {
34             type => DateTimeObject,
35             inflator => '_inflate_iso8601_datetime',
36             },
37             role => NonEmptyStr,
38             project_color => NonEmptyStr,
39             favorite => Bool,
40             wants_comment_notification_emails => Bool,
41             will_receive_mention_notifications_or_emails => Bool,
42             );
43              
44             has person => (
45             is => 'ro',
46             isa => PersonObject,
47             lazy => 1,
48             default => sub {
49             my $self = shift;
50             WebService::PivotalTracker::Person->new(
51             pt_api => $self->_pt_api,
52             raw_content => $self->raw_content->{person},
53             );
54             },
55             );
56              
57             with 'WebService::PivotalTracker::Entity';
58              
59             ## no critic (Subroutines::ProhibitUnusedPrivateSubroutines)
60             sub _self_uri {
61 0     0     my $self = shift;
62              
63 0           return $self->_client->build_uri(
64             sprintf(
65             '/projects/%s/membership/%s',
66             $self->project_id,
67             $self->id,
68             )
69             );
70             }
71             ## use critic
72              
73             1;
74              
75             # ABSTRACT: A single project membership
76              
77             __END__
78              
79             =pod
80              
81             =encoding UTF-8
82              
83             =head1 NAME
84              
85             WebService::PivotalTracker::ProjectMembership - A single project membership
86              
87             =head1 VERSION
88              
89             version 0.12
90              
91             =head1 SYNOPSIS
92              
93             =head1 DESCRIPTION
94              
95             This class represents a single project membership.
96              
97             =for Test::Synopsis my $pt;
98              
99             my $memberships = $pt->project_memberships(...)->[0];
100             say $_->person->name for $memberships->@*;
101              
102             =head1 ATTRIBUTES
103              
104             This class provides the following attribute accessor methods. Each one
105             corresponds to a property defined by the L<PT REST API V5 project membership
106             resource
107             docs|https://www.pivotaltracker.com/help/api/rest/v5#project_membership_resource>.
108              
109             =head2 kind
110              
111             =head2 project_id
112              
113             =head2 id
114              
115             =head2 last_viewed_at
116              
117             =head2 created_at
118              
119             =head2 updated_at
120              
121             =head2 role
122              
123             =head2 project_color
124              
125             =head2 favorite
126              
127             =head2 wants_comment_notification_emails
128              
129             =head2 will_receive_mention_notifications_or_emails
130              
131             =head2 raw_content
132              
133             The raw JSON used to create this object.
134              
135             =head1 METHODS
136              
137             This class provides the following methods:
138              
139             =head2 $membership->person
140              
141             This method returns the L<WebService::PivotalTracker::Person> object contained
142             in the project membership.
143              
144             =head1 SUPPORT
145              
146             Bugs may be submitted through L<https://github.com/maxmind/WebService-PivotalTracker/issues>.
147              
148             =head1 AUTHOR
149              
150             Dave Rolsky <autarch@urth.org>
151              
152             =head1 COPYRIGHT AND LICENSE
153              
154             This software is Copyright (c) 2016 - 2020 by MaxMind, Inc.
155              
156             This is free software, licensed under:
157              
158             The Artistic License 2.0 (GPL Compatible)
159              
160             =cut