line-bot-api 1.30.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,38 +0,0 @@
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
- # @deprecated
19
- # This is deprecated.
20
- # Please use {Line::Bot::V2::Webhook::AccountLinkEvent} instead.
21
- #
22
- # Event object for when a user has linked his/her LINE account with a provider's service account.
23
- #
24
- # https://developers.line.biz/en/reference/messaging-api/#account-link-event
25
- class AccountLink < Base
26
- # @return [String]
27
- def result
28
- @src['link']['result']
29
- end
30
-
31
- # @return [String]
32
- def nonce
33
- @src['link']['nonce']
34
- end
35
- end
36
- end
37
- end
38
- end
@@ -1,39 +0,0 @@
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
- # @deprecated
19
- # This is deprecated.
20
- # Please use {Line::Bot::V2::Webhook::Event} instead.
21
-
22
- class Base
23
- def initialize(src)
24
- warn '[DEPRECATION] Webhook models in V1 is deprecated. Please use V2 instead.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
25
-
26
- @src = src
27
- end
28
-
29
- def [](key)
30
- @src[key]
31
- end
32
-
33
- def to_hash
34
- @src
35
- end
36
- end
37
- end
38
- end
39
- end
@@ -1,43 +0,0 @@
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
- # @deprecated
19
- # This is deprecated.
20
- # Please use {Line::Bot::V2::Webhook::BeaconEvent} instead.
21
- #
22
- # Event object for when a user enters the range of a LINE Beacon.
23
- #
24
- # https://developers.line.biz/en/reference/messaging-api/#beacon-event
25
- class Beacon < Base
26
- # @return [String]
27
- def type
28
- @src['beacon']['type']
29
- end
30
-
31
- # @return [String]
32
- def hwid
33
- @src['beacon']['hwid']
34
- end
35
-
36
- # @return [String]
37
- def deviceMessage
38
- [@src['beacon']['dm']].pack('H*')
39
- end
40
- end
41
- end
42
- end
43
- end
@@ -1,30 +0,0 @@
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
- # @deprecated
19
- # This is deprecated.
20
- # Please use {Line::Bot::V2::Webhook::FollowEvent} instead.
21
- #
22
- # Event object for when your LINE official account is added as a friend (or unblocked).
23
- # You can reply to follow events.
24
- #
25
- # https://developers.line.biz/en/reference/messaging-api/#follow-event
26
- class Follow < Base
27
- end
28
- end
29
- end
30
- end
@@ -1,29 +0,0 @@
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
- # @deprecated
19
- # This is deprecated.
20
- # Please use {Line::Bot::V2::Webhook::JoinEvent} instead.
21
- #
22
- # Event object for when your LINE official account joins a group or room.
23
- #
24
- # https://developers.line.biz/en/reference/messaging-api/#join-event
25
- class Join < Base
26
- end
27
- end
28
- end
29
- end
@@ -1,31 +0,0 @@
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
- # @deprecated
19
- # This is deprecated.
20
- # Please use {Line::Bot::V2::Webhook::LeaveEvent} instead.
21
- #
22
- # Event object for when a user removes your LINE official account from a group or when your LINE official account leaves a group or room.
23
- #
24
- # No replyToken is generated for this event.
25
- #
26
- # https://developers.line.biz/en/reference/messaging-api/#leave-event
27
- class Leave < Base
28
- end
29
- end
30
- end
31
- end
@@ -1,29 +0,0 @@
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
- # @deprecated
19
- # This is deprecated.
20
- # Please use {Line::Bot::V2::Webhook::JoinedMembers} instead.
21
- #
22
- # Event object for when a user joins a group or room that the LINE official account is in.
23
- #
24
- # https://developers.line.biz/en/reference/messaging-api/#member-joined-event
25
- class MemberJoined < Base
26
- end
27
- end
28
- end
29
- end
@@ -1,31 +0,0 @@
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
- # @deprecated
19
- # This is deprecated.
20
- # Please use {Line::Bot::V2::Webhook::LeftMembers} instead.
21
- #
22
- # Event object for when a user leaves a group or room that the LINE official account is in.
23
- #
24
- # No replyToken is generated for this event.
25
- #
26
- # https://developers.line.biz/en/reference/messaging-api/#member-left-event
27
- class MemberLeft < Base
28
- end
29
- end
30
- end
31
- end
@@ -1,51 +0,0 @@
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
- # @deprecated
19
- # This is obsolete.
20
- module MessageType
21
- Text = 'text'
22
- Image = 'image'
23
- Video = 'video'
24
- Audio = 'audio'
25
- File = 'file'
26
- Location = 'location'
27
- Sticker = 'sticker'
28
- Unsupport = 'unsupport'
29
- end
30
-
31
- # @deprecated
32
- # This is deprecated.
33
- # Please use {Line::Bot::V2::Webhook::MessageContent} instead.
34
- #
35
- # Webhook event object which contains the sent message.
36
- #
37
- # https://developers.line.biz/en/reference/messaging-api/#message-event
38
- class Message < Base
39
- def type
40
- MessageType.const_get(@src['message']['type'].capitalize)
41
- rescue NameError => e
42
- MessageType::Unsupport
43
- end
44
-
45
- def message
46
- @src['message']
47
- end
48
- end
49
- end
50
- end
51
- end
@@ -1,29 +0,0 @@
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
- # @deprecated
19
- # This is deprecated.
20
- # Please use {Line::Bot::V2::Webhook::PostbackEvent} instead.
21
- #
22
- # Event object for when a user performs a postback action which initiates a postback.
23
- #
24
- # https://developers.line.biz/en/reference/messaging-api/#postback-event
25
- class Postback < Base
26
- end
27
- end
28
- end
29
- end
@@ -1,49 +0,0 @@
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
- # @deprecated
19
- # This is obsolete.
20
- module ThingsType
21
- Link = 'link'
22
- Unlink = 'unlink'
23
- ScenarioResult = 'scenarioResult'
24
- Unsupport = 'unsupport'
25
- end
26
-
27
- # @deprecated
28
- # This is deprecated.
29
- # Please use {Line::Bot::V2::Webhook::ThingsEvent} instead.
30
- #
31
- # LINE Things API related events.
32
- #
33
- # * https://developers.line.biz/en/reference/messaging-api/#device-link-event
34
- # * https://developers.line.biz/en/reference/messaging-api/#device-unlink-event
35
- # * https://developers.line.biz/en/reference/messaging-api/#scenario-result-event
36
- class Things < Base
37
- def type
38
- ThingsType.const_get(Util.camelize(@src['things']['type']))
39
- rescue NameError
40
- ThingsType::Unsupport
41
- end
42
-
43
- def device_id
44
- @src['things']['deviceId']
45
- end
46
- end
47
- end
48
- end
49
- end
@@ -1,31 +0,0 @@
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
- # @deprecated
19
- # This is deprecated.
20
- # Please use {Line::Bot::V2::Webhook::UnfollowEvent} instead.
21
- #
22
- # Event object for when your LINE official account is blocked.
23
- #
24
- # No replyToken is generated for this event.
25
- #
26
- # https://developers.line.biz/en/reference/messaging-api/#unfollow-event
27
- class Unfollow < Base
28
- end
29
- end
30
- end
31
- end
@@ -1,31 +0,0 @@
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
- # @deprecated
19
- # This is deprecated.
20
- # Please use {Line::Bot::V2::Webhook::UnsendEvent} instead.
21
- #
22
- # Event object for when the user unsends a message in a group or room.
23
- #
24
- # No replyToken is generated for this event.
25
- #
26
- # https://developers.line.biz/en/reference/messaging-api/#unsend-event
27
- class Unsend < Base
28
- end
29
- end
30
- end
31
- end
@@ -1,29 +0,0 @@
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
- # @deprecated
19
- # This is deprecated.
20
- # Please use {Line::Bot::V2::Webhook::VideoPlayComplete} instead.
21
- #
22
- # Event for when a user finishes viewing a video at least once with the specified trackingId sent by the LINE Official Account.
23
- #
24
- # https://developers.line.biz/en/reference/messaging-api/#video-viewing-complete
25
- class VideoPlayComplete < Base
26
- end
27
- end
28
- end
29
- end
@@ -1,28 +0,0 @@
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
- require 'line/bot/v1/event/base'
16
- require 'line/bot/v1/event/account_link'
17
- require 'line/bot/v1/event/beacon'
18
- require 'line/bot/v1/event/follow'
19
- require 'line/bot/v1/event/join'
20
- require 'line/bot/v1/event/leave'
21
- require 'line/bot/v1/event/message'
22
- require 'line/bot/v1/event/postback'
23
- require 'line/bot/v1/event/unfollow'
24
- require 'line/bot/v1/event/unsend'
25
- require 'line/bot/v1/event/member_joined'
26
- require 'line/bot/v1/event/member_left'
27
- require 'line/bot/v1/event/things'
28
- require 'line/bot/v1/event/video_play_complete'
@@ -1,91 +0,0 @@
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
- require 'json'
16
- require 'net/http'
17
- require 'uri'
18
-
19
- module Line
20
- module Bot
21
- # @deprecated
22
- # This is deprecated.
23
- # Please use {Line::Bot::V2::HttpClient} instead.
24
- class HTTPClient
25
- # @return [Hash]
26
- attr_accessor :http_options
27
-
28
- # @deprecated
29
- # This is deprecated.
30
- # Please use {Line::Bot::V2::HttpClient#initialize} instead.
31
- #
32
- # Initialize a new HTTPClient
33
- #
34
- # @param http_options [Hash]
35
- #
36
- # @return [Line::Bot::HTTPClient]
37
- def initialize(http_options = {})
38
- @http_options = http_options
39
- end
40
-
41
- # @deprecated
42
- # This is obsolete.
43
- #
44
- # @return [Net::HTTP]
45
- def http(uri)
46
- http = Net::HTTP.new(uri.host, uri.port)
47
- if uri.scheme == "https"
48
- http.use_ssl = true
49
- end
50
-
51
- http_options&.each do |key, value|
52
- http.send("#{key}=", value)
53
- end
54
-
55
- http
56
- end
57
-
58
- # @deprecated
59
- # This is deprecated.
60
- # Please use {Line::Bot::V2::HttpClient#get} instead.
61
- def get(url, header = {})
62
- uri = URI(url)
63
- http(uri).get(uri.request_uri, header)
64
- end
65
-
66
- # @deprecated
67
- # This is deprecated.
68
- # Please use {Line::Bot::V2::HttpClient#post} instead.
69
- def post(url, payload, header = {})
70
- uri = URI(url)
71
- http(uri).post(uri.request_uri, payload, header)
72
- end
73
-
74
- # @deprecated
75
- # This is deprecated.
76
- # Please use {Line::Bot::V2::HttpClient#put} instead.
77
- def put(url, payload, header = {})
78
- uri = URI(url)
79
- http(uri).put(uri.request_uri, payload, header)
80
- end
81
-
82
- # @deprecated
83
- # This is deprecated.
84
- # Please use {Line::Bot::V2::HttpClient#delete} instead.
85
- def delete(url, header = {})
86
- uri = URI(url)
87
- http(uri).delete(uri.request_uri, header)
88
- end
89
- end
90
- end
91
- end
@@ -1,28 +0,0 @@
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 Util
18
- # @deprecated
19
- # This is deprecated.
20
- # Please use {Line::Bot::V2::Utils::camelize} instead.
21
- #
22
- # @return [String]
23
- def self.camelize(string)
24
- string.split(/_|(?=[A-Z])/).map(&:capitalize).join
25
- end
26
- end
27
- end
28
- end