google-static-maps 0.4.0.0 → 0.5.0.0
raw patch · 3 files changed
+15/−21 lines, 3 filesdep ~aesondep ~cryptonitedep ~servantPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: aeson, cryptonite, servant, servant-client
API changes (from Hackage documentation)
Files
- changelog.md +5/−0
- google-static-maps.cabal +5/−5
- src/Web/Google/Static/Maps.hs +5/−16
changelog.md view
@@ -1,3 +1,8 @@+# 0.5.0.0 + +* Depend on more recent version of `servant` package and, consequently, + `servant-client`, `aeson` and `cryptonite` packages + # 0.4.0.0 * Implement `language` and `region` parameters
google-static-maps.cabal view
@@ -1,5 +1,5 @@ name: google-static-maps -version: 0.4.0.0 +version: 0.5.0.0 synopsis: Bindings to the Google Static Maps API description: The <https://developers.google.com/maps/documentation/static-maps/intro Google Static Maps API> returns a map as an image via an HTTP request. This library @@ -29,17 +29,17 @@ build-depends: base >= 4.7 && < 5 , base64-bytestring >= 1.0 && < 1.1 , bytestring >= 0.10 && < 0.11 - , aeson >= 1.0 && < 1.1 + , aeson >= 1.1 && < 1.2 , bytedump >= 1.0 && < 1.1 - , cryptonite >= 0.21 && < 0.22 + , cryptonite >= 0.23 && < 0.24 , double-conversion >= 2.0 && < 2.1 , http-client >= 0.5 && < 0.6 , JuicyPixels >= 3.2 && < 3.3 , memory >= 0.14 && < 0.15 , MissingH >=1.4 && < 1.5 , network-uri >= 2.6 && < 2.7 - , servant >= 0.9 && < 0.10 - , servant-client >= 0.9 && < 0.10 + , servant >= 0.11 && < 0.12 + , servant-client >= 0.11 && < 0.12 , servant-JuicyPixels >= 0.3 && < 0.4 , text >= 1.2 && < 1.3 , utf8-string >= 1.0 && < 1.1
src/Web/Google/Static/Maps.hs view
@@ -132,6 +132,7 @@ import Servant.Client (BaseUrl (..), client, ClientEnv (..), ClientM, runClientM, ServantError) import Servant.JuicyPixels (PNG) +import Servant.Utils.Links (LinkArrayElementStyle (..), linkURI') import Text.Bytedump (hexString) import Web.Google.Maps.Common (Address (..), googleMapsApis, Key (..), Language (..), LatLng (..), Location (..), Region (..)) @@ -639,14 +640,15 @@ Nothing -> runClientM (eval staticmap' Nothing) (ClientEnv mgr googleMapsApis) Just secret -> do - let url = fixUrl $ eval (safeLink api api) Nothing + let url = linkURI $ eval (safeLink api api) Nothing signatureOpt = sign secret googleMapsApis url runClientM (eval staticmap' signatureOpt) (ClientEnv mgr googleMapsApis) where + linkURI = linkURI' LinkArrayElementPlain eval f = f (Just key) centerOpt zoomOpt (Just size) scaleOpt formatOpt - mapStyles mapTypeOpt languageOpt regionOpt markerss paths - visibleOpt + mapStyles mapTypeOpt languageOpt regionOpt markerss paths + visibleOpt sign :: Secret -> BaseUrl -> URI -> Maybe Signature sign (Secret secret) baseUrl url = do @@ -655,16 +657,3 @@ signature = hmac secret' url' :: HMAC SHA1 signature' = decodeUtf8 $ encode $ convert signature return $ Signature signature' - --- A hack required because in package servant-0.9.1.1, the function `linkURI` --- adds unwanted `[]` to specified parameter names for QueryParams (reported as --- issue #715). The result is that `safeLink` does not return the correct URI. --- The hack is not ideal as there is a very small but positive probability that --- another part of the URI will contain by coincidence the characters that need --- to be replaced. -fixUrl :: URI -> URI -fixUrl url = url {uriQuery = uri'} - where - uri = uriQuery url - uri' = replace "path[]=" "path=" $ replace "markers[]=" "markers=" $ replace - "style[]=" "style=" uri