Hello community,

here is the log from the commit of package ghc-mandrill for openSUSE:Factory 
checked in at 2017-03-18 20:49:57
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-mandrill (Old)
 and      /work/SRC/openSUSE:Factory/.ghc-mandrill.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "ghc-mandrill"

Sat Mar 18 20:49:57 2017 rev:3 rq:450609 version:0.5.3.1

Changes:
--------
--- /work/SRC/openSUSE:Factory/ghc-mandrill/ghc-mandrill.changes        
2016-11-10 13:24:46.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.ghc-mandrill.new/ghc-mandrill.changes   
2017-03-18 20:49:58.410783226 +0100
@@ -1,0 +2,5 @@
+Sun Jan  8 21:13:16 UTC 2017 - psim...@suse.com
+
+- Update to version 0.5.3.1 with cabal2obs.
+
+-------------------------------------------------------------------

Old:
----
  mandrill-0.5.2.3.tar.gz

New:
----
  mandrill-0.5.3.1.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ ghc-mandrill.spec ++++++
--- /var/tmp/diff_new_pack.iToHBG/_old  2017-03-18 20:49:59.046693139 +0100
+++ /var/tmp/diff_new_pack.iToHBG/_new  2017-03-18 20:49:59.050692572 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package ghc-mandrill
 #
-# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -19,7 +19,7 @@
 %global pkg_name mandrill
 %bcond_with tests
 Name:           ghc-%{pkg_name}
-Version:        0.5.2.3
+Version:        0.5.3.1
 Release:        0
 Summary:        Library for interfacing with the Mandrill JSON API
 License:        MIT

++++++ mandrill-0.5.2.3.tar.gz -> mandrill-0.5.3.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/mandrill-0.5.2.3/mandrill.cabal 
new/mandrill-0.5.3.1/mandrill.cabal
--- old/mandrill-0.5.2.3/mandrill.cabal 2016-08-07 19:46:14.000000000 +0200
+++ new/mandrill-0.5.3.1/mandrill.cabal 2017-01-02 18:18:23.000000000 +0100
@@ -1,5 +1,5 @@
 name:                mandrill
-version:             0.5.2.3
+version:             0.5.3.1
 synopsis:            Library for interfacing with the Mandrill JSON API
 description:         Pure Haskell client for the Mandrill JSON API
 license:             MIT
@@ -26,6 +26,7 @@
     Network.API.Mandrill.Messages
     Network.API.Mandrill.Messages.Types
     Network.API.Mandrill.Inbound
+    Network.API.Mandrill.Webhooks
     Network.API.Mandrill.Senders
   other-modules:
     Network.API.Mandrill.Utils
@@ -40,7 +41,7 @@
     , http-types >= 0.8.0
     , http-client >= 0.3.0
     , http-client-tls >= 0.2.0.0
-    , aeson >= 0.7.0.3 && < 1.1.0.0
+    , aeson >= 0.7.0.3 && < 1.2.0.0
     , lens >= 4.0
     , blaze-html >= 0.5.0.0
     , QuickCheck >= 2.6 && < 3.0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/mandrill-0.5.2.3/src/Network/API/Mandrill/Webhooks.hs 
new/mandrill-0.5.3.1/src/Network/API/Mandrill/Webhooks.hs
--- old/mandrill-0.5.2.3/src/Network/API/Mandrill/Webhooks.hs   1970-01-01 
01:00:00.000000000 +0100
+++ new/mandrill-0.5.3.1/src/Network/API/Mandrill/Webhooks.hs   2016-12-20 
14:08:53.000000000 +0100
@@ -0,0 +1,70 @@
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE TemplateHaskell   #-}
+module Network.API.Mandrill.Webhooks where
+import           Control.Applicative           (pure)
+import           Control.Lens
+import           Control.Monad                 (mzero)
+import           Data.Aeson                    (FromJSON, ToJSON, parseJSON,
+                                                toJSON)
+import           Data.Aeson                    (Value (String))
+import           Data.Aeson.TH                 (defaultOptions, deriveJSON)
+import           Data.Aeson.Types              (fieldLabelModifier)
+import           Data.Set                      (Set)
+import           Data.Text                     (Text)
+import qualified Data.Text                     as T
+import           Network.API.Mandrill.HTTP     (toMandrillResponse)
+import           Network.API.Mandrill.Settings
+import           Network.API.Mandrill.Types
+import           Network.HTTP.Client           (Manager)
+
+data EventHook
+  = EventSent
+  | EventDeferred
+  | EventHardBounced
+  | EventSoftBounced
+  | EventOpened
+  | EventClicked
+  | EventMarkedAsSpam
+  | EventUnsubscribed
+  | EventRejected
+  deriving (Ord,Eq)
+
+instance Show EventHook where
+  show e = case e of
+    EventSent         -> "send"
+    EventDeferred     -> "deferral"
+    EventSoftBounced  -> "soft_bounce"
+    EventHardBounced  -> "hard_bounce"
+    EventOpened       -> "open"
+    EventClicked      -> "click"
+    EventMarkedAsSpam -> "spam"
+    EventUnsubscribed -> "unsub"
+    EventRejected     -> "reject"
+instance FromJSON EventHook where
+  parseJSON (String s) =
+    case s of
+      "send"           -> pure EventSent
+      "deferral"       -> pure EventDeferred
+      "soft_bounce"    -> pure EventSoftBounced
+      "hard_bounce"    -> pure EventHardBounced
+      "open"           -> pure EventOpened
+      "click"          -> pure EventClicked
+      "spam"           -> pure EventMarkedAsSpam
+      "reject"         -> pure EventRejected
+      "unsub"          -> pure EventUnsubscribed
+      x                -> fail ("can't parse " ++  show x)
+
+
+instance ToJSON EventHook where
+  toJSON e = String (T.pack $ show e)
+
+data WebhookAddRq =
+  WebhookAddRq
+  { _warq_key         :: MandrillKey
+  , _warq_url         :: Text
+  , _warq_description :: Text
+  , _warq_events      :: Set EventHook
+  } deriving Show
+
+makeLenses ''WebhookAddRq
+deriveJSON defaultOptions { fieldLabelModifier = drop 6 } ''WebhookAddRq
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/mandrill-0.5.2.3/test/Main.hs 
new/mandrill-0.5.3.1/test/Main.hs
--- old/mandrill-0.5.2.3/test/Main.hs   2016-07-11 08:33:14.000000000 +0200
+++ new/mandrill-0.5.3.1/test/Main.hs   2016-12-20 14:08:53.000000000 +0100
@@ -45,5 +45,6 @@
          , testCase "inbound/add-route.json API response parsing" testRouteAdd
          , testCase "inbound/add-domain.json API response parsing" 
testDomainAdd
          , testCase "senders/verify-domain.json API response parsing" 
testVerifyDomain
+         , testCase "webhooks/add.json API response parsing" testWebhookAdd
          ]
      ]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/mandrill-0.5.2.3/test/RawData.hs 
new/mandrill-0.5.3.1/test/RawData.hs
--- old/mandrill-0.5.2.3/test/RawData.hs        2016-07-11 08:33:14.000000000 
+0200
+++ new/mandrill-0.5.3.1/test/RawData.hs        2016-12-20 14:08:53.000000000 
+0100
@@ -236,3 +236,22 @@
     "email": "em...@domain.com"
 }
 |]
+
+webhookAdd = [r|
+{
+    "key": "example key",
+    "url": "http://example/webhook-url";,
+    "description": "My Example Webhook",
+    "events": [
+         "send",
+         "deferral",
+         "hard_bounce",
+         "soft_bounce",
+         "open",
+         "click",
+         "spam",
+         "unsub",
+         "reject"
+    ]
+}
+|]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/mandrill-0.5.2.3/test/Tests.hs 
new/mandrill-0.5.3.1/test/Tests.hs
--- old/mandrill-0.5.2.3/test/Tests.hs  2016-07-11 08:33:14.000000000 +0200
+++ new/mandrill-0.5.3.1/test/Tests.hs  2016-12-20 14:08:53.000000000 +0100
@@ -9,6 +9,7 @@
 import           Network.API.Mandrill.Senders
 import           Network.API.Mandrill.Types
 import           Network.API.Mandrill.Users.Types
+import           Network.API.Mandrill.Webhooks
 import           RawData
 import           Test.Tasty.HUnit
 
@@ -76,3 +77,12 @@
   where
     parsePayload ::  Either String VerifyDomainResponse
     parsePayload = eitherDecodeStrict . C8.pack $ domainVerify
+
+
+testWebhookAdd :: Assertion
+testWebhookAdd =
+  assertBool ("webhooks/add.json (request): parsing failed" ++ show 
parsePayload)
+             (isRight parsePayload)
+  where
+    parsePayload :: Either String WebhookAddRq
+    parsePayload = eitherDecodeStrict . C8.pack $ webhookAdd


Reply via email to