File Coverage

blib/lib/WebService/Nestoria/Search/Result.pm
Criterion Covered Total %
statement 50 50 100.0
branch n/a
condition n/a
subroutine 42 42 100.0
pod 1 40 2.5
total 93 132 70.4


line stmt bran cond sub pod time code
1 9     9   43 use strict;
  9         13  
  9         247  
2 9     9   49 use warnings;
  9         15  
  9         8890  
3              
4             package WebService::Nestoria::Search::Result;
5             $WebService::Nestoria::Search::Result::VERSION = '1.022010';
6             =head1 NAME
7              
8             WebService::Nestoria::Search::Result - Container object for a WebService::Nestoria::Search result.
9              
10             =head1 VERSION
11              
12             version 1.022010
13              
14             Contains all the information received about a single property listing and many functions for outputting the information.
15              
16             This package is used by WebService::Nestoria::Search and a Result object should never need to be explicitly created by the user.
17              
18             =cut
19              
20             sub new {
21 512     512 0 1114 my $class = shift;
22 512         876 my $self;
23              
24 512         1490 $self->{data} = shift;
25              
26 512         3806 return bless $self, $class;
27             }
28              
29             =head1 Functions
30              
31             =head2 get_*
32              
33             The get_* functions each return one attribute about the listing. They are
34             as follows:
35              
36             get_latitude
37             get_longitude
38             get_listing_type
39             get_property_type
40             get_datasource_name
41             get_lister_name
42             get_lister_url
43             get_price
44             get_price_type
45             get_price_currency
46             get_price_formatted
47             get_price_high
48             get_price_low
49             get_price_coldrent
50             get_title
51             get_summary
52             get_bedroom_number
53             get_bathroom_number
54             get_room_number
55             get_floor
56             get_size
57             get_size_unit
58             get_land_size
59             get_land_size_unit
60             get_thumb_url
61             get_thumb_height
62             get_thumb_width
63             get_img_url
64             get_img_height
65             get_img_width
66             get_keywords
67             get_guid
68             get_commission
69             get_construction_year
70             get_auction_date
71             get_updated_in_days
72             get_updated_in_days_formatted
73             get_location_accuracy
74              
75             =cut
76              
77 1     1 0 1561 sub get_latitude { shift->{data}{listing}{latitude} }
78 1     1 0 1102 sub get_longitude { shift->{data}{listing}{longitude} }
79 1     1 0 844 sub get_listing_type { shift->{data}{listing}{listing_type} }
80 1     1 0 818 sub get_property_type { shift->{data}{listing}{property_type} }
81 1     1 0 908 sub get_datasource_name { shift->{data}{listing}{datasource_name} }
82 1     1 0 882 sub get_lister_name { shift->{data}{listing}{lister_name} }
83 1     1 0 525 sub get_lister_url { shift->{data}{listing}{lister_url} }
84 1     1 0 507 sub get_price { shift->{data}{listing}{price} }
85 1     1 0 489 sub get_price_type { shift->{data}{listing}{price_type} }
86 1     1 0 488 sub get_price_currency { shift->{data}{listing}{price_currency} }
87 1     1 0 483 sub get_price_formatted { shift->{data}{listing}{price_formatted}; }
88 1     1 0 488 sub get_price_high { shift->{data}{listing}{price_high}; }
89 1     1 0 531 sub get_price_low { shift->{data}{listing}{price_low}; }
90 1     1 0 503 sub get_price_coldrent { shift->{data}{listing}{price_coldrent}; }
91 11     11 0 5150 sub get_title { shift->{data}{listing}{title} }
92 1     1 0 517 sub get_summary { shift->{data}{listing}{summary} }
93 1     1 0 490 sub get_bedroom_number { shift->{data}{listing}{bedroom_number} }
94 1     1 0 540 sub get_bathroom_number { shift->{data}{listing}{bathroom_number} }
95 1     1 0 637 sub get_room_number { shift->{data}{listing}{room_number} }
96 1     1 0 679 sub get_floor { shift->{data}{listing}{floor} }
97 1     1 0 603 sub get_size { shift->{data}{listing}{size} }
98 1     1 0 583 sub get_size_unit { shift->{data}{listing}{size_unit} }
99 1     1 0 495 sub get_land_size { shift->{data}{listing}{land_size} }
100 1     1 0 543 sub get_land_size_unit { shift->{data}{listing}{land_size_unit} }
101 1     1 0 547 sub get_thumb_url { shift->{data}{listing}{thumb_url} }
102 1     1 0 595 sub get_thumb_height { shift->{data}{listing}{thumb_height} }
103 1     1 0 506 sub get_thumb_width { shift->{data}{listing}{thumb_width} }
104 1     1 0 622 sub get_img_url { shift->{data}{listing}{img_url} }
105 1     1 0 513 sub get_img_height { shift->{data}{listing}{img_height} }
106 1     1 0 570 sub get_img_width { shift->{data}{listing}{img_width} }
107 1     1 0 531 sub get_keywords { shift->{data}{listing}{keywords} }
108 1     1 0 579 sub get_guid { shift->{data}{listing}{guid} }
109 1     1 0 643 sub get_updated_in_days { shift->{data}{listing}{updated_in_days} }
110 1     1 0 686 sub get_updated_in_days_formatted { shift->{data}{listing}{updated_in_days_formatted} }
111 1     1 0 557 sub get_construction_year { shift->{data}{listing}{construction_year} }
112 1     1 0 504 sub get_commission { shift->{data}{listing}{commission} }
113 1     1 0 574 sub get_auction_date { shift->{data}{listing}{auction_date} }
114 1     1 0 593 sub get_location_accuracy { shift->{data}{listing}{location_accuracy} }
115              
116             =head2 get_hashref
117              
118             Returns a hashref containing the details of the listing with keys exactly as the list above. For example:
119              
120             use Data::Dumper;
121             print Dumper($result->get_hashref);
122              
123             $VAR1= {
124             'price_currency' => 'GBP',
125             'bathroom_number' => '2',
126             'price_formatted' => '459,950 GBP',
127             'listing_type' => 'buy',
128             'keywords' => 'Garden, Loft, Cellar, Reception',
129             'summary' => 'In need of complete refurbishment is this four bedroom family home located...',
130             'latitude' => '51.4508',
131             'lister_url' => 'http://rd.nestoria.co.uk/rd?l=api-sr-title-1&url=...',
132             'property_type' => 'house',
133             'price_type' => 'fixed',
134             'longitude' => '-0.129012',
135             'thumb_width' => '60',
136             'lister_name' => 'KF&H',
137             'thumb_url' => 'http://limg.nestoria.co.uk/f/b/fb67e2b0d76350f7ebcf8fa6488b2ec4.jpg',
138             'title' => 'Thornbury Road, Brixton',
139             'price' => '459950',
140             'bedroom_number' => '4',
141             'thumb_height' => '60',
142             'datasource_name' => 'PropertyFinder'
143             'floor' => '2',
144             };
145              
146             =cut
147              
148             sub get_hashref {
149 1     1 1 997 my $self = shift;
150 1         6 return $self->{data}{listing};
151             }
152              
153             =head1 Copyright
154              
155             Copyright (C) 2009 Lokku Ltd.
156              
157             =head1 Author
158              
159             Alex Balhatchet (alex@lokku.com)
160              
161             Patches supplied by Yoav Felberbaum and Alistair Francis.
162              
163             =cut
164              
165             1;