commit ghc-line for openSUSE:Factory
Hello community, here is the log from the commit of package ghc-line for openSUSE:Factory checked in at 2017-08-31 20:57:10 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-line (Old) and /work/SRC/openSUSE:Factory/.ghc-line.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "ghc-line" Thu Aug 31 20:57:10 2017 rev:2 rq:513421 version:3.1.0 Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-line/ghc-line.changes 2017-05-16 14:42:32.145212575 +0200 +++ /work/SRC/openSUSE:Factory/.ghc-line.new/ghc-line.changes 2017-08-31 20:57:10.965353028 +0200 @@ -1,0 +2,5 @@ +Thu Jul 27 14:07:47 UTC 2017 - psimons@suse.com + +- Update to version 3.1.0. + +------------------------------------------------------------------- Old: ---- line-2.2.0.tar.gz New: ---- line-3.1.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-line.spec ++++++ --- /var/tmp/diff_new_pack.sHyZ6F/_old 2017-08-31 20:57:11.873225469 +0200 +++ /var/tmp/diff_new_pack.sHyZ6F/_new 2017-08-31 20:57:11.881224346 +0200 @@ -19,7 +19,7 @@ %global pkg_name line %bcond_with tests Name: ghc-%{pkg_name} -Version: 2.2.0 +Version: 3.1.0 Release: 0 Summary: Haskell SDK for the LINE API License: BSD-3-Clause ++++++ line-2.2.0.tar.gz -> line-3.1.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/line-2.2.0/CHANGELOG.md new/line-3.1.0/CHANGELOG.md --- old/line-2.2.0/CHANGELOG.md 2017-01-15 08:48:15.000000000 +0100 +++ new/line-3.1.0/CHANGELOG.md 2017-05-25 18:17:47.000000000 +0200 @@ -1,3 +1,15 @@ +## 3.1.0 (26 May 2017) + +* Add support for file message + +## 3.0.1 (26 Apr 2017) + +* Use Text instead of String for Beacon dm + +## 3.0.0 (26 Apr 2017) + +* Add type and dm support for Beacon event + ## 2.2.0 (15 Jan 2017) * Add multicast API support diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/line-2.2.0/line.cabal new/line-3.1.0/line.cabal --- old/line-2.2.0/line.cabal 2017-01-15 08:47:41.000000000 +0100 +++ new/line-3.1.0/line.cabal 2017-05-25 18:16:57.000000000 +0200 @@ -1,5 +1,5 @@ name: line -version: 2.2.0 +version: 3.1.0 synopsis: Haskell SDK for the LINE API homepage: https://github.com/noraesae/line license: BSD3 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/line-2.2.0/src/Line/Messaging/Webhook/Types.hs new/line-3.1.0/src/Line/Messaging/Webhook/Types.hs --- old/line-2.2.0/src/Line/Messaging/Webhook/Types.hs 2016-12-01 15:21:38.000000000 +0100 +++ new/line-3.1.0/src/Line/Messaging/Webhook/Types.hs 2017-05-25 18:13:40.000000000 +0200 @@ -40,6 +40,8 @@ EventMessage (..), -- *** Beacon event BeaconData (..), + getHWID, + getDeviceMessage, ) where import Data.Aeson @@ -222,6 +224,7 @@ | ImageEM ID -- ^ Image event message. | VideoEM ID -- ^ Video event message. | AudioEM ID -- ^ Audio event message. + | FileEM ID T.Text Integer -- ^ File event message. | LocationEM ID Location -- ^ Location event message. | StickerEM ID Sticker -- ^ Sticker event message. deriving (Eq, Show) @@ -233,20 +236,38 @@ "image" -> ImageEM <$> v .: "id" "video" -> VideoEM <$> v .: "id" "audio" -> AudioEM <$> v .: "id" + "file" -> FileEM <$> v .: "id" <*> v .: "fileName" <*> (read <$> v .: "fileSize") "location" -> LocationEM <$> v .: "id" <*> parseJSON (Object v) "sticker" -> StickerEM <$> v .: "id" <*> parseJSON (Object v) _ -> fail "EventMessage" parseJSON _ = fail "IncommingMessage" -- | Represent beacon data. -data BeaconData = BeaconEnter { getHWID :: ID - -- ^ Get hardware ID of the beacon. - } +data BeaconData = BeaconEnter ID (Maybe T.Text) + | BeaconLeave ID (Maybe T.Text) + | BeaconBanner ID (Maybe T.Text) deriving (Eq, Show) + +-- | Get hardware ID of the beacon. +getHWID :: BeaconData -> ID +getHWID (BeaconEnter hwid _) = hwid +getHWID (BeaconLeave hwid _) = hwid +getHWID (BeaconBanner hwid _) = hwid + +-- | Get device message from the beacon, if exists. +getDeviceMessage :: BeaconData -> Maybe T.Text +getDeviceMessage (BeaconEnter _ dm) = dm +getDeviceMessage (BeaconLeave _ dm) = dm +getDeviceMessage (BeaconBanner _ dm) = dm + instance FromJSON BeaconData where parseJSON (Object v) = v .: "type" >>= \ t -> case t :: T.Text of - "enter" -> BeaconEnter <$> v .: "hwid" + "enter" -> parseBeacon BeaconEnter + "leave" -> parseBeacon BeaconLeave + "banner" -> parseBeacon BeaconBanner _ -> fail "BeaconData" + where + parseBeacon f = f <$> v .: "hwid" <*> v .:? "dm" parseJSON _ = fail "BeaconData" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/line-2.2.0/test/Line/Messaging/Webhook/TypesSpec.hs new/line-3.1.0/test/Line/Messaging/Webhook/TypesSpec.hs --- old/line-2.2.0/test/Line/Messaging/Webhook/TypesSpec.hs 2016-12-03 11:16:23.000000000 +0100 +++ new/line-3.1.0/test/Line/Messaging/Webhook/TypesSpec.hs 2017-05-25 18:11:31.000000000 +0200 @@ -73,6 +73,11 @@ , ( badAudioMessage, Nothing ) ] + describe "file message event" $ fromJSONSpec + [ ( goodFileMessage, replyE MessageEvent (FileEM "325708" "hello.txt" 1234) ) + , ( badFileMessage, Nothing ) + ] + describe "location message event" $ fromJSONSpec [ ( goodLocationMessage, replyE MessageEvent (LocationEM "325708" $ Location @@ -129,6 +134,9 @@ ] describe "beacon event" $ fromJSONSpec - [ ( goodBeacon, replyE BeaconEvent (BeaconEnter "d41d8cd98f") ) + [ ( goodBeacon, replyE BeaconEvent (BeaconEnter "d41d8cd98f" Nothing) ) + , ( goodBeaconLeave, replyE BeaconEvent (BeaconLeave "d41d8cd98f" Nothing) ) + , ( goodBeaconBanner, replyE BeaconEvent (BeaconBanner "d41d8cd98f" Nothing) ) + , ( goodBeaconWithDm, replyE BeaconEvent (BeaconEnter "d41d8cd98f" (Just "i am a direct message.")) ) , ( badBeacon, Nothing ) ] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/line-2.2.0/test/Line/Messaging/Webhook/TypesSpecHelper.hs new/line-3.1.0/test/Line/Messaging/Webhook/TypesSpecHelper.hs --- old/line-2.2.0/test/Line/Messaging/Webhook/TypesSpecHelper.hs 2016-12-03 11:09:38.000000000 +0100 +++ new/line-3.1.0/test/Line/Messaging/Webhook/TypesSpecHelper.hs 2017-05-25 18:09:31.000000000 +0200 @@ -190,6 +190,48 @@ ] } |] +goodFileMessage :: BL.ByteString +goodFileMessage = [r| +{ "events": [ +{ + "replyToken": "nHuyWiB7yP5Zw52FIkcQobQuGDXCTA", + "type": "message", + "timestamp": 1462629479859, + "source": { + "type": "user", + "userId": "U206d25c2ea6bd87c17655609a1c37cb8" + }, + "message": { + "id": "325708", + "type": "file", + "fileName": "hello.txt", + "fileSize": "1234" + } +} +] } +|] + +badFileMessage :: BL.ByteString +badFileMessage = [r| +{ "events": [ +{ + "replyToken": "nHuyWiB7yP5Zw52FIkcQobQuGDXCTA", + "type": "message", + "timestamp": 1462629479859, + "source": { + "type": "user", + "userId": "U206d25c2ea6bd87c17655609a1c37cb8" + }, + "message": { + "id": "325708", + "type": "file'", + "fileName": "hello.txt", + "fileSize": "1234" + } +} +] } +|] + goodLocationMessage :: BL.ByteString goodLocationMessage = [r| { "events": [ @@ -447,6 +489,64 @@ } } ] } +|] + +goodBeaconLeave :: BL.ByteString +goodBeaconLeave = [r| +{ "events": [ +{ + "replyToken": "nHuyWiB7yP5Zw52FIkcQobQuGDXCTA", + "type": "beacon", + "timestamp": 1462629479859, + "source": { + "type": "user", + "userId": "U206d25c2ea6bd87c17655609a1c37cb8" + }, + "beacon": { + "hwid": "d41d8cd98f", + "type": "leave" + } +} +] } +|] + +goodBeaconBanner :: BL.ByteString +goodBeaconBanner = [r| +{ "events": [ +{ + "replyToken": "nHuyWiB7yP5Zw52FIkcQobQuGDXCTA", + "type": "beacon", + "timestamp": 1462629479859, + "source": { + "type": "user", + "userId": "U206d25c2ea6bd87c17655609a1c37cb8" + }, + "beacon": { + "hwid": "d41d8cd98f", + "type": "banner" + } +} +] } +|] + +goodBeaconWithDm :: BL.ByteString +goodBeaconWithDm = [r| +{ "events": [ +{ + "replyToken": "nHuyWiB7yP5Zw52FIkcQobQuGDXCTA", + "type": "beacon", + "timestamp": 1462629479859, + "source": { + "type": "user", + "userId": "U206d25c2ea6bd87c17655609a1c37cb8" + }, + "beacon": { + "hwid": "d41d8cd98f", + "type": "enter", + "dm": "i am a direct message." + } +} +] } |] badBeacon :: BL.ByteString
participants (1)
-
root@hilbert.suse.de