| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Business::Fixflo::Agency; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
Business::Fixflo::Agency |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
A class for a fixflo agency, extends L |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=cut |
|
12
|
|
|
|
|
|
|
|
|
13
|
16
|
|
|
16
|
|
126
|
use strict; |
|
|
16
|
|
|
|
|
36
|
|
|
|
16
|
|
|
|
|
541
|
|
|
14
|
16
|
|
|
16
|
|
88
|
use warnings; |
|
|
16
|
|
|
|
|
33
|
|
|
|
16
|
|
|
|
|
438
|
|
|
15
|
|
|
|
|
|
|
|
|
16
|
16
|
|
|
16
|
|
84
|
use Moo; |
|
|
16
|
|
|
|
|
36
|
|
|
|
16
|
|
|
|
|
103
|
|
|
17
|
16
|
|
|
16
|
|
6253
|
use Business::Fixflo::Exception; |
|
|
16
|
|
|
|
|
40
|
|
|
|
16
|
|
|
|
|
419
|
|
|
18
|
16
|
|
|
16
|
|
111
|
use Business::Fixflo::Envelope; |
|
|
16
|
|
|
|
|
42
|
|
|
|
16
|
|
|
|
|
5332
|
|
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
extends 'Business::Fixflo::Resource'; |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
AgencyName |
|
25
|
|
|
|
|
|
|
Created |
|
26
|
|
|
|
|
|
|
CustomDomain |
|
27
|
|
|
|
|
|
|
EmailAddress |
|
28
|
|
|
|
|
|
|
FeatureType |
|
29
|
|
|
|
|
|
|
Id |
|
30
|
|
|
|
|
|
|
IsDeleted |
|
31
|
|
|
|
|
|
|
IssueTreeRoot |
|
32
|
|
|
|
|
|
|
SiteBaseUrl |
|
33
|
|
|
|
|
|
|
DefaultTimeZoneId |
|
34
|
|
|
|
|
|
|
Locale |
|
35
|
|
|
|
|
|
|
Password |
|
36
|
|
|
|
|
|
|
ApiKey |
|
37
|
|
|
|
|
|
|
TermsAcceptanceUrl |
|
38
|
|
|
|
|
|
|
TermsAcceptanceDate |
|
39
|
|
|
|
|
|
|
UpdateDate |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=cut |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
has [ qw/ |
|
44
|
|
|
|
|
|
|
AgencyName |
|
45
|
|
|
|
|
|
|
Created |
|
46
|
|
|
|
|
|
|
CustomDomain |
|
47
|
|
|
|
|
|
|
EmailAddress |
|
48
|
|
|
|
|
|
|
FeatureType |
|
49
|
|
|
|
|
|
|
Id |
|
50
|
|
|
|
|
|
|
IsDeleted |
|
51
|
|
|
|
|
|
|
IssueTreeRoot |
|
52
|
|
|
|
|
|
|
SiteBaseUrl |
|
53
|
|
|
|
|
|
|
DefaultTimeZoneId |
|
54
|
|
|
|
|
|
|
Locale |
|
55
|
|
|
|
|
|
|
Password |
|
56
|
|
|
|
|
|
|
ApiKey |
|
57
|
|
|
|
|
|
|
TermsAcceptanceUrl |
|
58
|
|
|
|
|
|
|
TermsAcceptanceDate |
|
59
|
|
|
|
|
|
|
UpdateDate |
|
60
|
|
|
|
|
|
|
/ ] => ( |
|
61
|
|
|
|
|
|
|
is => 'rw', |
|
62
|
|
|
|
|
|
|
); |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head1 Operations on an agency |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head2 create |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
Creates an agency in the Fixflo API - will throw an exception if the Id |
|
69
|
|
|
|
|
|
|
is already set |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head2 update |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
Updates an agency in the Fixflo API - will throw an exception if the Id |
|
74
|
|
|
|
|
|
|
is not set |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head2 delete |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
Deletes an agency in the Fixflo API - will throw an exception if the Id |
|
79
|
|
|
|
|
|
|
is not set |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head2 undelete |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
Undeletes an agency in the Fixflo API - will throw an exception if the Id |
|
84
|
|
|
|
|
|
|
is not set |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=cut |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
sub create { |
|
89
|
4
|
|
|
4
|
1
|
104
|
my ( $self,$update ) = @_; |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
$self->SUPER::_create( $update,'Agency',sub { |
|
92
|
|
|
|
|
|
|
return { shift->to_hash }, |
|
93
|
4
|
|
|
2
|
|
25
|
} ); |
|
|
2
|
|
|
|
|
7
|
|
|
94
|
|
|
|
|
|
|
} |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
sub delete { |
|
97
|
3
|
|
|
3
|
1
|
40
|
my ( $self,$undelete ) = @_; |
|
98
|
|
|
|
|
|
|
|
|
99
|
3
|
|
100
|
|
|
15
|
$undelete //= 'delete'; |
|
100
|
|
|
|
|
|
|
|
|
101
|
3
|
100
|
|
|
|
13
|
if ( ! $self->Id ) { |
|
102
|
1
|
|
|
|
|
7
|
Business::Fixflo::Exception->throw({ |
|
103
|
|
|
|
|
|
|
message => "Can't $undelete Agency if Id is not set", |
|
104
|
|
|
|
|
|
|
}); |
|
105
|
|
|
|
|
|
|
} |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
$self->_parse_envelope_data( |
|
108
|
|
|
|
|
|
|
# implemented as POST rather than DELETE as DELETE with content |
|
109
|
|
|
|
|
|
|
# is a contentious issue in API design (and also webservers). |
|
110
|
|
|
|
|
|
|
# the fixflo API says call to DELETE Agency/{Id} should include |
|
111
|
|
|
|
|
|
|
# a content body with an Id matching the Id in the URL, but they |
|
112
|
|
|
|
|
|
|
# also offer delete via POST - so we are using the POST here |
|
113
|
2
|
|
|
|
|
51
|
$self->client->api_post( $self->url_no_id . "/$undelete",{ $self->to_hash } ) |
|
114
|
|
|
|
|
|
|
); |
|
115
|
|
|
|
|
|
|
|
|
116
|
2
|
100
|
|
|
|
14
|
$self->IsDeleted( $undelete eq 'undelete' ? 0 : 1 ); |
|
117
|
|
|
|
|
|
|
|
|
118
|
2
|
|
|
|
|
8
|
return $self; |
|
119
|
|
|
|
|
|
|
} |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
sub undelete { |
|
122
|
1
|
|
|
1
|
1
|
3
|
my ( $self ) = @_; |
|
123
|
1
|
|
|
|
|
5
|
return $self->delete( 'undelete' ); |
|
124
|
|
|
|
|
|
|
} |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=head1 AUTHOR |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
Lee Johnson - C |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify it under |
|
131
|
|
|
|
|
|
|
the same terms as Perl itself. If you would like to contribute documentation, |
|
132
|
|
|
|
|
|
|
features, bug fixes, or anything else then please raise an issue / pull request: |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
https://github.com/Humanstate/business-fixflo |
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=cut |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
1; |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
# vim: ts=4:sw=4:et |