Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -312,9 +312,11 @@ request = Line::Bot::V2::MessagingApi::PushMessageRequest.create(
```

## Versioning

This project respects semantic versioning.
- See https://semver.org/

See https://semver.org/
However, if a feature that was publicly released is discontinued for business reasons and becomes completely unusable, we will release changes as a patch release.

### v1 and v2
v1 and v2 are completely different implementations. Migration to v2 is strongly recommended.
Expand Down
3 changes: 0 additions & 3 deletions examples/v2/kitchensink/app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,6 @@ def parser
when Line::Bot::V2::Webhook::PnpDeliveryCompletionEvent
reply_text(event, "[PNP DELIVERY COMPLETE] delivered\n")

when Line::Bot::V2::Webhook::ThingsEvent
reply_text(event, "[THINGS]\n#{JSON.generate(event.things)}")

when Line::Bot::V2::Webhook::VideoPlayCompleteEvent
reply_text(event, "[VIDEO_PLAY_COMPLETE]\n#{JSON.generate(event.video_play_complete)}")

Expand Down
84 changes: 0 additions & 84 deletions spec/line/bot/v2/webhook_parser_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1770,90 +1770,6 @@
end
end

context 'with a ThingsEvent' do
let(:webhook) do
<<~JSON
{
"destination": "Uc7472b39e21dab71c2347e02714630d6",
"events": [
{
"type": "things",
"timestamp": 1650591346705,
"replyToken": "nHuyWiB7yP5Zw52FIkcQobQuGDXCTA",
"source": {
"type": "user",
"userId": "U8189cf6745fc0d808977bdb0b9f22995"
},
"webhookEventId": "01G17EJCGAVV66J5WNA7ZCTF6H",
"deliveryContext": {
"isRedelivery": false
},
"mode": "active",
"things": {
"type": "scenarioResult",
"deviceId": "xxxxxxxxxxxxxxxxxxx",
"result": {
"scenarioId": "xxxxxxxxxxxxxxx",
"revision": 0,
"resultCode": "success",
"startTime": 1650591345705,
"endTime": 1650591346605,
"bleNotificationPayload": "xxxxxxx",
"actionResults": [
{
"data": "xxxxxxx",
"type": "binary"
},
{
"type": "void"
},
{
"type": "void"
}
]
}
}
}
]
}
JSON
end

it 'parses the webhook as a ThingsEvent' do
events = parser.parse(body: webhook, signature: signature)
expect(events).not_to be_empty

event = events.first
expect(event).to be_a(Line::Bot::V2::Webhook::ThingsEvent)
expect(event.type).to eq('things')
expect(event.timestamp).to eq(1650591346705)
expect(event.reply_token).to eq('nHuyWiB7yP5Zw52FIkcQobQuGDXCTA')
expect(event.source).to be_a(Line::Bot::V2::Webhook::UserSource)
expect(event.source.type).to eq('user')
expect(event.source.user_id).to eq('U8189cf6745fc0d808977bdb0b9f22995')
expect(event.webhook_event_id).to eq('01G17EJCGAVV66J5WNA7ZCTF6H')
expect(event.delivery_context).to be_a(Line::Bot::V2::Webhook::DeliveryContext)
expect(event.delivery_context.is_redelivery).to be false
expect(event.mode).to eq('active')
expect(event.things).to be_a(Line::Bot::V2::Webhook::ScenarioResultThingsContent)
expect(event.things.type).to eq('scenarioResult')
expect(event.things.device_id).to eq('xxxxxxxxxxxxxxxxxxx')
expect(event.things.result).to be_a(Line::Bot::V2::Webhook::ScenarioResult)
expect(event.things.result.scenario_id).to eq('xxxxxxxxxxxxxxx')
expect(event.things.result.revision).to eq(0)
expect(event.things.result.result_code).to eq('success')
expect(event.things.result.start_time).to eq(1650591345705)
expect(event.things.result.end_time).to eq(1650591346605)
expect(event.things.result.ble_notification_payload).to eq('xxxxxxx')
expect(event.things.result.action_results).to be_an(Array)
expect(event.things.result.action_results.size).to eq(3)
expect(event.things.result.action_results[0].data).to eq('xxxxxxx')
expect(event.things.result.action_results[0].type).to eq('binary')
expect(event.things.result.action_results[1].type).to eq('void')
expect(event.things.result.action_results[2].type).to eq('void')
end
end

context 'with a MembershioEvent' do
let(:webhook) do
<<~JSON
Expand Down