Skip to content

Commit fa2c1c8

Browse files
committed
Add unsend event and spec
1 parent eabaaf1 commit fa2c1c8

File tree

3 files changed

+43
-0
lines changed

3 files changed

+43
-0
lines changed

lib/line/bot/event.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
require 'line/bot/event/message'
2222
require 'line/bot/event/postback'
2323
require 'line/bot/event/unfollow'
24+
require 'line/bot/event/unsend'
2425
require 'line/bot/event/member_joined'
2526
require 'line/bot/event/member_left'
2627
require 'line/bot/event/things'

lib/line/bot/event/unsend.rb

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Copyright 2016 LINE
2+
#
3+
# LINE Corporation licenses this file to you under the Apache License,
4+
# version 2.0 (the "License"); you may not use this file except in compliance
5+
# with the License. You may obtain a copy of the License at:
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12+
# License for the specific language governing permissions and limitations
13+
# under the License.
14+
15+
module Line
16+
module Bot
17+
module Event
18+
# Event object for when the user unsends a message in a group or room.
19+
#
20+
# No replyToken is generated for this event.
21+
#
22+
# https://developers.line.biz/en/reference/messaging-api/#unsend-event
23+
class Unsend < Base
24+
end
25+
end
26+
end
27+
end

spec/line/bot/client_parse_spec.rb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,19 @@
272272
"deviceId": "deviceid4",
273273
"type": "unsupport"
274274
}
275+
},
276+
{
277+
"type": "unsend",
278+
"mode": "active",
279+
"timestamp": 1462629479859,
280+
"source": {
281+
"type": "group",
282+
"groupId": "Ca56f94637c...",
283+
"userId": "U4af4980629..."
284+
},
285+
"unsend": {
286+
"messageId": "325708"
287+
}
275288
}
276289
]
277290
}
@@ -402,6 +415,8 @@ def generate_client
402415
expect(events[18]).to be_a(Line::Bot::Event::Things)
403416
expect(events[18].type).to eq(Line::Bot::Event::ThingsType::Unsupport)
404417
expect(events[18].device_id).to eq('deviceid4')
418+
419+
expect(events[19]).to be_a(Line::Bot::Event::Unsend)
405420
end
406421

407422
it 'parses unknown event' do

0 commit comments

Comments
 (0)