zoopla 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -137,6 +137,7 @@ class Zoopla
137
137
  @request[:page_number] = 1
138
138
  begin
139
139
  number_of_results, listings = fetch_data(@request)
140
+ number_of_results = 0 if listings.size == 0
140
141
  fetched_so_far += listings.size
141
142
  @request[:page_number] += 1
142
143
  listings.each do |listing|
@@ -3,7 +3,7 @@ class Zoopla
3
3
  module Version
4
4
  MAJOR = 0
5
5
  MINOR = 2
6
- PATCH = 2
6
+ PATCH = 3
7
7
 
8
8
  STRING = [MAJOR, MINOR, PATCH].compact.join('.')
9
9
  end
@@ -0,0 +1 @@
1
+ {"result_count":9,"country":"England","area_name":null,"longitude":-0.130993,"listing":[{"image_caption":"","num_floors":"0","listing_status":"rent","num_bedrooms":"1","agent_name":"Foxtons - Camden","latitude":51.54389,"num_recepts":"0","agent_address":"120 Parkway","property_type":"Flat","country":null,"longitude":-0.13053733,"displayable_address":"St. Augustines Road, London","floor_plan":[],"street_name":"St Augustines Road","thumbnail_url":"http://images.zoopla.co.uk/3850aa40a5884d359dacdef4cd15130d6a6756ea_80_60.jpg","num_bathrooms":"0","description":"This charming one bedroom first floor flat has been stylishly decorated featuring period charm, well proportioned rooms, high ceilings and a great location close to Camden and King's Cross. Situated on the first floor of a smart semi-detatched period conversion the property comprises reception room with working fireplace, adjoining kitchen with double doors, bedroom with extensive storage space and garden views and bathroom. St Augustines Road is a quiet no through road located close to the amenities of Camden Town with the further amenities of Caledonian Road and Upper Steet also within easy reach. Transport links include Camden Town (Northern Line) and Caledonian Road (Piccadilly Line) Underground stations with King's Cross station and the Eurostar Terminal at St Pancras both easily reached. Camden Road Station (London Overground) is also close by, together with a range of bus routes direct to Primrose Hill and the West End.","post_town":"London","price_change":[],"details_url":"http://www.zoopla.co.uk/to-rent/details/13549535","agent_logo":"http://static.zoopla.co.uk/zoopla_static_agent_logo_(47702).jpeg","outcode":"NW1","agent_phone":"020 3318 6758","image_url":"http://images.zoopla.co.uk/3850aa40a5884d359dacdef4cd15130d6a6756ea_354_255.jpg","price":"370","county":"London","listing_id":"13549535"},{"image_caption":"","num_floors":"0","listing_status":"rent","num_bedrooms":"1","agent_name":"Hotblack Desiato","latitude":51.54403,"num_recepts":"0","agent_address":"67 Parkway, Camden Town","property_type":"Flat","country":null,"longitude":-0.12957,"displayable_address":"Cantelowes Road, London","floor_plan":[],"street_name":"Cantelowes Road","thumbnail_url":"http://images.zoopla.co.uk/3888f8d7207819b2cb3a0ffa3b3d20cc41b35c97_80_60.jpg","num_bathrooms":"0","description":"A one double bedroom flat on the first floor of this attractive Victorian house in a quiet residential street near Camden Square. Accomodation comprises of a spacious reception room with wood floors, double bedroom and a modern kitchen and bathroom. Available part furnished.","post_town":"London","price_change":[{"date":"2011-03-16 03:13:38","price":"300"}],"details_url":"http://www.zoopla.co.uk/to-rent/details/14269772","agent_logo":"http://static.zoopla.co.uk/zoopla_static_agent_logo_(26490).gif","outcode":"NW1","agent_phone":"020 3318 6810","image_url":"http://images.zoopla.co.uk/3888f8d7207819b2cb3a0ffa3b3d20cc41b35c97_354_255.jpg","price":"300","county":"London","listing_id":"14269772"},{"image_caption":"","num_floors":"0","listing_status":"rent","num_bedrooms":"1","agent_name":"London Residential","latitude":51.543034,"num_recepts":"0","agent_address":"103 Parkway Camden ","property_type":"Flat","country":null,"longitude":-0.129322,"displayable_address":"St Pauls Crescent, Camden, London","floor_plan":[],"street_name":"St Pauls Crescent Camden London","thumbnail_url":"http://images.zoopla.co.uk/bac9bb3f0de4b23f79a9868a5ee7f2e8e63d6e72_80_60.jpg","num_bathrooms":"0","description":"London Residential are delighted to offer this stylish warehouse studio apartment situated in a gated development between Camden and Kings Cross. The property offers wood floors through-out, high ceilings, lots of natural light, fitted kitchenette area, shower room, part furnished with excellent storage and available for immediate occupation. The property would suit a couple looking for a unique living experience.\n\nBathroom\n\nBedroom\n\nProperty Ref:118_1338_2072232","post_town":"London","price_change":[{"date":"2011-02-11 00:49:29","price":"325"},{"date":"2011-03-01 19:22:11","price":"295"},{"date":"2011-03-07 19:55:02","price":"285"}],"details_url":"http://www.zoopla.co.uk/to-rent/details/14052546","agent_logo":"http://static.zoopla.co.uk/zoopla_static_agent_logo_(26919).gif","outcode":"NW1","agent_phone":"020 3318 6757","image_url":"http://images.zoopla.co.uk/bac9bb3f0de4b23f79a9868a5ee7f2e8e63d6e72_354_255.jpg","price":"285","county":"London","listing_id":"14052546"},{"image_caption":"Main Image","num_floors":"0","listing_status":"rent","num_bedrooms":"1","agent_name":"Your Move - Bentley & Co","latitude":51.543034,"num_recepts":"0","agent_address":"63 Camden Road","property_type":"Flat","country":null,"longitude":-0.129322,"displayable_address":"St. Pauls Crescent, London NW1","floor_plan":[],"street_name":"St. Pauls Crescent","thumbnail_url":"http://images.zoopla.co.uk/ec06d74e8c46b50cdfb3c04e1563b87026451775_80_60.jpg","num_bathrooms":"0","description":"\n\nNW1 - ST Pauls Crescent - Camden ?-Available Now\n\nYour Move have the pleasure to market this brand new loft style apartment to the lettings market,\n\nProperty boats being newly refurbished throughout spacious reception area, good size large bedroom and fully fitted kitchen, property benefits from fully tiled bathroom and wooden flooring throughout,\n\nLocated on minutes from local amenities easy reach to Kings Cross & Camden, set with in a gated development with secure entrance perfect for a professional sharer or a company let,\n\nPlease call to arrange viewings straightaway on\n\n","post_town":"London","price_change":[{"date":"2011-03-09 17:30:33","price":"284"}],"details_url":"http://www.zoopla.co.uk/to-rent/details/14226414","agent_logo":"http://static.zoopla.co.uk/zoopla_static_agent_logo_(50305).jpeg","outcode":"NW1","agent_phone":"020 8166 1650","image_url":"http://images.zoopla.co.uk/ec06d74e8c46b50cdfb3c04e1563b87026451775_354_255.jpg","price":"284","county":"London","listing_id":"14226414"},{"image_caption":"","num_floors":"0","listing_status":"rent","num_bedrooms":"1","agent_name":"London Residential","latitude":51.542053,"num_recepts":"0","agent_address":"103 Parkway Camden ","property_type":"Flat","country":null,"longitude":-0.13375577,"displayable_address":"Agar Grove, Camden, London","floor_plan":[],"street_name":"Agar Grove Camden London","thumbnail_url":"http://images.zoopla.co.uk/203e23920f19ca482761061d4a0e4a9f359a39d8_80_60.jpg","num_bathrooms":"0","description":"Well presented one double bedroom apartment located on the top floor of a small block a short walk from Camden and benefitting from excellent transport links to central London. The property also benefits from wood floors through-out, separate modern fitted kitchen, quiet rear facing double bedroom with excellent storage, fully tiled bathroom with power shower, decent sized reception, neutral decor, separate storage locker and available furnished. The property is available from early April and would ideally suit a couple or single professional.\n\nBathroom\n\nBedroom\n\nProperty Ref:118_1338_1791185","post_town":"London","price_change":[{"date":"2010-05-11 21:56:59","price":"280"}],"details_url":"http://www.zoopla.co.uk/to-rent/details/4671523","agent_logo":"http://static.zoopla.co.uk/zoopla_static_agent_logo_(26919).gif","outcode":"NW1","agent_phone":"020 3318 6757","image_url":"http://images.zoopla.co.uk/203e23920f19ca482761061d4a0e4a9f359a39d8_354_255.jpg","price":"280","county":"London","listing_id":"4671523"},{"image_caption":"","num_floors":"0","listing_status":"rent","num_bedrooms":"1","agent_name":"Victor Stone","latitude":51.542053,"num_recepts":"0","agent_address":"90 Plender Street","property_type":"Flat","country":null,"longitude":-0.13375577,"displayable_address":"Agar Grove, London","floor_plan":[],"street_name":"Agar Grove London","thumbnail_url":"http://images.zoopla.co.uk/4bb0a118bc37d535efd82bdf2ae674db509bf359_80_60.jpg","num_bathrooms":"0","description":"Key features:\nSpacious double roomFitted kitchenetteFully tiled shower roomWood floorsNeutral decor throughoutInclusive of Gas, Water and Internet\n\nFull description:\nLocated on Agar Grove, this property is ideally located to Camden Town underground station and Camden High Street which offers a variety of trendy bars and restaurants.","post_town":"London","price_change":[{"date":"2011-03-10 19:32:17","price":"260"}],"details_url":"http://www.zoopla.co.uk/to-rent/details/14240857","agent_logo":"http://static.zoopla.co.uk/zoopla_static_agent_logo_(41845).jpeg","outcode":"NW1","agent_phone":"020 3318 7325","image_url":"http://images.zoopla.co.uk/4bb0a118bc37d535efd82bdf2ae674db509bf359_354_255.jpg","price":"260","county":"London","listing_id":"14240857"},{"image_caption":"","num_floors":"0","listing_status":"rent","num_bedrooms":"1","agent_name":"Regent 2000 Properties","latitude":51.542053,"num_recepts":"0","agent_address":"84B Camden Road Camden Town","property_type":"Flat","country":null,"longitude":-0.13375577,"displayable_address":"Agar Grove, London","floor_plan":[],"street_name":"Agar Grove","thumbnail_url":"http://images.zoopla.co.uk/d8d7f1a196ef54343e7d1bc112c085c994a41c3c_80_60.jpg","num_bathrooms":"1","description":"Beautiful one double bedroom flat in converted Victorian house in top floor, good size lounge with separate kitchen, fully fitted kitchen, close to Caledonian road Tube Station and Camden road train station and local amenities.","post_town":"London","price_change":[{"date":"2011-01-19 10:29:41","price":"250"}],"details_url":"http://www.zoopla.co.uk/to-rent/details/13891322","agent_logo":"http://static.zoopla.co.uk/zoopla_static_agent_logo_(40123).jpeg","outcode":"NW1","agent_phone":"020 3318 7173","image_url":"http://images.zoopla.co.uk/d8d7f1a196ef54343e7d1bc112c085c994a41c3c_354_255.jpg","price":"250","county":"London","listing_id":"13891322"},{"image_caption":"","num_floors":"0","listing_status":"rent","num_bedrooms":"1","agent_name":"Flatland London","latitude":51.542053,"num_recepts":"1","agent_address":"125 Gloucester Road","property_type":"Flat","country":null,"longitude":-0.13375577,"displayable_address":"Agar Grove, London","floor_plan":[],"street_name":"Agar Grove","thumbnail_url":"http://images.zoopla.co.uk/d7c70e1b33e80d7252f73e7ab5249fa3d84ccd97_80_60.jpg","num_bathrooms":"1","description":"Rare opportunity to snap up a fabulously refurbished single Bedsit with wooden floors. Extras such as wooden floors, free wireless internet connection and laundry facilities make this one a must. Ideally located in Agar Grove, Camden - close to transport and amenities. Bills included - electricity, heating, water, council tax excluded. Quote Ref - 46","post_town":"London","price_change":[{"date":"2009-11-05 17:51:25","price":"135"}],"details_url":"http://www.zoopla.co.uk/to-rent/details/2862892","agent_logo":null,"outcode":"NW1","agent_phone":"020 3318 6643","image_url":"http://images.zoopla.co.uk/d7c70e1b33e80d7252f73e7ab5249fa3d84ccd97_354_255.jpg","price":"135","county":"London","listing_id":"2862892"}],"street":null,"radius":"0.2","town":"","latitude":51.5445,"county":"London","postcode":"NW1 9XU","bounding_box":{"latitude_min":51.5416085866006,"longitude_min":-0.133884413399377,"longitude_max":-0.128101586600623,"latitude_max":51.5473914133994}}
@@ -0,0 +1 @@
1
+ {"result_count":9,"country":"England","area_name":null,"longitude":-0.130993,"listing":[],"street":null,"radius":"0.2","town":"","latitude":51.5445,"county":"London","postcode":"NW1 9XU","bounding_box":{"latitude_min":51.5416085866006,"longitude_min":-0.133884413399377,"longitude_max":-0.128101586600623,"latitude_max":51.5473914133994}}
@@ -225,6 +225,15 @@ class TestZooplaListings < Test::Unit::TestCase
225
225
  }
226
226
  end
227
227
 
228
+ def test_api_returns_wrong_result_count
229
+ @rentals.stubs(:call).returns([200, api_reply('wrong_result_count')], [200, api_reply('wrong_result_count2')])
230
+ yield_count = 0
231
+ @rentals.in({:postcode => 'SW1A 2AA'}).each{|l|
232
+ yield_count += 1
233
+ }
234
+ assert_equal 8, yield_count
235
+ end
236
+
228
237
  private
229
238
 
230
239
  def listing_parameter_test(param, value, result)
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: zoopla
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.2.2
5
+ version: 0.2.3
6
6
  platform: ruby
7
7
  authors:
8
8
  - Evgeny Shadchnev
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-03-06 00:00:00 +00:00
13
+ date: 2011-03-17 00:00:00 +00:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -97,6 +97,8 @@ files:
97
97
  - test/api_replies/postcode.js
98
98
  - test/api_replies/richlist.js
99
99
  - test/api_replies/suggestion.js
100
+ - test/api_replies/wrong_result_count.js
101
+ - test/api_replies/wrong_result_count2.js
100
102
  - test/api_replies/zed_index.js
101
103
  - test/helper.rb
102
104
  - test/test_api.rb
@@ -147,6 +149,8 @@ test_files:
147
149
  - test/api_replies/postcode.js
148
150
  - test/api_replies/richlist.js
149
151
  - test/api_replies/suggestion.js
152
+ - test/api_replies/wrong_result_count.js
153
+ - test/api_replies/wrong_result_count2.js
150
154
  - test/api_replies/zed_index.js
151
155
  - test/helper.rb
152
156
  - test/test_api.rb