File Coverage

lib/Business/Fixflo/Issue.pm
Criterion Covered Total %
statement 25 26 96.1
branch 2 4 50.0
condition n/a
subroutine 8 8 100.0
pod 4 4 100.0
total 39 42 92.8


line stmt bran cond sub pod time code
1             package Business::Fixflo::Issue;
2              
3             =head1 NAME
4              
5             Business::Fixflo::Issue
6              
7             =head1 DESCRIPTION
8              
9             A class for a fixflo issue, extends L
10              
11             =cut
12              
13 16     16   125827 use strict;
  16         43  
  16         483  
14 16     16   120 use warnings;
  16         30  
  16         388  
15              
16 16     16   647 use Moo;
  16         11519  
  16         76  
17              
18             extends 'Business::Fixflo::Resource';
19             with 'Business::Fixflo::Utils';
20              
21 16     16   14039 use Business::Fixflo::Property;
  16         51  
  16         6454  
22              
23             =head1 ATTRIBUTES
24              
25             Address
26             AdditionalDetails
27             AgencyId
28             AppointmentDate
29             AttendenceDate
30             AssignedAgent
31             Block
32             BlockName
33             CallbackId
34             CloseReason
35             ContactNumber
36             ContactNumberAlt
37             CostCode
38             Created
39             DirectEmailAddress
40             DirectMobileNumber
41             EmailAddress
42             ExternalRef
43             ExternalPropertyRef
44             ExternalRefTenancyAgreement
45             FaultCategory
46             FaultNotes
47             FaultPriority
48             FaultTitle
49             FaultTree
50             Firstname
51             Id
52             InactiveJobs
53             InvoiceRecipient
54             IsCommunal
55             Landlord
56             Media
57             Property
58             PropertyId
59             PropertyAddressId
60             Quotes
61             QuoteEndTime
62             QuoteNotes
63             QuoteRequests
64             Salutation
65             SearchStatus
66             Status
67             StatusChanged
68             Surname
69             TenantAcceptComplete
70             TenantId
71             TenantNotes
72             TenantPresenceRequested
73             TermsAccepted
74             Title
75             WorksAuthorisationLimit
76             VulnerableOccupiers
77              
78             =cut
79              
80             has [ qw/
81             Address
82             AdditionalDetails
83             AgencyId
84             AppointmentDate
85             AttendenceDate
86             AssignedAgent
87             Block
88             BlockName
89             CallbackId
90             ContactNumber
91             ContactNumberAlt
92             CostCode
93             Created
94             CloseReason
95             DirectEmailAddress
96             DirectMobileNumber
97             EmailAddress
98             ExternalRef
99             ExternalRefTenancyAgreement
100             FaultCategory
101             FaultId
102             FaultNotes
103             FaultPriority
104             FaultTitle
105             FaultTree
106             Firstname
107             Id
108             InactiveJobs
109             InvoiceRecipient
110             IsCommunal
111             Job
112             Landlord
113             Media
114             Property
115             PropertyAddressId
116             Quotes
117             QuoteEndTime
118             QuoteNotes
119             QuoteRequests
120             Salutation
121             SearchStatus
122             Status
123             StatusChanged
124             Surname
125             TenantAcceptComplete
126             TenantId
127             TenantNotes
128             TenantPresenceRequested
129             TermsAccepted
130             Title
131             WorksAuthorisationLimit
132             VulnerableOccupiers
133             / ] => (
134             is => 'rw',
135             );
136              
137             =head1 Operations on an issue
138              
139             =head2 report
140              
141             Returns the report content (binary, pdf)
142              
143             my $pdf_report = $issue->report;
144              
145             =cut
146              
147             sub report {
148 1     1 1 3 my ( $self ) = @_;
149 1         28 return $self->client->api_get( join( '/',$self->url,'Report' ) );
150             }
151              
152             =head2 property
153              
154             Returns the L associated with the issue
155              
156             my $Property = $issue->property;
157              
158             =cut
159              
160             sub property {
161 1     1 1 556 my ( $self ) = @_;
162              
163 1 50       84 $self->get if ! $self->Property;
164              
165 1 50       7 if ( my $property = $self->Property ) {
166             return Business::Fixflo::Property->new(
167             client => $self->client,
168 1         5 %{ $property },
  1         10  
169             );
170             }
171              
172 0         0 return undef;
173             }
174              
175             =head2 create_url
176              
177             my $issue_create_url = $issue->create_url( $params );
178              
179             Returns a URL string that can be used to create an Issue in Fixflo - the method
180             can accept a hashref of params that can pre-populate fields on the page:
181              
182             IsVacant => bool,
183             TenantNo => string,
184             BMBlockId => $id,
185             PropertyId => $id
186              
187             Having called the method redirect the user to the returned URL
188              
189             =cut
190              
191             sub create_url {
192 1     1 1 411 my ( $self,$params ) = @_;
193              
194 1         28 my $base_url = join( '/',$self->client->base_url,'Issue','Create' );
195 1         18 return $base_url . '?' . $self->normalize_params( $params );
196             }
197              
198             =head2 search_url
199              
200             my $issue_search_url = $issue->search_url( $params );
201              
202             Much like create_url but returns a URL string for searching. Note this method
203             can accept many URL parameters so check the Fixflo documentation for a complete
204             list
205              
206             Having called the method redirect the user to the returned URL
207              
208             =cut
209              
210             sub search_url {
211 1     1 1 581 my ( $self,$params ) = @_;
212              
213 1         27 my $base_url = join( '/',$self->client->base_url,
214             'Dashboard','Home','#','Dashboard','IssueSearchForm',
215             );
216              
217 1         16 return $base_url . '?' . $self->normalize_params( $params );
218             }
219              
220             1;
221              
222             # vim: ts=4:sw=4:et