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