Permalink
Browse files

yesod 1.2

  • Loading branch information...
1 parent 76a5041 commit b8fc9849c6812445b0b04030be3ccb9fb2110b80 @snoyberg committed Mar 15, 2013
Showing with 11 additions and 11 deletions.
  1. +9 −9 src/Yesod/Facebook.hs
  2. +2 −2 yesod-fb.cabal
View
@@ -48,16 +48,16 @@ class Y.Yesod master => YesodFacebook master where
-- 'Y.GHandler'. Just a convenience wrapper around
-- 'fbCredentials'.
getFbCredentials :: YesodFacebook master =>
- Y.GHandler sub master FB.Credentials
+ Y.HandlerT master IO FB.Credentials
getFbCredentials = fbCredentials <$> Y.getYesod
-- | Run a 'FacebookT' action inside a 'Y.GHandler' using your
-- credentials.
runYesodFbT ::
YesodFacebook master =>
- FB.FacebookT FB.Auth (Y.GHandler sub master) a
- -> Y.GHandler sub master a
+ FB.FacebookT FB.Auth (Y.HandlerT master IO) a
+ -> Y.HandlerT master IO a
runYesodFbT act = do
master <- Y.getYesod
let creds = fbCredentials master
@@ -72,8 +72,8 @@ runYesodFbT act = do
-- but it's provided for completeness' sake.
runNoAuthYesodFbT ::
YesodFacebook master =>
- FB.FacebookT FB.NoAuth (Y.GHandler sub master) a
- -> Y.GHandler sub master a
+ FB.FacebookT FB.NoAuth (Y.HandlerT master IO) a
+ -> Y.HandlerT master IO a
runNoAuthYesodFbT act = do
master <- Y.getYesod
let manager = fbHttpManager master
@@ -91,15 +91,15 @@ runNoAuthYesodFbT act = do
-- JSON).
parseRealTimeUpdateNotifications ::
(YesodFacebook master, A.FromJSON a) =>
- Y.GHandler sub master (FB.RealTimeUpdateNotification a)
+ Y.HandlerT master IO (FB.RealTimeUpdateNotification a)
parseRealTimeUpdateNotifications = do
let myFail = fail . ("parseRealTimeUpdateNotifications: " ++)
-- Get request's signature.
waiReq <- Y.waiRequest
case lookup "X-Hub-Signature" (W.requestHeaders waiReq) of
Nothing -> myFail "X-Hub-Signature not found."
Just sig -> do
- uncheckedData <- L.fromChunks <$> Y.lift (W.requestBody waiReq C.$$ CL.consume)
+ uncheckedData <- L.fromChunks <$> (Y.rawRequestBody C.$$ CL.consume)
mcheckedData <- runYesodFbT $ FB.verifyRealTimeUpdateNotifications sig uncheckedData
case mcheckedData of
Nothing -> myFail "Signature is invalid."
@@ -120,7 +120,7 @@ parseRealTimeUpdateNotifications = do
-- 'Y.notFound'.
answerRealTimeUpdateChallenge ::
FB.RealTimeUpdateToken
- -> Y.GHandler sub master Y.RepPlain
+ -> Y.HandlerT master IO Y.RepPlain
answerRealTimeUpdateChallenge token = do
mhubMode <- Y.lookupGetParam "hub.mode"
mhubChallenge <- Y.lookupGetParam "hub.challenge"
@@ -139,6 +139,6 @@ answerRealTimeUpdateChallenge token = do
-- | Lookup and parse the @request_ids@ GET parameter
-- <http://developers.facebook.com/docs/requests/>.
-lookupRequestIds :: Y.GHandler sub master (Maybe [FB.Id])
+lookupRequestIds :: Y.HandlerT master IO (Maybe [FB.Id])
lookupRequestIds = (map FB.Id . T.splitOn ",") <$$> Y.lookupGetParam "request_ids"
where (<$$>) = fmap . fmap
View
@@ -1,5 +1,5 @@
Name: yesod-fb
-Version: 0.2.3
+Version: 0.3
Synopsis: Useful glue functions between the fb library and Yesod.
Homepage: https://github.com/meteficha/yesod-fb
License: BSD3
@@ -25,7 +25,7 @@ Library
hs-source-dirs: src
Build-depends: base >= 4.3 && < 5
- , yesod-core == 1.1.*
+ , yesod-core == 1.2.*
, fb >= 0.11.1 && < 0.15
, crypto-api

0 comments on commit b8fc984

Please sign in to comment.