line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Business::Fixflo::PropertyAddress; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
Business::Fixflo::Property::Address |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 DESCRIPTION |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
A class for a fixflo property address, extends L |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=cut |
12
|
|
|
|
|
|
|
|
13
|
16
|
|
|
16
|
|
125
|
use strict; |
|
16
|
|
|
|
|
36
|
|
|
16
|
|
|
|
|
519
|
|
14
|
16
|
|
|
16
|
|
90
|
use warnings; |
|
16
|
|
|
|
|
35
|
|
|
16
|
|
|
|
|
454
|
|
15
|
|
|
|
|
|
|
|
16
|
16
|
|
|
16
|
|
99
|
use Moo; |
|
16
|
|
|
|
|
37
|
|
|
16
|
|
|
|
|
112
|
|
17
|
|
|
|
|
|
|
extends 'Business::Fixflo::Property'; |
18
|
|
|
|
|
|
|
|
19
|
16
|
|
|
16
|
|
6320
|
use Try::Tiny; |
|
16
|
|
|
|
|
48
|
|
|
16
|
|
|
|
|
1585
|
|
20
|
16
|
|
|
16
|
|
138
|
use Carp qw/ carp /; |
|
16
|
|
|
|
|
45
|
|
|
16
|
|
|
|
|
961
|
|
21
|
16
|
|
|
16
|
|
123
|
use Business::Fixflo::Property; |
|
16
|
|
|
|
|
43
|
|
|
16
|
|
|
|
|
426
|
|
22
|
16
|
|
|
16
|
|
102
|
use Business::Fixflo::Address; |
|
16
|
|
|
|
|
39
|
|
|
16
|
|
|
|
|
464
|
|
23
|
16
|
|
|
16
|
|
97
|
use Business::Fixflo::Exception; |
|
16
|
|
|
|
|
43
|
|
|
16
|
|
|
|
|
804
|
|
24
|
|
|
|
|
|
|
|
25
|
16
|
|
|
16
|
|
91
|
use Carp qw/ confess /; |
|
16
|
|
|
|
|
37
|
|
|
16
|
|
|
|
|
8450
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head1 Operations on a property address |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head2 get |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
Gets a property address based on the Id |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head2 merge |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
merges a property address into a property: |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
$PropertyAddress = $PropertyAddress->merge( $Property ); |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
$Property must be a Business::Fixflo::Property object and have its Id set |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head2 split |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
splits a property address from a property |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head2 property |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
gets the L object associated with the property |
48
|
|
|
|
|
|
|
address: |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
my $Property = $PropertyAddress->property; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=cut |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub get { |
55
|
1
|
|
|
1
|
1
|
1011
|
my ( $self ) = @_; |
56
|
|
|
|
|
|
|
|
57
|
1
|
|
|
|
|
12
|
my $data = $self->client->api_get( |
58
|
|
|
|
|
|
|
'PropertyAddress/' . $self->Id |
59
|
|
|
|
|
|
|
); |
60
|
|
|
|
|
|
|
|
61
|
1
|
|
|
|
|
3
|
foreach my $attr ( keys( %{ $data } ) ) { |
|
1
|
|
|
|
|
5
|
|
62
|
3
|
|
|
3
|
|
281
|
try { $self->$attr( $data->{$attr} ); } |
63
|
|
|
|
|
|
|
catch { |
64
|
0
|
|
|
0
|
|
0
|
carp( "Couldn't set $attr on @{[ ref( $self ) ]}: $_" ); |
|
0
|
|
|
|
|
0
|
|
65
|
3
|
|
|
|
|
68
|
}; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
1
|
|
|
|
|
27
|
return $self; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub merge { |
72
|
4
|
|
|
4
|
1
|
1157
|
my ( $self,$Property ) = @_; |
73
|
|
|
|
|
|
|
|
74
|
4
|
100
|
|
|
|
35
|
Business::Fixflo::Exception->throw({ |
75
|
|
|
|
|
|
|
message => 'PropertyAddress->merge requires a Business::Fixflo::Property', |
76
|
|
|
|
|
|
|
}) if ref( $Property ) ne 'Business::Fixflo::Property'; |
77
|
|
|
|
|
|
|
|
78
|
3
|
100
|
|
|
|
21
|
Business::Fixflo::Exception->throw({ |
79
|
|
|
|
|
|
|
message => 'PropertyAddress->Id must be set to merge', |
80
|
|
|
|
|
|
|
}) if ! $self->Id; |
81
|
|
|
|
|
|
|
|
82
|
2
|
100
|
|
|
|
15
|
Business::Fixflo::Exception->throw({ |
83
|
|
|
|
|
|
|
message => 'Property->Id must be set to merge', |
84
|
|
|
|
|
|
|
}) if ! $Property->Id; |
85
|
|
|
|
|
|
|
|
86
|
1
|
|
|
|
|
14
|
return $self->_parse_envelope_data( |
87
|
|
|
|
|
|
|
$self->client->api_post( |
88
|
|
|
|
|
|
|
'PropertyAddress/Merge', |
89
|
|
|
|
|
|
|
{ |
90
|
|
|
|
|
|
|
Id => $self->Id, |
91
|
|
|
|
|
|
|
PropertyId => $Property->Id, |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
), |
94
|
|
|
|
|
|
|
); |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
sub split { |
98
|
2
|
|
|
2
|
1
|
54
|
my ( $self ) = @_; |
99
|
|
|
|
|
|
|
|
100
|
2
|
100
|
|
|
|
16
|
Business::Fixflo::Exception->throw({ |
101
|
|
|
|
|
|
|
message => 'PropertyAddress->Id must be set to split', |
102
|
|
|
|
|
|
|
}) if ! $self->Id; |
103
|
|
|
|
|
|
|
|
104
|
1
|
|
|
|
|
11
|
return $self->_parse_envelope_data( |
105
|
|
|
|
|
|
|
$self->client->api_post( |
106
|
|
|
|
|
|
|
'PropertyAddress/Split', |
107
|
|
|
|
|
|
|
{ |
108
|
|
|
|
|
|
|
Id => $self->Id, |
109
|
|
|
|
|
|
|
} |
110
|
|
|
|
|
|
|
), |
111
|
|
|
|
|
|
|
); |
112
|
|
|
|
|
|
|
} |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
sub property { |
115
|
1
|
|
|
1
|
1
|
4
|
my ( $self ) = @_; |
116
|
|
|
|
|
|
|
|
117
|
1
|
|
|
|
|
33
|
my $Property = Business::Fixflo::Property->new( |
118
|
|
|
|
|
|
|
client => $self->client, |
119
|
|
|
|
|
|
|
Id => $self->PropertyId, |
120
|
|
|
|
|
|
|
); |
121
|
|
|
|
|
|
|
|
122
|
1
|
|
|
|
|
13
|
return $Property->get; |
123
|
|
|
|
|
|
|
} |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=head1 AUTHOR |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
Lee Johnson - C |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify it under |
130
|
|
|
|
|
|
|
the same terms as Perl itself. If you would like to contribute documentation, |
131
|
|
|
|
|
|
|
features, bug fixes, or anything else then please raise an issue / pull request: |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
https://github.com/Humanstate/business-fixflo |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=cut |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
1; |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
# vim: ts=4:sw=4:et |