homeflow_api 0.14.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. data/.document +5 -0
  2. data/Gemfile +19 -0
  3. data/Gemfile.lock +55 -0
  4. data/LICENSE.txt +20 -0
  5. data/README.rdoc +19 -0
  6. data/Rakefile +46 -0
  7. data/VERSION +1 -0
  8. data/homeflow_api.gemspec +100 -0
  9. data/lib/homeflow/api.rb +72 -0
  10. data/lib/homeflow/api/agency.rb +9 -0
  11. data/lib/homeflow/api/branch.rb +9 -0
  12. data/lib/homeflow/api/collection.rb +22 -0
  13. data/lib/homeflow/api/county.rb +10 -0
  14. data/lib/homeflow/api/delete.rb +19 -0
  15. data/lib/homeflow/api/exceptions.rb +17 -0
  16. data/lib/homeflow/api/favourite_property.rb +13 -0
  17. data/lib/homeflow/api/lead.rb +13 -0
  18. data/lib/homeflow/api/location.rb +19 -0
  19. data/lib/homeflow/api/message.rb +13 -0
  20. data/lib/homeflow/api/password_reset.rb +13 -0
  21. data/lib/homeflow/api/place.rb +13 -0
  22. data/lib/homeflow/api/portal.rb +13 -0
  23. data/lib/homeflow/api/post.rb +24 -0
  24. data/lib/homeflow/api/postcode.rb +9 -0
  25. data/lib/homeflow/api/property.rb +10 -0
  26. data/lib/homeflow/api/put.rb +8 -0
  27. data/lib/homeflow/api/query.rb +85 -0
  28. data/lib/homeflow/api/queryable.rb +27 -0
  29. data/lib/homeflow/api/request.rb +48 -0
  30. data/lib/homeflow/api/request_specification.rb +11 -0
  31. data/lib/homeflow/api/resource.rb +27 -0
  32. data/lib/homeflow/api/resource_identifier.rb +19 -0
  33. data/lib/homeflow/api/response.rb +108 -0
  34. data/lib/homeflow/api/search.rb +14 -0
  35. data/lib/homeflow/api/session.rb +13 -0
  36. data/lib/homeflow/api/site.rb +9 -0
  37. data/lib/homeflow/api/site_page.rb +17 -0
  38. data/lib/homeflow/api/user.rb +21 -0
  39. data/spec/data/example_search_response.json +1 -0
  40. data/spec/data/invalid_api_key.json +1 -0
  41. data/spec/data/property_details.json +1 -0
  42. data/spec/data/with_alt_places.json +2 -0
  43. data/spec/homeflow_api_spec.rb +22 -0
  44. data/spec/query_spec.rb +38 -0
  45. data/spec/response_spec.rb +46 -0
  46. data/spec/spec_helper.rb +3 -0
  47. metadata +192 -0
@@ -0,0 +1,14 @@
1
+ module Homeflow
2
+ module API
3
+ class Search < Resource
4
+
5
+ is_resource :searches
6
+
7
+ def self.create(params)
8
+ Request.run_for(Homeflow::API::Post.new("/#{resource_uri}/", {}, params))
9
+ end
10
+
11
+
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,13 @@
1
+ module Homeflow
2
+ module API
3
+ class Session < Resource
4
+
5
+ is_resource :sessions
6
+
7
+ def self.create(params)
8
+ Request.run_for(Homeflow::API::Post.new("/#{resource_uri}/", {}, params))
9
+ end
10
+
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,9 @@
1
+ module Homeflow
2
+ module API
3
+ class Site < Resource
4
+
5
+ is_resource :sites
6
+
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,17 @@
1
+ module Homeflow
2
+ module API
3
+ class SitePage < Resource
4
+
5
+ is_resource :site_pages
6
+
7
+ def self.find_by_key_and_site_id(key, site_id)
8
+ Request.run_for(Homeflow::API::ResourceIdentifier.new("/sites/#{site_id}/pages/#{key}"))
9
+ end
10
+
11
+ def self.find_by_site_id(site_id)
12
+ Request.run_for(Homeflow::API::ResourceIdentifier.new("/sites/#{site_id}/pages"))
13
+ end
14
+
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,21 @@
1
+ module Homeflow
2
+ module API
3
+ class User < Resource
4
+
5
+ is_resource :users
6
+
7
+ def self.find(id, session_id, agency_id=nil)
8
+ Request.run_for(Homeflow::API::ResourceIdentifier.new("/#{resource_uri}/#{id}", :session_id => session_id, :agency_id => agency_id))
9
+ end
10
+
11
+ def self.create(params)
12
+ Request.run_for(Homeflow::API::Post.new("/#{resource_uri}/", {}, params))
13
+ end
14
+
15
+ def self.update(id, params)
16
+ Request.run_for(Homeflow::API::Put.new("/#{resource_uri}/#{id}", {}, params))
17
+ end
18
+
19
+ end
20
+ end
21
+ end
@@ -0,0 +1 @@
1
+ {"error":null,"query":{"page":"1","api_key":"7ea9bbb0771dd16679d20c9b27a0e97c","search":{"channel":"sales","min_price":"50000"},"action":"index","controller":"properties"},"result":{"properties":{"elements":[{"property_id":19021,"lat":null,"lng":null,"bedrooms":null,"bathrooms":null,"price":"\u00a350,000","photos":null,"new_home":null,"tags":null,"postcode":null,"short_description":null,"display_address":null,"resource_uri":"/properties/19021"},{"property_id":617507,"lat":null,"lng":null,"bedrooms":null,"bathrooms":null,"price":"Guide price \u00a350,000","photos":null,"new_home":null,"tags":null,"postcode":null,"short_description":null,"display_address":null,"resource_uri":"/properties/617507"},{"property_id":489457,"lat":null,"lng":null,"bedrooms":null,"bathrooms":null,"price":"Guide price \u00a350,000","photos":null,"new_home":null,"tags":null,"postcode":null,"short_description":null,"display_address":null,"resource_uri":"/properties/489457"},{"property_id":489477,"lat":null,"lng":null,"bedrooms":null,"bathrooms":null,"price":"Guide price \u00a350,000","photos":null,"new_home":null,"tags":null,"postcode":null,"short_description":null,"display_address":null,"resource_uri":"/properties/489477"},{"property_id":489703,"lat":null,"lng":null,"bedrooms":null,"bathrooms":null,"price":"Guide price \u00a350,000","photos":null,"new_home":null,"tags":null,"postcode":null,"short_description":null,"display_address":null,"resource_uri":"/properties/489703"},{"property_id":489825,"lat":null,"lng":null,"bedrooms":null,"bathrooms":null,"price":"\u00a350,000","photos":null,"new_home":null,"tags":null,"postcode":null,"short_description":null,"display_address":null,"resource_uri":"/properties/489825"},{"property_id":489910,"lat":null,"lng":null,"bedrooms":null,"bathrooms":null,"price":"Guide price \u00a350,000","photos":null,"new_home":null,"tags":null,"postcode":null,"short_description":null,"display_address":null,"resource_uri":"/properties/489910"},{"property_id":617540,"lat":null,"lng":null,"bedrooms":null,"bathrooms":null,"price":"Guide price \u00a350,000","photos":null,"new_home":null,"tags":null,"postcode":null,"short_description":null,"display_address":null,"resource_uri":"/properties/617540"},{"property_id":1229380,"lat":null,"lng":null,"bedrooms":null,"bathrooms":null,"price":"Offers over \u00a350,000","photos":null,"new_home":null,"tags":null,"postcode":null,"short_description":null,"display_address":null,"resource_uri":"/properties/1229380"},{"property_id":491343,"lat":null,"lng":null,"bedrooms":null,"bathrooms":null,"price":"Guide price \u00a350,000","photos":null,"new_home":null,"tags":null,"postcode":null,"short_description":null,"display_address":null,"resource_uri":"/properties/491343"},{"property_id":617820,"lat":null,"lng":null,"bedrooms":null,"bathrooms":null,"price":"\u00a350,000","photos":null,"new_home":null,"tags":null,"postcode":null,"short_description":null,"display_address":null,"resource_uri":"/properties/617820"},{"property_id":491753,"lat":null,"lng":null,"bedrooms":null,"bathrooms":null,"price":"Guide price \u00a350,000","photos":null,"new_home":null,"tags":null,"postcode":null,"short_description":null,"display_address":null,"resource_uri":"/properties/491753"},{"property_id":491991,"lat":null,"lng":null,"bedrooms":null,"bathrooms":null,"price":"Offers over \u00a350,000","photos":null,"new_home":null,"tags":null,"postcode":null,"short_description":null,"display_address":null,"resource_uri":"/properties/491991"},{"property_id":492051,"lat":null,"lng":null,"bedrooms":null,"bathrooms":null,"price":"Offers over \u00a350,000","photos":null,"new_home":null,"tags":null,"postcode":null,"short_description":null,"display_address":null,"resource_uri":"/properties/492051"},{"property_id":617830,"lat":null,"lng":null,"bedrooms":null,"bathrooms":null,"price":"Guide price \u00a350,000","photos":null,"new_home":null,"tags":null,"postcode":null,"short_description":null,"display_address":null,"resource_uri":"/properties/617830"},{"property_id":492160,"lat":null,"lng":null,"bedrooms":null,"bathrooms":null,"price":"Offers over \u00a350,000","photos":null,"new_home":null,"tags":null,"postcode":null,"short_description":null,"display_address":null,"resource_uri":"/properties/492160"},{"property_id":617871,"lat":null,"lng":null,"bedrooms":null,"bathrooms":null,"price":"Guide price \u00a350,000","photos":null,"new_home":null,"tags":null,"postcode":null,"short_description":null,"display_address":null,"resource_uri":"/properties/617871"},{"property_id":491407,"lat":null,"lng":null,"bedrooms":null,"bathrooms":null,"price":"Guide price \u00a350,000","photos":null,"new_home":null,"tags":null,"postcode":null,"short_description":null,"display_address":null,"resource_uri":"/properties/491407"},{"property_id":491414,"lat":null,"lng":null,"bedrooms":null,"bathrooms":null,"price":"Guide price \u00a350,000","photos":null,"new_home":null,"tags":null,"postcode":null,"short_description":null,"display_address":null,"resource_uri":"/properties/491414"},{"property_id":491475,"lat":null,"lng":null,"bedrooms":null,"bathrooms":null,"price":"Guide price \u00a350,000","photos":null,"new_home":null,"tags":null,"postcode":null,"short_description":null,"display_address":null,"resource_uri":"/properties/491475"},{"property_id":617814,"lat":null,"lng":null,"bedrooms":null,"bathrooms":null,"price":"Guide price \u00a350,000","photos":null,"new_home":null,"tags":null,"postcode":null,"short_description":null,"display_address":null,"resource_uri":"/properties/617814"},{"property_id":1009972,"lat":null,"lng":null,"bedrooms":null,"bathrooms":null,"price":"\u00a350,000","photos":null,"new_home":null,"tags":null,"postcode":null,"short_description":null,"display_address":null,"resource_uri":"/properties/1009972"},{"property_id":26243,"lat":null,"lng":null,"bedrooms":null,"bathrooms":null,"price":"\u00a350,000","photos":null,"new_home":null,"tags":null,"postcode":null,"short_description":null,"display_address":null,"resource_uri":"/properties/26243"},{"property_id":32113,"lat":null,"lng":null,"bedrooms":null,"bathrooms":null,"price":"\u00a350,000","photos":null,"new_home":null,"tags":null,"postcode":null,"short_description":null,"display_address":null,"resource_uri":"/properties/32113"},{"property_id":29394,"lat":null,"lng":null,"bedrooms":null,"bathrooms":null,"price":"\u00a350,000","photos":null,"new_home":null,"tags":null,"postcode":null,"short_description":null,"display_address":null,"resource_uri":"/properties/29394"},{"property_id":291814,"lat":null,"lng":null,"bedrooms":null,"bathrooms":null,"price":"Guide price \u00a350,000","photos":null,"new_home":null,"tags":null,"postcode":null,"short_description":null,"display_address":null,"resource_uri":"/properties/291814"},{"property_id":190358,"lat":null,"lng":null,"bedrooms":null,"bathrooms":null,"price":"Offers in excess of \u00a350,000","photos":null,"new_home":null,"tags":null,"postcode":null,"short_description":null,"display_address":null,"resource_uri":"/properties/190358"},{"property_id":395630,"lat":null,"lng":null,"bedrooms":null,"bathrooms":null,"price":"\u00a350,000","photos":null,"new_home":null,"tags":null,"postcode":null,"short_description":null,"display_address":null,"resource_uri":"/properties/395630"},{"property_id":1252794,"lat":null,"lng":null,"bedrooms":null,"bathrooms":null,"price":"\u00a350,000","photos":null,"new_home":null,"tags":null,"postcode":null,"short_description":null,"display_address":null,"resource_uri":"/properties/1252794"},{"property_id":402828,"lat":null,"lng":null,"bedrooms":null,"bathrooms":null,"price":"Guide price \u00a350,000","photos":null,"new_home":null,"tags":null,"postcode":null,"short_description":null,"display_address":null,"resource_uri":"/properties/402828"},{"property_id":802179,"lat":null,"lng":null,"bedrooms":null,"bathrooms":null,"price":"Offers in the region of \u00a350,000","photos":null,"new_home":null,"tags":null,"postcode":null,"short_description":null,"display_address":null,"resource_uri":"/properties/802179"},{"property_id":1132926,"lat":null,"lng":null,"bedrooms":null,"bathrooms":null,"price":"\u00a350,000","photos":null,"new_home":null,"tags":null,"postcode":null,"short_description":null,"display_address":null,"resource_uri":"/properties/1132926"},{"property_id":1267707,"lat":null,"lng":null,"bedrooms":null,"bathrooms":null,"price":"\u00a350,000","photos":null,"new_home":null,"tags":null,"postcode":null,"short_description":null,"display_address":null,"resource_uri":"/properties/1267707"},{"property_id":1130553,"lat":null,"lng":null,"bedrooms":null,"bathrooms":null,"price":"Guide price \u00a350,000","photos":null,"new_home":null,"tags":null,"postcode":null,"short_description":null,"display_address":null,"resource_uri":"/properties/1130553"},{"property_id":1130605,"lat":null,"lng":null,"bedrooms":null,"bathrooms":null,"price":"\u00a350,000","photos":null,"new_home":null,"tags":null,"postcode":null,"short_description":null,"display_address":null,"resource_uri":"/properties/1130605"},{"property_id":1117055,"lat":null,"lng":null,"bedrooms":null,"bathrooms":null,"price":"Offers in the region of \u00a350,000","photos":null,"new_home":null,"tags":null,"postcode":null,"short_description":null,"display_address":null,"resource_uri":"/properties/1117055"},{"property_id":1116855,"lat":null,"lng":null,"bedrooms":null,"bathrooms":null,"price":"Guide price \u00a350,000","photos":null,"new_home":null,"tags":null,"postcode":null,"short_description":null,"display_address":null,"resource_uri":"/properties/1116855"},{"property_id":1116917,"lat":null,"lng":null,"bedrooms":null,"bathrooms":null,"price":"Offers in the region of \u00a350,000","photos":null,"new_home":null,"tags":null,"postcode":null,"short_description":null,"display_address":null,"resource_uri":"/properties/1116917"},{"property_id":1168844,"lat":null,"lng":null,"bedrooms":null,"bathrooms":null,"price":"Guide price \u00a350,000","photos":null,"new_home":null,"tags":null,"postcode":null,"short_description":null,"display_address":null,"resource_uri":"/properties/1168844"},{"property_id":1120502,"lat":null,"lng":null,"bedrooms":null,"bathrooms":null,"price":"Guide price \u00a350,000","photos":null,"new_home":null,"tags":null,"postcode":null,"short_description":null,"display_address":null,"resource_uri":"/properties/1120502"},{"property_id":1221586,"lat":null,"lng":null,"bedrooms":null,"bathrooms":null,"price":"Guide price \u00a350,000","photos":null,"new_home":null,"tags":null,"postcode":null,"short_description":null,"display_address":null,"resource_uri":"/properties/1221586"},{"property_id":1126835,"lat":null,"lng":null,"bedrooms":null,"bathrooms":null,"price":"\u00a350,000","photos":null,"new_home":null,"tags":null,"postcode":null,"short_description":null,"display_address":null,"resource_uri":"/properties/1126835"},{"property_id":1128386,"lat":null,"lng":null,"bedrooms":null,"bathrooms":null,"price":"\u00a350,000","photos":null,"new_home":null,"tags":null,"postcode":null,"short_description":null,"display_address":null,"resource_uri":"/properties/1128386"},{"property_id":822900,"lat":null,"lng":null,"bedrooms":null,"bathrooms":null,"price":"\u00a350,000","photos":null,"new_home":null,"tags":null,"postcode":null,"short_description":null,"display_address":null,"resource_uri":"/properties/822900"},{"property_id":822906,"lat":null,"lng":null,"bedrooms":null,"bathrooms":null,"price":"\u00a350,000","photos":null,"new_home":null,"tags":null,"postcode":null,"short_description":null,"display_address":null,"resource_uri":"/properties/822906"},{"property_id":822952,"lat":null,"lng":null,"bedrooms":null,"bathrooms":null,"price":"\u00a350,000","photos":null,"new_home":null,"tags":null,"postcode":null,"short_description":null,"display_address":null,"resource_uri":"/properties/822952"},{"property_id":933283,"lat":null,"lng":null,"bedrooms":null,"bathrooms":null,"price":"\u00a350,000","photos":null,"new_home":null,"tags":null,"postcode":null,"short_description":null,"display_address":null,"resource_uri":"/properties/933283"},{"property_id":569703,"lat":null,"lng":null,"bedrooms":null,"bathrooms":null,"price":"Offers in the region of \u00a350,000","photos":null,"new_home":null,"tags":null,"postcode":null,"short_description":null,"display_address":null,"resource_uri":"/properties/569703"},{"property_id":569753,"lat":null,"lng":null,"bedrooms":null,"bathrooms":null,"price":"Offers in the region of \u00a350,000","photos":null,"new_home":null,"tags":null,"postcode":null,"short_description":null,"display_address":null,"resource_uri":"/properties/569753"},{"property_id":569809,"lat":null,"lng":null,"bedrooms":null,"bathrooms":null,"price":"Offers in the region of \u00a350,000","photos":null,"new_home":null,"tags":null,"postcode":null,"short_description":null,"display_address":null,"resource_uri":"/properties/569809"}]},"search":{"saved":false,"run_at":"2012-01-03T12:18:30+00:00"}},"response":{"status":200,"time_taken":99.705506}}
@@ -0,0 +1 @@
1
+ {"error":{"type":"APIArgumentError","message":"api_key was invalid"},"query":{"page":"1","api_key":"7ea9bbb0771dd16679d20c9b27a0e97csearch[channel]=sales","search":{"min_price":"50000"},"action":"index","controller":"properties"},"result":{},"response":{"status":400,"time_taken":41.683496}}
@@ -0,0 +1 @@
1
+ {"error":null,"query":{"page":"1","api_key":"7ea9bbb0771dd16679d20c9b27a0e97c","search":{"channel":"sales","min_price":"50000"},"action":"show","controller":"properties","id":"2115816"},"result":{"property":{"property_id":2115816,"lat":51.6263999939,"lng":-3.4671499729,"bedrooms":3,"bathrooms":null,"price":"Guide price \u00a350,000","photos":["files/photo/image/2774/9249/120x90/1054_DAR105407230_IMG_01.jpg","files/photo/image/2774/9250/120x90/1054_DAR105407230_IMG_02.jpg","files/photo/image/2774/9251/120x90/1054_DAR105407230_IMG_03.jpg","files/photo/image/2774/9252/120x90/1054_DAR105407230_IMG_04.jpg","files/photo/image/2774/9248/120x90/1054_DAR105407230_IMG_00.jpg"],"new_home":false,"tags":["garden","coastal"],"postcode":"CF40 2RS","short_description":"PRICE GUIDE \u00a350,000 - \u00a360,000 This ideal starter home in Blaen Clydach could be perfect to get your foot on the ladder. Offering open plan lounge, kitchen, bathroom and three bedrooms. There's no chain!","display_address":"Maddox Street","resource_uri":"/properties/2115816","agency":{"agency_name":"Darlows","agency_id":1812,"resource_uri":"/agencies/1812"}}},"response":{"status":200,"time_taken":609.7523209999999}}
@@ -0,0 +1,2 @@
1
+
2
+ {"error":null,"query":{"page":"1","search_options":{"fuzzy_pages":"true"},"search":{"channel":"sales"},"api_key":"7ea9bbb0771dd16679d20c9b27a0e97c","action":"index","controller":"properties"},"result":{"alternative_places":{"counties":{"elements":[{"name":"Brighton and Hove","place_id":"4f199f8e723cb735bb8ac199","resource_uri":"/counties/9","url_label":"brighton-and-hove"}]},"locations":{"elements":[{"lat":50.83,"lng":-0.14,"name":"Brighton","place_id":"4f199f8e723cb735bb8ac19b","url_label":"brighton","postcode":"BN2","approximate_property_count":9749,"county":{"name":"Brighton and Hove","place_id":"4f199f8e723cb735bb8ac199","resource_uri":"/counties/9","url_label":"brighton-and-hove"},"resource_uri":"/counties/9/locations/3265"},{"lat":50.22,"lng":-4.96,"name":"Brighton","place_id":"4f199f95723cb735bb8ac84a","url_label":"brighton","postcode":"TR2","approximate_property_count":2662,"county":{"name":"Cornwall","place_id":"4f199f94723cb735bb8ac81e","resource_uri":"/counties/23","url_label":"cornwall"},"resource_uri":"/counties/23/locations/3264"},{"lat":53.43,"lng":-3.03,"name":"New Brighton","place_id":"4f199de3723cb735bb8a8f32","url_label":"new-brighton","postcode":"CH45","approximate_property_count":793,"county":{"name":"Merseyside","place_id":"4f199de3723cb735bb8a8efc","resource_uri":"/counties/68","url_label":"merseyside"},"resource_uri":"/counties/68/locations/16109"},{"lat":50.96,"lng":-0.87,"name":"New Brighton","place_id":"4f199dad723cb735bb8a7cde","url_label":"new-brighton","postcode":"PO10","approximate_property_count":546,"county":{"name":"Hampshire","place_id":"4f199fc2723cb735bb8ae1f3","resource_uri":"/counties/55","url_label":"hampshire"},"resource_uri":"/counties/55/locations/16108"}]}},"properties":{"has_next":true,"elements":[{"property_id":2399874,"lat":50.83079205,"lng":-0.139064939,"bedrooms":3,"price":"Offers in the region of \u00a3400,000","postcode":"BN1 4GS","short_description":"380,000 to 400,000. An excellent opportunity to purchase this duplex style penthouse apartment on two floors with two balcony''s offering panoramic city views. This unique high specification apartment forms part of this popular city point development with other benefits including three bedrooms, two bathrooms and superb fitted kitchen. City Points is located in the Central/Brighton North Laine close to the mainline railway station. The North Laine boasts some of the best dining in the city along with many popular theatres and clubs close by. The main shopping malls are also within easy reach....","display_address":"Fleet Street, Brighton BN1","resource_uri":"/properties/2399874","agency":{"agency_name":"Your Move","agency_id":1176,"resource_uri":"/agencies/1176"}},{"property_id":1225084,"lat":50.8429985046,"lng":-0.1440690011,"bedrooms":3,"price":"\u00a3375,000","postcode":"BN1 6HG","short_description":"A well presented large 3 bedroom first floor apartment in a desirable location, with off road parking, a double garage and fantastic views over Preston Park. Ideally situated for Preston Park mainline station.","display_address":"Preston Park Avenue Brighton, East Sussex BN1","resource_uri":"/properties/1225084","agency":{"agency_name":"Winkworth","agency_id":293,"resource_uri":"/agencies/293"}},{"property_id":1927246,"vox_number":"441273434458","lat":50.8292999268,"lng":-0.1332489997,"bedrooms":5,"price":"\u00a3975,000","postcode":"BN2 9SA","short_description":"A sympathetically restored five bedroom, three reception room Regency town house situated in a central location, close to the seafront and Brighton mainline station, ideal for commuters. The property has a wealth of period features and a private walled garden set over two levels. There is resid...","display_address":"Richmond Terrace, BRIGHTON, East Sussex","resource_uri":"/properties/1927246","agency":{"agency_name":"Brand Vaughan","agency_id":1299,"resource_uri":"/agencies/1299"}},{"property_id":2345688,"lat":50.8292999268,"lng":-0.1332489997,"bedrooms":5,"price":"\u00a3975,000","postcode":"BN2 9SA","short_description":"A fine example of an elegant five bedroom, three reception room town house set moments from the North Lanes and Brighton Station providing commuters with quick and easy access to the capital. Located a stroll away from Hanover Crescent-one of Brighton's most sought after private (contd...)","display_address":"Richmond Terrace, Brighton, East Sussex, BN2","resource_uri":"/properties/2345688","agency":{"agency_name":"Winkworth","agency_id":293,"resource_uri":"/agencies/293"}},{"property_id":1225045,"lat":50.8292999268,"lng":-0.1332489997,"bedrooms":5,"price":"\u00a31,100,000","postcode":"BN2 9SA","short_description":"A sympathetically restored five bedroom, three reception room Regency town house in a central location, close to station and seafront. With a wealth of period features and a private walled garden set over two levels. This property was built by Amon Wilds in 1818 and is a rare surviving example of his work.","display_address":"Richmond Terrace Brighton, East Sussex BN2","resource_uri":"/properties/1225045","agency":{"agency_name":"Winkworth","agency_id":293,"resource_uri":"/agencies/293"}},{"property_id":2508597,"lat":50.832901001,"lng":-0.1359439939,"bedrooms":2,"price":"Offers in excess of \u00a3223,000","postcode":"BN1 4JL","short_description":"Period style cottage. Short stroll from station. \n2 double bedrooms, central heating. \nPaved secluded garden. Ground floor bathroom.","display_address":"Brighton, East Sussex","resource_uri":"/properties/2508597","agency":{"agency_name":"Cubitt & West","agency_id":930,"resource_uri":"/agencies/930"}},{"property_id":3198739,"lat":50.8265991211,"lng":-0.1347759962,"bedrooms":1,"price":"\u00a3159,950","postcode":"BN2 9QB","short_description":"Immaculate one bedroom apartment. \nModernised and well presented, ideal first time buy. \nOpposite Victoria Gardens, walk to city and railway station","display_address":"Brighton, East Sussex","resource_uri":"/properties/3198739","agency":{"agency_name":"Cubitt & West","agency_id":930,"resource_uri":"/agencies/930"}},{"property_id":1750069,"lat":50.8265991211,"lng":-0.1347759962,"bedrooms":1,"bathrooms":1,"price":"\u00a3149,995","postcode":"BN2 9QB","short_description":"\n \n 1 Bedroom City Centre Apartment\n \n \n Within Easy Reach Of Station &amp; Seafront\n \n \n Views Across Victoria Gardens\n \n \n Close To The North Laines\n \n\n","display_address":"Grand Parade, Brighton, East Sussex","resource_uri":"/properties/1750069","agency":{"agency_name":"Tingleys","agency_id":3770,"resource_uri":"/agencies/3770"}},{"property_id":2465278,"vox_number":"441273434458","lat":50.8240013123,"lng":-0.1363019943,"bedrooms":3,"price":"\u00a3400,000","postcode":"BN2 9JA","short_description":"Fantastic 3 bedroom, 2 bathroom, 3rd floor apartment boasting rarely available parking space and good sized living space over1082 sq ft with a south east facing balcony. Royal View is a prominent contemporary building constructed within the last 7 years, designed to blend with its historic surro...","display_address":"Royal View, Grand Parade, BRIGHTON, East Sussex","resource_uri":"/properties/2465278","agency":{"agency_name":"Brand Vaughan","agency_id":1299,"resource_uri":"/agencies/1299"}},{"property_id":2874336,"vox_number":"441273434458","lat":50.8240013123,"lng":-0.1363019943,"bedrooms":2,"price":"\u00a3250,000","postcode":"BN2 9JA","short_description":"2 bedroom, 2 bathroom, ground and lower ground floor duplex apartment with south facing balcony and courtyard patio area leading from bedroom 1. Royal View is a prominent contemporary building constructed within the last 6 years, designed to blend with its historic surroundings. The internal co...","display_address":"Grand Parade, BRIGHTON, East Sussex","resource_uri":"/properties/2874336","agency":{"agency_name":"Brand Vaughan","agency_id":1299,"resource_uri":"/agencies/1299"}},{"property_id":2637446,"lat":50.8231010437,"lng":-0.1420139968,"bedrooms":2,"price":"\u00a3525,000","postcode":"BN1 1RQ","short_description":"29ft luxury living space situated in the heart of the City Centre. 2 bedrooms with 2 bathrooms can be found with this duplex apartment. Benefits include; sun terrace, patio garden, lift access and secure underground parking. A perfect lock and up leave.","display_address":"Portland Street, Brighton, East Sussex, BN1","resource_uri":"/properties/2637446","agency":{"agency_name":"Winkworth","agency_id":293,"resource_uri":"/agencies/293"}},{"property_id":3127829,"vox_number":"441273434458","lat":50.8266983032,"lng":-0.1418720037,"bedrooms":2,"price":"\u00a3325,000","postcode":"BN1 4UJ","short_description":"Price Guide \u00a3325,000 - \u00a3335,000. Stunning ground floor duplex loft style apartment, with private walled patio garden, offering a contemporary feel and which has been designed for modern living in the heart of Brighton. The 'Ocean Building' was formerly an office block, developed into luxury apa...","display_address":"The Ocean Building, 18-20 Frederick Street, Brighton","resource_uri":"/properties/3127829","agency":{"agency_name":"Brand Vaughan","agency_id":1299,"resource_uri":"/agencies/1299"}},{"property_id":2186321,"lat":50.8266983032,"lng":-0.1404519975,"bedrooms":2,"price":"\u00a3785,000","postcode":"BN1 4AY","short_description":"Top floor apartment situated in heart of North Laine. 2 beds, 2 receptions, 3 baths, fabulous roof terrace, city views","display_address":"Argus Lofts, Robert Street, Brighton, East Sussex, BN1","resource_uri":"/properties/2186321","agency":{"agency_name":"Hamptons","agency_id":1838,"resource_uri":"/agencies/1838"}},{"property_id":1228173,"lat":50.8240013123,"lng":-0.139139995,"bedrooms":2,"price":"\u00a3525,000","postcode":"BN1 1RD","short_description":"A light and airy 2 bedroom top floor apartment situated in Central Brighton offering direct, stunning views of the famous Pavilion. This well presented apartment offers 2 double bedrooms, 2 bathrooms and large living space. The property benefits from lift access, a west facing balcony and underground parking. ","display_address":"Glass Pavillion Brighton, East Sussex BN1","resource_uri":"/properties/1228173","agency":{"agency_name":"Winkworth","agency_id":293,"resource_uri":"/agencies/293"}},{"property_id":2988210,"lat":50.831523,"lng":-0.139220481,"bedrooms":1,"price":"\u00a3210,000","postcode":"BN1 4ZB","short_description":"An opportunity to acquire this third floor one bedroom modern apartment, situated in a central Brighton location within easy walking distance of Brighton main line station and City centre. The property offers one bedroom, large lounge/kitchen, bathroom/w.c. wood effect flooring, triple glazing where stated and hot air heat exchange....","display_address":"Stroudley Road, Brighton BN1","resource_uri":"/properties/2988210","agency":{"agency_name":"Your Move","agency_id":1176,"resource_uri":"/agencies/1176"}},{"property_id":2600027,"lat":50.8284988403,"lng":-0.1418000013,"bedrooms":2,"price":"From \u00a3280,000","postcode":"BN1 3PA","short_description":"Price Range: \u00a3280,000 - \u00a3290,000\n2 Bedroom period terraced house. \nRefurbished throughout, converted loft room. \nThrough lounge/diner, front & rear gardens","display_address":"Brighton, East Sussex","resource_uri":"/properties/2600027","agency":{"agency_name":"Cubitt & West","agency_id":930,"resource_uri":"/agencies/930"}},{"property_id":3111768,"lat":50.8327289,"lng":-0.140961887,"bedrooms":3,"price":"\u00a3550,000","postcode":"BN1 4BH","short_description":"Contemporary architect designed eco-friendly townhouse conveniently situated just moments from Brighton Station and within arguably the city's trendiest neighbourhood. Occupying an elevated position, the house offers spectacular panoramic views of both the South Downs and surrounding (contd...)","display_address":"Stroudley Road, Brighton, East Sussex, BN1","resource_uri":"/properties/3111768","agency":{"agency_name":"Winkworth","agency_id":293,"resource_uri":"/agencies/293"}},{"property_id":3111932,"lat":50.8327289,"lng":-0.140961887,"bedrooms":3,"price":"\u00a3550,000","postcode":"BN1 4BH","short_description":"A very well presented 3 bedroom, 3 storey modern town house benefiting for 3 separate outside terraces and being a very short walk to Brighton Station.","display_address":"Stroudley Road, Brighton, East Sussex, BN1","resource_uri":"/properties/3111932","agency":{"agency_name":"Hamptons","agency_id":1838,"resource_uri":"/agencies/1838"}},{"property_id":3121170,"lat":50.83017205,"lng":-0.138535775,"bedrooms":4,"price":"\u00a3625,000","postcode":"BN1 4GJ","short_description":"An end of terrace four storey town house comprising of four bedrooms; two with en-suite, separate bathroom/WC, separate WC, lounge/dining room, kitchen/breakfast room, front and rear gardens and roof terrace. The property comes with the option of being furnished....","display_address":"Kingscote Way, Brighton BN1","resource_uri":"/properties/3121170","agency":{"agency_name":"Your Move","agency_id":1176,"resource_uri":"/agencies/1176"}},{"property_id":3170063,"lat":50.83079205,"lng":-0.139064939,"bedrooms":2,"price":"\u00a3695,000","postcode":"BN1 4GS","short_description":"Top floor central apartment with two bedroom and two bathrooms Fabulous roof terrace with spectacular views across the city.","display_address":"Stepney Court, 12 Fleet Street, Brighton, East Sussex, BN1","resource_uri":"/properties/3170063","agency":{"agency_name":"Hamptons","agency_id":1838,"resource_uri":"/agencies/1838"}},{"property_id":3291723,"lat":50.8349990845,"lng":-0.1500670016,"bedrooms":4,"price":"\u00a3775,000","postcode":"BN1 5PA","short_description":"Semi detached house with four dble bedrooms with en-suite facilities, spacious living accommodation, lower ground floor TV media room, off road parking.","display_address":"Dyke Road, Brighton, East Sussex, BN1","resource_uri":"/properties/3291723","agency":{"agency_name":"Hamptons","agency_id":1838,"resource_uri":"/agencies/1838"}},{"property_id":1424191,"lat":50.8339004517,"lng":-0.1415860057,"bedrooms":4,"price":"From \u00a3330,000","postcode":"BN1 4QB","short_description":"Price Range: \u00a3330,000 - \u00a3350,000\n4 bedroom Victorian townhouse. \nFlat patio and lawned garden, convenient location. \nVersatile accommodation, close to Brighton station.","display_address":"Brighton, East Sussex","resource_uri":"/properties/1424191","agency":{"agency_name":"Cubitt & West","agency_id":930,"resource_uri":"/agencies/930"}},{"property_id":2346134,"vox_number":"441273434458","lat":50.8250007629,"lng":-0.1462000012,"bedrooms":4,"price":"\u00a3449,950","postcode":"BN1 3ED","short_description":"This charming and stylish 4 bedroom period home, with accommodation arranged over 4 floors, offers city living with rarely available sun terrace and rear patio garden and is ideally located in the heart of the city and within the Clifton/Montpelier conservation area. The property, which is well p...","display_address":"Regent Hill, Brighton, East Sussex","resource_uri":"/properties/2346134","agency":{"agency_name":"Brand Vaughan","agency_id":1299,"resource_uri":"/agencies/1299"}},{"property_id":2787124,"lat":50.8268013,"lng":-0.147548005,"bedrooms":4,"price":"\u00a3975,000","postcode":"BN1 3HF","short_description":"A rare opportunity to acquire a 4 bedroom villa situated in the one of Brighton's finest locations. Amazingly versatile accommodation with charm and character gracing the entire property. One can find extensive sea and city views from the top of the house and a delightful patio garden (contd...)","display_address":"Powis Grove, Brighton, East Sussex, BN1","resource_uri":"/properties/2787124","agency":{"agency_name":"Winkworth","agency_id":293,"resource_uri":"/agencies/293"}},{"property_id":2763380,"lat":50.8268013,"lng":-0.1447100043,"bedrooms":2,"price":"\u00a3220,000","postcode":"BN1 3RB","short_description":"A two bedroom first floor converted flat situated in the vicinity to access Brighton mainline station and Brighton city centre. Offering two double bedrooms, good sized lounge, separate kitchen and bathroom/w.c. No chain...","display_address":"Buckingham Road, Brighton BN1","resource_uri":"/properties/2763380","agency":{"agency_name":"Your Move","agency_id":1176,"resource_uri":"/agencies/1176"}}]},"search":{"saved":false,"run_at":"2012-02-07T15:31:16+00:00","min_price":null,"max_price":null},"location":{"lat":50.83,"lng":-0.14,"name":"Brighton","place_id":"4f199f8e723cb735bb8ac19b","url_label":"brighton","postcode":"BN2","approximate_property_count":9749,"county":{"name":"Brighton and Hove","place_id":"4f199f8e723cb735bb8ac199","resource_uri":"/counties/9","url_label":"brighton-and-hove"},"resource_uri":"/counties/9/locations/3265"},"county":{}},"response":{"status":200,"time_taken":10088.192212}}
@@ -0,0 +1,22 @@
1
+ require 'spec_helper'
2
+ describe Homeflow::API do
3
+
4
+ context "when setting up" do
5
+
6
+ it "should provide a config block" do
7
+
8
+ Homeflow::API.configure do |config|
9
+ config.api_key = "test api key"
10
+ end
11
+
12
+ Homeflow::API.configuration.api_key.should == "test api key"
13
+
14
+ end
15
+
16
+ it "should provide setters" do
17
+ Homeflow::API.configuration.api_key = "test api key"
18
+ Homeflow::API.configuration.api_key.should == "test api key"
19
+ end
20
+
21
+ end
22
+ end
@@ -0,0 +1,38 @@
1
+ require 'spec_helper'
2
+
3
+ describe Homeflow::API::Queryable do
4
+ context "When used by a class" do
5
+
6
+ it "should provide a where method generating a query" do
7
+ query = Homeflow::API::Property.where(:test => :argument)
8
+ query.class.should == Homeflow::API::Query
9
+ query.query.should == {:test => :argument}
10
+ end
11
+
12
+ it "should cause the implementing class to recive a message on execute" do
13
+ query = Homeflow::API::Property.where(:test => :argument)
14
+ Homeflow::API::Property.should_receive(:execute).with(query)
15
+ query.results
16
+ end
17
+
18
+ end
19
+ end
20
+
21
+
22
+ describe Homeflow::API::Resource do
23
+ context "When inhereted by a class" do
24
+
25
+ it "should cause the implementing class to recive a message when find is called" do
26
+ data = JSON.parse(File.read(File.dirname(__FILE__) + '/data/property_details.json'))
27
+ Homeflow::API::Request.any_instance.should_receive(:perform).and_return(data)
28
+ property = Homeflow::API::Property.find(2).property
29
+ property.class.should == Homeflow::API::Property
30
+ end
31
+
32
+
33
+ it "should provide uri" do
34
+ Homeflow::API::Property.resource_uri.should == 'properties'
35
+ end
36
+
37
+ end
38
+ end
@@ -0,0 +1,46 @@
1
+ require 'spec_helper'
2
+
3
+ describe Homeflow::API::Response do
4
+ context "A Respose Object" do
5
+ it "should raise an exeption when given an invalid response" do
6
+ error = %~<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
7
+ <HTML>
8
+ <HEAD><TITLE>Internal Server Error</TITLE></HEAD>
9
+ <BODY>
10
+ <H1>Internal Server Error</H1>
11
+ undefined method `debug_rjs=' for ActionView::Base:Class
12
+ <HR>
13
+ <ADDRESS>
14
+ WEBrick/1.3.1 (Ruby/1.9.3/2011-10-30) at
15
+ localhost:3000
16
+ </ADDRESS>
17
+ </BODY>
18
+ </HTML>
19
+ %~
20
+ expect {Homeflow::API::Response.new_from_json(error)}.to raise_error(Homeflow::API::Exceptions::InvalidResponse)
21
+ end
22
+
23
+
24
+ it "should correctly produce alturnative locations" do
25
+ file = File.read(File.dirname(__FILE__) + '/data/with_alt_places.json')
26
+ response = Homeflow::API::Response.new_from_json(file)
27
+ response.respond_to?(:alternative_places).should == true
28
+ end
29
+
30
+ it "should raise the correct error when the wrong api key is given, with a message" do
31
+ file = File.read(File.dirname(__FILE__) + '/data/invalid_api_key.json')
32
+ expect {Homeflow::API::Response.new_from_json(file)}.to raise_error(Homeflow::API::Exceptions::APIArgumentError)
33
+ end
34
+
35
+
36
+ it "should be able to be created from a homeflow api response" do
37
+ file = File.read(File.dirname(__FILE__) + '/data/example_search_response.json')
38
+ response = Homeflow::API::Response.new_from_json(file)
39
+ response.respond_to?(:properties).should == true
40
+ response.properties.is_a?(Homeflow::API::Collection).should == true
41
+ response.respond_to?(:alternative_places).should == false
42
+ response.properties.first.is_a?(Homeflow::API::Property).should == true
43
+ end
44
+
45
+ end
46
+ end
@@ -0,0 +1,3 @@
1
+ require File.dirname(__FILE__) + '/../lib/homeflow/api'
2
+ require 'rspec'
3
+ require 'json'
metadata ADDED
@@ -0,0 +1,192 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: homeflow_api
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.14.3
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Daniel Cooper
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-03-06 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: hashie
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '1.1'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '1.1'
30
+ - !ruby/object:Gem::Dependency
31
+ name: json
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: httparty
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: shoulda
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ - !ruby/object:Gem::Dependency
79
+ name: bundler
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ type: :development
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ - !ruby/object:Gem::Dependency
95
+ name: jeweler
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ~>
100
+ - !ruby/object:Gem::Version
101
+ version: 1.6.4
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ~>
108
+ - !ruby/object:Gem::Version
109
+ version: 1.6.4
110
+ description: A gem for dealing the homeflow api
111
+ email: daniel@homeflow.co.uk
112
+ executables: []
113
+ extensions: []
114
+ extra_rdoc_files:
115
+ - LICENSE.txt
116
+ - README.rdoc
117
+ files:
118
+ - .document
119
+ - Gemfile
120
+ - Gemfile.lock
121
+ - LICENSE.txt
122
+ - README.rdoc
123
+ - Rakefile
124
+ - VERSION
125
+ - homeflow_api.gemspec
126
+ - lib/homeflow/api.rb
127
+ - lib/homeflow/api/agency.rb
128
+ - lib/homeflow/api/branch.rb
129
+ - lib/homeflow/api/collection.rb
130
+ - lib/homeflow/api/county.rb
131
+ - lib/homeflow/api/delete.rb
132
+ - lib/homeflow/api/exceptions.rb
133
+ - lib/homeflow/api/favourite_property.rb
134
+ - lib/homeflow/api/lead.rb
135
+ - lib/homeflow/api/location.rb
136
+ - lib/homeflow/api/message.rb
137
+ - lib/homeflow/api/password_reset.rb
138
+ - lib/homeflow/api/place.rb
139
+ - lib/homeflow/api/portal.rb
140
+ - lib/homeflow/api/post.rb
141
+ - lib/homeflow/api/postcode.rb
142
+ - lib/homeflow/api/property.rb
143
+ - lib/homeflow/api/put.rb
144
+ - lib/homeflow/api/query.rb
145
+ - lib/homeflow/api/queryable.rb
146
+ - lib/homeflow/api/request.rb
147
+ - lib/homeflow/api/request_specification.rb
148
+ - lib/homeflow/api/resource.rb
149
+ - lib/homeflow/api/resource_identifier.rb
150
+ - lib/homeflow/api/response.rb
151
+ - lib/homeflow/api/search.rb
152
+ - lib/homeflow/api/session.rb
153
+ - lib/homeflow/api/site.rb
154
+ - lib/homeflow/api/site_page.rb
155
+ - lib/homeflow/api/user.rb
156
+ - spec/data/example_search_response.json
157
+ - spec/data/invalid_api_key.json
158
+ - spec/data/property_details.json
159
+ - spec/data/with_alt_places.json
160
+ - spec/homeflow_api_spec.rb
161
+ - spec/query_spec.rb
162
+ - spec/response_spec.rb
163
+ - spec/spec_helper.rb
164
+ homepage: http://github.com/homeflow/Homeflow_Api
165
+ licenses:
166
+ - MIT
167
+ post_install_message:
168
+ rdoc_options: []
169
+ require_paths:
170
+ - lib
171
+ required_ruby_version: !ruby/object:Gem::Requirement
172
+ none: false
173
+ requirements:
174
+ - - ! '>='
175
+ - !ruby/object:Gem::Version
176
+ version: '0'
177
+ segments:
178
+ - 0
179
+ hash: -3639239557768772355
180
+ required_rubygems_version: !ruby/object:Gem::Requirement
181
+ none: false
182
+ requirements:
183
+ - - ! '>='
184
+ - !ruby/object:Gem::Version
185
+ version: '0'
186
+ requirements: []
187
+ rubyforge_project:
188
+ rubygems_version: 1.8.24
189
+ signing_key:
190
+ specification_version: 3
191
+ summary: Homeflow API Gem
192
+ test_files: []