summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrickBrisbin <>2014-08-19 15:59:00 (GMT)
committerhdiff <hdiff@hdiff.luite.com>2014-08-19 15:59:00 (GMT)
commitaaa5284aadae863f67e1ac9c78dc778de340e9fb (patch)
treec84ed0bcca30063484c1cc8b2e19a55540890257
parent69eaaac650c559ba2fd636dde266c22786b1503e (diff)
version 0.60.6
-rw-r--r--Network/Gravatar.hs17
-rw-r--r--gravatar.cabal2
2 files changed, 15 insertions, 4 deletions
diff --git a/Network/Gravatar.hs b/Network/Gravatar.hs
index d67e13a..476ab1d 100644
--- a/Network/Gravatar.hs
+++ b/Network/Gravatar.hs
@@ -1,7 +1,7 @@
-------------------------------------------------------------------------------
-- |
-- Module : Network.Gravatar
--- Copyright : (c) Patrick Brisbin 2010
+-- Copyright : (c) Patrick Brisbin 2010
-- License : as-is
--
-- Maintainer : pbrisbin@gmail.com
@@ -22,6 +22,7 @@ module Network.Gravatar
, Rating(..)
, Default(..)
, defaultConfig
+ , Scheme (..)
) where
import Data.Digest.Pure.MD5 (md5)
@@ -81,8 +82,16 @@ data GravatarOptions = GravatarOptions
, gDefault :: Maybe DefaultImg
, gForceDefault :: ForceDefault
, gRating :: Maybe Rating
+ , gScheme :: Scheme
}
+data Scheme = Http | Https | None
+
+instance Show Scheme where
+ show Http = "http://"
+ show Https = "https://"
+ show None = "//"
+
instance Default GravatarOptions where
def = defaultConfig
@@ -93,11 +102,13 @@ defaultConfig = GravatarOptions
, gDefault = Nothing
, gForceDefault = ForceDefault False
, gRating = Nothing
+ , gScheme = Http
}
--- | Return the avatar for the given email using the provided options
+-- | Return the avatar for the given email using the provided options
gravatar :: GravatarOptions -> Text -> String
-gravatar opts e = "http://www.gravatar.com/avatar/" ++ hashEmail e `addParams` opts
+gravatar opts e = (show . gScheme $ opts) ++ "www.gravatar.com/avatar/"
+ ++ hashEmail e `addParams` opts
-- | <http://en.gravatar.com/site/implement/hash/>
hashEmail :: Text -> String
diff --git a/gravatar.cabal b/gravatar.cabal
index 34b5362..e883641 100644
--- a/gravatar.cabal
+++ b/gravatar.cabal
@@ -1,5 +1,5 @@
name: gravatar
-version: 0.5.4
+version: 0.6
description: Look up gravatar image urls by email address
synopsis: Look up gravatar image urls by email address
homepage: http://github.com/pbrisbin/gravatar