Commit c4aafdc2 authored by Deepak's avatar Deepak

Added all documentation (**I guess**)

parent 5dae520a
......@@ -5,10 +5,12 @@
# PostCodes-io-java
UK Postcode Java API serving up Open Data http://postcodes.io
<h1>To Get JSON data</h1>
<b>1. [Lookup a Post Code] (https://github.com/spdeepak/postcodes-io-java#1-lookup-a-postcode)</b><br/>
<b>2. [Bulk lookup Post Codes](https://github.com/spdeepak/postcodes-io-java#2-bulk-lookup-postcodes)</b><br/>
<b>3. [Get nearest postcodes for a given longitude & latitude] (https://github.com/spdeepak/postcodes-io-java#3-get-nearest-postcodes-for-a-given-longitude--latitude)</b><br/>
<b>4. [Bulk Reverse Geocoding] (https://github.com/spdeepak/postcodes-io-java#4-bulk-reverse-geocoding)</b><br/>
<b>5. [Get a random postcode] ()
###1. Lookup a postcode
PostcodeLookup.postcode("BS347NP").asJson();
......@@ -35,4 +37,42 @@ UK Postcode Java API serving up Open Data http://postcodes.io
//Add Reverse to reverseList
reverseList.add(reverse);
PostcodeLookup.reverseGeocodings(reverseList).asJson()
\ No newline at end of file
PostcodeLookup.reverseGeocodings(reverseList).asJson();
###5. Get a random postcode
PostcodeLookup.randomPostcode().asJson();
####6. Validate a postcode
PostcodeLookup.isValid("ST42EU");
####7. Nearest postcodes for postcode
PostcodeLookup.nearestPostcode("ST4 2EU").asJson();
Limits number of postcodes matches to return based on <i>limit</i>. Defaults to 10. Needs to be less than 100.
PostcodeLookup.nearestPostcode("ST4 2EU").limit(20).asJson();
Limits number of postcodes matches to return based on <i>radius</i>. Defaults to 100m. Needs to be less than 2,000m.
PostcodeLookup.nearestPostcode("ST42EU").radius(100).asJson();
####8. Autocomplete a postcode partial
PostcodeLookup.autocomplete("ST4").asJson();
Limits number of postcodes matches to return based on <i>limit</i>. Defaults to 10. Needs to be less than 100.
PostcodeLookup.autocomplete("ST4").limit(20).asJson();
####9. Lookup Outward Code
PostcodeLookup.lookupOutwardCode("ST4").asJson();
####10. Nearest outward code for outward code
PostcodeLookup.nearestOutwardCode("ST4").asJson();
Limits number of postcodes matches to return based on <i>limit</i> based on <i>limit</i>. Defaults to 10. Needs to be less than 100.
PostcodeLookup.nearestOutwardCode("ST4").limit(5).asJson();
Limits number of postcodes matches to return based on <i>radius</i>. Defaults to 5,000m. Needs to be less than 25,000m.
PostcodeLookup.nearestOutwardCode("ST4").radius(20000).asJson();
\ No newline at end of file
......@@ -144,6 +144,9 @@ public class PostcodeLookupTest {
JSONAssert.assertEquals(
Unirest.get("https://api.postcodes.io/outcodes//nearest").asJson().getBody().getObject(),
PostcodeLookup.nearestOutwardCode("").asJson(), JSONCompareMode.STRICT);
assertEquals(5, PostcodeLookup.nearestOutwardCode("ST4").limit(5).asJson().getJSONArray("result").length());
assertEquals(10,
PostcodeLookup.nearestOutwardCode("ST4").radius(25000).asJson().getJSONArray("result").length());
}
@Test
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment