google-maps-geocoding 0.1.0.0 → 0.1.0.1
raw patch · 5 files changed
+105/−77 lines, 5 filessetup-changedPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- LICENSE +29/−29
- Setup.hs +2/−2
- changelog.md +9/−0
- google-maps-geocoding.cabal +36/−31
- src/Web/Google/Maps/Geocoding.hs +29/−15
LICENSE view
@@ -1,30 +1,30 @@-Copyright Mike Pilgrem (c) 2017--All rights reserved.--Redistribution and use in source and binary forms, with or without-modification, are permitted provided that the following conditions are met:-- * Redistributions of source code must retain the above copyright- notice, this list of conditions and the following disclaimer.-- * Redistributions in binary form must reproduce the above- copyright notice, this list of conditions and the following- disclaimer in the documentation and/or other materials provided- with the distribution.-- * Neither the name of Mike Pilgrem nor the names of other- contributors may be used to endorse or promote products derived- from this software without specific prior written permission.--THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+Copyright Mike Pilgrem (c) 2017 + +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + * Neither the name of Mike Pilgrem nor the names of other + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Setup.hs view
@@ -1,2 +1,2 @@-import Distribution.Simple-main = defaultMain+import Distribution.Simple +main = defaultMain
+ changelog.md view
@@ -0,0 +1,9 @@+# 0.1.0.1 + +* Changes to documentation only + +# 0.1.0.0 + +* Launch implementation. The 'components' and optional parameters in a geocoding + request are not yet implemented. The reverse geocoding request is not yet + implemented.
google-maps-geocoding.cabal view
@@ -1,31 +1,36 @@-name: google-maps-geocoding-version: 0.1.0.0-synopsis: Google Maps Geocoding API bindings-description: The Google Maps Geocoding API provides a direct way to- access geocoding and reverse geocoding services via an HTTP- request.-homepage: https://github.com/mpilgrem/google-maps-geocoding#readme-bug-reports: https://github.com/mpilgrem/google-maps-geocoding/issues-license: BSD3-license-file: LICENSE-author: Mike Pilgrem-maintainer: public@pilgrem.com-copyright: Mike Pilgrem-category: Web-build-type: Simple-cabal-version: >=1.10--library- hs-source-dirs: src- exposed-modules: Web.Google.Maps.Geocoding- build-depends: base >= 4.7 && < 5- , aeson >= 1.0 && < 1.1- , http-client >= 0.5 && < 0.6- , servant >= 0.9 && < 0.10- , servant-client >= 0.9 && <0.10- , text >= 1.2 && < 1.3- default-language: Haskell2010--source-repository head- type: git- location: https://github.com/mpilgrem/google-maps-geocoding.git+name: google-maps-geocoding +version: 0.1.0.1 +synopsis: Google Maps Geocoding API bindings +description: The Google Maps Geocoding API provides a direct way to + access geocoding and reverse geocoding services via an HTTP + request. This library package provides bindings in Haskell + to that API. NB: The use of the API's services is subject + to the Google Maps APIs Terms of Service, which terms + restrict the use of content (eg no use without a Google + map). +homepage: https://github.com/mpilgrem/google-maps-geocoding#readme +bug-reports: https://github.com/mpilgrem/google-maps-geocoding/issues +license: BSD3 +license-file: LICENSE +author: Mike Pilgrem +maintainer: public@pilgrem.com +copyright: Mike Pilgrem +category: Web +build-type: Simple +extra-source-files: changelog.md +cabal-version: >=1.10 + +library + hs-source-dirs: src + exposed-modules: Web.Google.Maps.Geocoding + build-depends: base >= 4.7 && < 5 + , aeson >= 1.0 && < 1.1 + , http-client >= 0.5 && < 0.6 + , servant >= 0.9 && < 0.10 + , servant-client >= 0.9 && <0.10 + , text >= 1.2 && < 1.3 + default-language: Haskell2010 + +source-repository head + type: git + location: https://github.com/mpilgrem/google-maps-geocoding.git
src/Web/Google/Maps/Geocoding.hs view
@@ -11,14 +11,21 @@ -- Maintainer : public@pilgrem.com -- Stability : experimental -- +-- This package has no connection with Google Inc. or its affiliates. +-- -- The <https://developers.google.com/maps/documentation/geocoding/intro Google Maps Geocoding API> -- provides a direct way to access geocoding and reverse geocoding services via --- an HTTP request. +-- an HTTP request. This library provides bindings in Haskell to that API. -- +-- NB: The use of the Google Maps Geocoding API services is subject to the +-- <https://developers.google.com/maps/terms Google Maps APIs Terms of Service>, +-- which terms restrict the use of content (eg no use without a Google map). +-- -- The 'components' and optional parameters in a geocoding request are not yet -- implemented. The reverse geocoding request is not yet implemented. -- --- Below is an example of use. +-- The code below is an example console application to test privately the use of +-- the library with the Google Maps Geocoding API. -- -- > {-# LANGUAGE OverloadedStrings #-} -- > @@ -34,17 +41,23 @@ -- > -- > main :: IO () -- > main = do --- > txt <- input "Enter full address: " --- > mgr <- newManager tlsManagerSettings --- > let apiKey = Key "<GOOGLE_API_KEY>" --- > result <- geocode mgr apiKey (Address txt) --- > case result of --- > Right response -> do --- > let s = status response --- > case s of --- > OK -> print $ location $ geometry $ head $ results response --- > _ -> putStrLn $ "Error! Status: " ++ show s --- > _ -> putStrLn $ "Error! Result:\n" ++ show result +-- > putStrLn "A test of the Google Maps Geocoding API.\nNB: The use of the \ +-- > \API services is subject to the Google Maps APIs Terms of Serivce at \ +-- > \https://developers.google.com/maps/terms.\n" +-- > txt <- input "Enter ful address: " +-- > mgr <- newManager tlsManagerSettings +-- > let apiKey = Key "<REPLACE_THIS_WITH_YOUR_ACTUAL_GOOGLE_API_KEY>" +-- > result <- geocode mgr apiKey (Address txt) +-- > case result of +-- > Right response -> do +-- > let s = status response +-- > case s of +-- > OK -> do print $ location $ geometry $ head $ results response +-- > putStrLn "Display the location by visiting \ +-- > \maps.google.com on the web and entering the latitude \ +-- > \and longitude." +-- > _ -> putStrLn $ "Error! Status: " ++ show s +-- > _ -> putStrLn $ "Error! Result:\n" ++ show result -- > -- > input :: Text -> IO Text -- > input msg = T.putStr msg >> hFlush stdout >> T.getLine @@ -159,7 +172,7 @@ _ -> l } --- | Postcode locality: a locality contained in a postal code +-- | Postcode locality: a locality contained in a postal code. newtype PostcodeLocality = PostcodeLocality Text deriving (Eq, Show, Generic) @@ -233,7 +246,8 @@ googleApis :: BaseUrl googleApis = BaseUrl Https "maps.googleapis.com" 443 "/maps/api/geocode" --- | Geocode +-- | Geocode. NB: The use of the Google Maps Geocoding API services is subject +-- to the <https://developers.google.com/maps/terms Google Maps APIs Terms of Service>. geocode :: Manager -> Key