packages feed

fb 0.12.7 → 0.12.8

raw patch · 4 files changed

+28/−4 lines, 4 filesdep +containersPVP ok

version bump matches the API change (PVP)

Dependencies added: containers

API changes (from Hackage documentation)

+ Facebook: FQLTime :: UTCTime -> FQLTime
+ Facebook: newtype FQLTime
+ Facebook: unFQLTime :: FQLTime -> UTCTime

Files

fb.cabal view
@@ -1,5 +1,5 @@ name:              fb-version:           0.12.7+version:           0.12.8 license:           BSD3 license-file:      LICENSE author:            Felipe Lessa@@ -106,9 +106,11 @@       -- Library dependencies used on the tests.  No need to       -- specify versions since they'll use the same as above.       base, lifted-base, transformers, bytestring,-      conduit, http-conduit, text, time, aeson+      conduit, http-conduit, text, time, aeson, monad-control        -- Test-only dependencies+    , containers+    , data-default     , HUnit     , QuickCheck     , hspec == 1.3.*
src/Facebook.hs view
@@ -87,6 +87,7 @@        -- * FQL     , fqlQuery+    , FQLTime(..)        -- * Test User API     , getTestUsers
src/Facebook/FQL.hs view
@@ -1,10 +1,13 @@ {-# LANGUAGE FlexibleContexts, OverloadedStrings #-} module Facebook.FQL     ( fqlQuery+    , FQLTime(..)     ) where  import Control.Monad.Trans.Control (MonadBaseControl) import Data.Text (Text)+import Data.Time (UTCTime)+import Data.Time.Clock.POSIX (posixSecondsToUTCTime)  import qualified Data.Aeson as A import qualified Data.Conduit as C@@ -24,3 +27,15 @@   runResourceInFb $ do     let query = ["q" #= fql]     asJson =<< fbhttp =<< fbreq "/fql" mtoken query+++-- | @newtype@ wrapper around 'UTCTime' that is able to parse+-- FQL's time representation as seconds since the Unix epoch.+newtype FQLTime = FQLTime { unFQLTime :: UTCTime }+  deriving (Eq, Ord, Show)++instance A.FromJSON FQLTime where+  parseJSON = fmap ( FQLTime+                   . posixSecondsToUTCTime+                   . fromInteger)+            . A.parseJSON
tests/Main.hs view
@@ -255,7 +255,7 @@         -- Get the created user         createdUser <- FB.getUser (FB.tuId newTestUser) [] (Just newTestUserToken)         -- Remove the test user-        FB.removeTestUser newTestUser token+        True <- FB.removeTestUser newTestUser token         -- Check user attributes         FB.userId createdUser     &?= FB.tuId newTestUser         FB.userName createdUser   &?= Just "Gabriel"@@ -271,7 +271,7 @@             let Just tokenUserA = FB.incompleteTestUserAccessToken testUser1             let Just tokenUserB = FB.incompleteTestUserAccessToken testUser2             -- Create a friend connection between the new test users-            friendship <- FB.makeFriendConn testUser1 testUser2+            FB.makeFriendConn testUser1 testUser2             -- Check if the new test users' tokens are valid             FB.isValid tokenUserA #?= True             FB.isValid tokenUserB #?= True@@ -362,6 +362,12 @@       runExampleAuth $ do         ret <- FB.parseSignedRequest (B.concat [corruptedSig, ".", exampleData])         ret &?= (Nothing :: Maybe A.Value)++  describe "FQLQuery" $ do+    it "seems to work" $ do+      let input  = "[1348678357]"+          output = FB.FQLTime (read "2012-09-26 16:52:37 UTC")+      A.decode input @?= Just [output]   -- Wrappers for HUnit operators using MonadIO