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,1936 +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 'base64'
16
- require 'net/http'
17
- require 'openssl'
18
- require 'uri'
19
-
20
- module Line
21
- module Bot
22
- # @deprecated
23
- # This is deprecated. Please use one of the following instead:
24
- # * {Line::Bot::V2::MessagingApi::ApiClient}
25
- # * {Line::Bot::V2::MessagingApi::ApiBlobClient}
26
- # * {Line::Bot::V2::Liff::ApiClient}
27
- # * {Line::Bot::V2::ChannelAccessToken::ApiClient}
28
- # * {Line::Bot::V2::ManageAudience::ApiClient}
29
- # * {Line::Bot::V2::ManageAudience::ApiBlobClient}
30
- # * {Line::Bot::V2::Insight::ApiClient}
31
- #
32
- # API Client of LINE Bot SDK Ruby (deprecated)
33
- # @client ||= Line::Bot::Client.new do |config|
34
- # config.channel_id = ENV["LINE_CHANNEL_ID"]
35
- # config.channel_secret = ENV["LINE_CHANNEL_SECRET"]
36
- # config.channel_token = ENV["LINE_CHANNEL_TOKEN"]
37
- # end
38
- class Client
39
- # @return [String]
40
- attr_accessor :channel_token, :channel_id, :channel_secret, :endpoint, :blob_endpoint
41
-
42
- # @return [Object]
43
- attr_accessor :httpclient
44
-
45
- # @return [Hash]
46
- attr_accessor :http_options
47
-
48
- # @deprecated
49
- # This is deprecated. Please use one of the following instead:
50
- # * {Line::Bot::V2::MessagingApi::ApiClient}
51
- # * {Line::Bot::V2::MessagingApi::ApiBlobClient}
52
- # * {Line::Bot::V2::Liff::ApiClient}
53
- # * {Line::Bot::V2::ChannelAccessToken::ApiClient}
54
- # * {Line::Bot::V2::ManageAudience::ApiClient}
55
- # * {Line::Bot::V2::ManageAudience::ApiBlobClient}
56
- # * {Line::Bot::V2::Insight::ApiClient}
57
- #
58
- # Initialize a new client.
59
- #
60
- # @param options [Hash]
61
- # @return [Line::Bot::Client]
62
- def initialize(options = {})
63
- options.each do |key, value|
64
- instance_variable_set("@#{key}", value)
65
- end
66
- yield(self) if block_given?
67
- end
68
-
69
- def httpclient
70
- @httpclient ||= HTTPClient.new(http_options)
71
- end
72
-
73
- def endpoint
74
- @endpoint ||= API::DEFAULT_ENDPOINT
75
- end
76
-
77
- def oauth_endpoint
78
- @oauth_endpoint ||= API::DEFAULT_OAUTH_ENDPOINT
79
- end
80
-
81
- def blob_endpoint
82
- return @blob_endpoint if @blob_endpoint
83
-
84
- @blob_endpoint = if endpoint == API::DEFAULT_ENDPOINT
85
- API::DEFAULT_BLOB_ENDPOINT
86
- else
87
- # for backward compatible
88
- endpoint
89
- end
90
- end
91
-
92
- def liff_endpoint
93
- @liff_endpoint ||= API::DEFAULT_LIFF_ENDPOINT
94
- end
95
-
96
- # @return [Hash]
97
- def credentials
98
- {
99
- "Authorization" => "Bearer #{channel_token}",
100
- }
101
- end
102
-
103
- # @deprecated
104
- # This is deprecated.
105
- # Please use {Line::Bot::V2::ChannelAccessToken::ApiClient#issue_channel_token} instead.
106
- #
107
- # Issue channel access token
108
- #
109
- # @param grant_type [String] Grant type
110
- #
111
- # @return [Net::HTTPResponse]
112
- def issue_channel_token(grant_type = 'client_credentials')
113
- warn '[DEPRECATION] `Line::Bot::Client#issue_channel_token` is deprecated. Please use `Line::Bot::V2::ChannelAccessToken::ApiClient#issue_channel_token` instead.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
114
-
115
- channel_id_required
116
- channel_secret_required
117
-
118
- endpoint_path = '/oauth/accessToken'
119
- payload = URI.encode_www_form(
120
- grant_type: grant_type,
121
- client_id: channel_id,
122
- client_secret: channel_secret
123
- )
124
- headers = { 'Content-Type' => 'application/x-www-form-urlencoded' }
125
- post(endpoint, endpoint_path, payload, headers)
126
- end
127
-
128
- # @deprecated
129
- # This is deprecated.
130
- # Please use {Line::Bot::V2::ChannelAccessToken::ApiClient#revoke_channel_token} instead.
131
- #
132
- # Revoke channel access token
133
- #
134
- # @return [Net::HTTPResponse]
135
- def revoke_channel_token(access_token)
136
- warn '[DEPRECATION] `Line::Bot::Client#revoke_channel_token` is deprecated. Please use `Line::Bot::V2::ChannelAccessToken::ApiClient#revoke_channel_token` instead.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
137
-
138
- endpoint_path = '/oauth/revoke'
139
- payload = URI.encode_www_form(access_token: access_token)
140
- headers = { 'Content-Type' => 'application/x-www-form-urlencoded' }
141
- post(endpoint, endpoint_path, payload, headers)
142
- end
143
-
144
- # @deprecated
145
- # This is deprecated.
146
- # Please use {Line::Bot::V2::ChannelAccessToken::ApiClient#issue_channel_token_by_jwt} instead.
147
- #
148
- # Issue channel access token v2.1
149
- #
150
- # @param jwt [String]
151
- #
152
- # @return [Net::HTTPResponse]
153
- def issue_channel_access_token_jwt(jwt)
154
- warn '[DEPRECATION] `Line::Bot::Client#issue_channel_access_token_jwt` is deprecated. Please use `Line::Bot::V2::ChannelAccessToken::ApiClient#issue_channel_token_by_jwt` instead.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
155
-
156
- endpoint_path = '/oauth2/v2.1/token'
157
- payload = URI.encode_www_form(
158
- grant_type: 'client_credentials',
159
- client_assertion_type: 'urn:ietf:params:oauth:client-assertion-type:jwt-bearer',
160
- client_assertion: jwt
161
- )
162
- headers = { 'Content-Type' => 'application/x-www-form-urlencoded' }
163
- post(oauth_endpoint, endpoint_path, payload, headers)
164
- end
165
-
166
- # @deprecated
167
- # This is deprecated.
168
- # Please use {Line::Bot::V2::ChannelAccessToken::ApiClient#revoke_channel_token_by_jwt} instead.
169
- #
170
- # Revoke channel access token v2.1
171
- #
172
- # @param access_token [String]
173
- #
174
- # @return [Net::HTTPResponse]
175
- def revoke_channel_access_token_jwt(access_token)
176
- warn '[DEPRECATION] `Line::Bot::Client#revoke_channel_access_token_jwt` is deprecated. Please use `Line::Bot::V2::ChannelAccessToken::ApiClient#revoke_channel_token_by_jwt` instead.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
177
-
178
- channel_id_required
179
- channel_secret_required
180
-
181
- endpoint_path = '/oauth2/v2.1/revoke'
182
- payload = URI.encode_www_form(
183
- client_id: channel_id,
184
- client_secret: channel_secret,
185
- access_token: access_token
186
- )
187
- headers = { 'Content-Type' => 'application/x-www-form-urlencoded' }
188
- post(oauth_endpoint, endpoint_path, payload, headers)
189
- end
190
-
191
- # @deprecated
192
- # This is deprecated.
193
- # Please use {Line::Bot::V2::ChannelAccessToken::ApiClient#verify_channel_token_by_jwt} instead.
194
- #
195
- # Verify ID token
196
- #
197
- # @param id_token [String] ID token
198
- # @param nonce [String] Expected nonce value. Use the nonce value provided in the authorization request. Omit if the nonce value was not specified in the authorization request.
199
- # @param user_id [String] Expected user ID.
200
- #
201
- # @return [Net::HTTPResponse]
202
- def verify_id_token(id_token, nonce: nil, user_id: nil)
203
- warn '[DEPRECATION] `Line::Bot::Client#verify_id_token` is deprecated. Please use `Line::Bot::V2::ChannelAccessToken::ApiClient#verify_channel_token_by_jwt` instead.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
204
-
205
- channel_id_required
206
-
207
- endpoint_path = '/oauth2/v2.1/verify'
208
- payload = URI.encode_www_form({
209
- client_id: channel_id,
210
- id_token: id_token,
211
- nonce: nonce,
212
- user_id: user_id
213
- }.compact)
214
- headers = { 'Content-Type' => 'application/x-www-form-urlencoded' }
215
- post(oauth_endpoint, endpoint_path, payload, headers)
216
- end
217
-
218
- # @deprecated
219
- # This is deprecated.
220
- # Please use {Line::Bot::V2::ChannelAccessToken::ApiClient#verify_channel_token} instead.
221
- #
222
- # Verify access token v2.1
223
- #
224
- # @param access_token [String] access token
225
- #
226
- # @return [Net::HTTPResponse]
227
- def verify_access_token(access_token)
228
- warn '[DEPRECATION] `Line::Bot::Client#verify_access_token` is deprecated. Please use `Line::Bot::V2::ChannelAccessToken::ApiClient#verify_channel_token` instead.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
229
-
230
- payload = URI.encode_www_form(
231
- access_token: access_token
232
- )
233
- endpoint_path = "/oauth2/v2.1/verify?#{payload}"
234
- get(oauth_endpoint, endpoint_path)
235
- end
236
-
237
- # @deprecated
238
- # This is deprecated.
239
- # Please use {Line::Bot::V2::ChannelAccessToken::ApiClient#gets_all_valid_channel_access_token_key_ids} instead.
240
- #
241
- # Get all valid channel access token key IDs v2.1
242
- #
243
- # @param jwt [String]
244
- #
245
- # @return [Net::HTTPResponse]
246
- def get_channel_access_token_key_ids_jwt(jwt)
247
- warn '[DEPRECATION] `Line::Bot::Client#get_channel_access_token_key_ids_jwt` is deprecated. Please use `Line::Bot::V2::ChannelAccessToken::ApiClient#gets_all_valid_channel_access_token_key_ids` instead.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
248
-
249
- payload = URI.encode_www_form(
250
- client_assertion_type: 'urn:ietf:params:oauth:client-assertion-type:jwt-bearer',
251
- client_assertion: jwt
252
- )
253
- endpoint_path = "/oauth2/v2.1/tokens/kid?#{payload}"
254
-
255
- headers = { 'Content-Type' => 'application/x-www-form-urlencoded' }
256
- get(oauth_endpoint, endpoint_path, headers)
257
- end
258
-
259
- # @deprecated
260
- # This is obsolete.
261
- #
262
- # Get user profile by access token
263
- #
264
- # @param access_token [String] access token
265
- #
266
- # @return [Net::HTTPResponse]
267
- def get_profile_by_access_token(access_token)
268
- warn '[DEPRECATION] `Line::Bot::Client#get_profile_by_access_token` is obsolete. (LINE Login feature, not bot feature)' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
269
-
270
- headers = {
271
- "Authorization" => "Bearer #{access_token}",
272
- }
273
- endpoint_path = "/v2/profile"
274
- get(oauth_endpoint, endpoint_path, headers)
275
- end
276
-
277
- # @deprecated
278
- # This is deprecated.
279
- # Please use {Line::Bot::V2::MessagingApi::ApiClient#push_message} instead.
280
- #
281
- # Push messages to a user using user_id.
282
- #
283
- # @param user_id [String] User Id
284
- # @param messages [Hash, Array] Message Objects
285
- # @param headers [Hash] HTTP Headers
286
- # @param payload [Hash] Additional request body
287
- # @return [Net::HTTPResponse]
288
- def push_message(user_id, messages, headers: {}, payload: {})
289
- warn '[DEPRECATION] `Line::Bot::Client#push_message` is deprecated. Please use `Line::Bot::V2::MessagingApi::ApiClient#push_message` instead.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
290
-
291
- channel_token_required
292
-
293
- messages = [messages] if messages.is_a?(Hash)
294
-
295
- endpoint_path = '/bot/message/push'
296
- payload = payload.merge({ to: user_id, messages: messages }).to_json
297
- post(endpoint, endpoint_path, payload, credentials.merge(headers))
298
- end
299
-
300
- # @deprecated
301
- # This is deprecated.
302
- # Please use {Line::Bot::V2::MessagingApi::ApiClient#reply_message} instead.
303
- #
304
- # Reply messages to a user using replyToken.
305
- #
306
- # @example Send a balloon to a user.
307
- # message = {
308
- # type: 'text',
309
- # text: 'Hello, World!'
310
- # }
311
- # client.reply_message(event['replyToken'], message)
312
- #
313
- # @example Send multiple balloons to a user.
314
- #
315
- # messages = [
316
- # {type: 'text', text: 'Message1'},
317
- # {type: 'text', text: 'Message2'}
318
- # ]
319
- # client.reply_message(event['replyToken'], messages)
320
- #
321
- # @param token [String] Reply Token
322
- # @param messages [Hash, Array] Message Objects
323
- # @return [Net::HTTPResponse]
324
- def reply_message(token, messages)
325
- warn '[DEPRECATION] `Line::Bot::Client#reply_message` is deprecated. Please use `Line::Bot::V2::MessagingApi::ApiClient#reply_message` instead.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
326
-
327
- channel_token_required
328
-
329
- messages = [messages] if messages.is_a?(Hash)
330
-
331
- endpoint_path = '/bot/message/reply'
332
- payload = { replyToken: token, messages: messages }.to_json
333
- post(endpoint, endpoint_path, payload, credentials)
334
- end
335
-
336
- # @deprecated
337
- # This is deprecated.
338
- # Please use {Line::Bot::V2::MessagingApi::ApiClient#multicast} instead.
339
- #
340
- # Send messages to multiple users using userIds.
341
- #
342
- # @param to [Array, String] Array of userIds
343
- # @param messages [Hash, Array] Message Objects
344
- # @param headers [Hash] HTTP Headers
345
- # @param payload [Hash] Additional request body
346
- # @return [Net::HTTPResponse]
347
- def multicast(to, messages, headers: {}, payload: {})
348
- warn '[DEPRECATION] `Line::Bot::Client#multicast` is deprecated. Please use `Line::Bot::V2::MessagingApi::ApiClient#multicast` instead.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
349
-
350
- channel_token_required
351
-
352
- to = [to] if to.is_a?(String)
353
- messages = [messages] if messages.is_a?(Hash)
354
-
355
- endpoint_path = '/bot/message/multicast'
356
- payload = payload.merge({ to: to, messages: messages }).to_json
357
- post(endpoint, endpoint_path, payload, credentials.merge(headers))
358
- end
359
-
360
- # @deprecated
361
- # This is deprecated.
362
- # Please use {Line::Bot::V2::MessagingApi::ApiClient#broadcast} instead.
363
- #
364
- # Send messages to all friends.
365
- #
366
- # @param messages [Hash, Array] Message Objects
367
- # @param headers [Hash] HTTP Headers
368
- #
369
- # @return [Net::HTTPResponse]
370
- def broadcast(messages, headers: {})
371
- warn '[DEPRECATION] `Line::Bot::Client#broadcast` is deprecated. Please use `Line::Bot::V2::MessagingApi::ApiClient#broadcast` instead.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
372
-
373
- channel_token_required
374
-
375
- messages = [messages] if messages.is_a?(Hash)
376
-
377
- endpoint_path = '/bot/message/broadcast'
378
- payload = { messages: messages }.to_json
379
- post(endpoint, endpoint_path, payload, credentials.merge(headers))
380
- end
381
-
382
- # @deprecated
383
- # This is deprecated.
384
- # Please use {Line::Bot::V2::MessagingApi::ApiClient#narrowcast} instead.
385
- #
386
- # Narrowcast messages to users
387
- #
388
- # API Documentation is here.
389
- # https://developers.line.biz/en/reference/messaging-api/#send-narrowcast-message
390
- #
391
- # @param messages [Hash, Array]
392
- # @param recipient [Hash]
393
- # @param filter [Hash]
394
- # @param limit [Hash]
395
- # @param headers [Hash] HTTP Headers
396
- #
397
- # @return [Net::HTTPResponse]
398
- def narrowcast(messages, recipient: nil, filter: nil, limit: nil, headers: {})
399
- warn '[DEPRECATION] `Line::Bot::Client#narrowcast` is deprecated. Please use `Line::Bot::V2::MessagingApi::ApiClient#narrowcast` instead.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
400
-
401
- channel_token_required
402
-
403
- messages = [messages] if messages.is_a?(Hash)
404
-
405
- endpoint_path = '/bot/message/narrowcast'
406
- payload = {
407
- messages: messages,
408
- recipient: recipient,
409
- filter: filter,
410
- limit: limit
411
- }.to_json
412
- post(endpoint, endpoint_path, payload, credentials.merge(headers))
413
- end
414
-
415
- # @deprecated
416
- # This is deprecated.
417
- # Please use {Line::Bot::V2::MessagingApi::ApiClient#leave_group} instead.
418
- #
419
- def leave_group(group_id)
420
- warn '[DEPRECATION] `Line::Bot::Client#leave_group` is deprecated. Please use `Line::Bot::V2::MessagingApi::ApiClient#leave_group` instead.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
421
-
422
- channel_token_required
423
-
424
- endpoint_path = "/bot/group/#{group_id}/leave"
425
- post(endpoint, endpoint_path, nil, credentials)
426
- end
427
-
428
- # @deprecated
429
- # This is deprecated.
430
- # Please use {Line::Bot::V2::MessagingApi::ApiClient#leave_room} instead.
431
- #
432
- def leave_room(room_id)
433
- warn '[DEPRECATION] `Line::Bot::Client#leave_room` is deprecated. Please use `Line::Bot::V2::MessagingApi::ApiClient#leave_room` instead.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
434
-
435
- channel_token_required
436
-
437
- endpoint_path = "/bot/room/#{room_id}/leave"
438
- post(endpoint, endpoint_path, nil, credentials)
439
- end
440
-
441
- # @deprecated
442
- # This is deprecated.
443
- # Please use {Line::Bot::V2::MessagingApi::ApiBlobClient#get_message_content} instead.
444
- #
445
- # Get message content.
446
- #
447
- # @param identifier [String] Message's identifier
448
- # @return [Net::HTTPResponse]
449
- def get_message_content(identifier)
450
- warn '[DEPRECATION] `Line::Bot::Client#get_message_content` is deprecated. Please use `Line::Bot::V2::MessagingApi::ApiBlobClient#get_message_content` instead.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
451
-
452
- channel_token_required
453
-
454
- endpoint_path = "/bot/message/#{identifier}/content"
455
- get(blob_endpoint, endpoint_path, credentials)
456
- end
457
-
458
- # @deprecated
459
- # This is deprecated.
460
- # Please use {Line::Bot::V2::MessagingApi::ApiClient#get_profile} instead.
461
- #
462
- # Get an user's profile.
463
- #
464
- # @param user_id [String] User Id user_id
465
- # @return [Net::HTTPResponse]
466
- def get_profile(user_id)
467
- warn '[DEPRECATION] `Line::Bot::Client#get_profile` is deprecated. Please use `Line::Bot::V2::MessagingApi::ApiClient#get_profile` instead.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
468
-
469
- channel_token_required
470
-
471
- endpoint_path = "/bot/profile/#{user_id}"
472
- get(endpoint, endpoint_path, credentials)
473
- end
474
-
475
- # @deprecated
476
- # This is deprecated.
477
- # Please use {Line::Bot::V2::MessagingApi::ApiClient#get_group_member_profile} instead.
478
- #
479
- # Get an user's profile of a group.
480
- #
481
- # @param group_id [String] Group's identifier
482
- # @param user_id [String] User Id user_id
483
- #
484
- # @return [Net::HTTPResponse]
485
- def get_group_member_profile(group_id, user_id)
486
- warn '[DEPRECATION] `Line::Bot::Client#get_group_member_profile` is deprecated. Please use `Line::Bot::V2::MessagingApi::ApiClient#get_group_member_profile` instead.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
487
-
488
- channel_token_required
489
-
490
- endpoint_path = "/bot/group/#{group_id}/member/#{user_id}"
491
- get(endpoint, endpoint_path, credentials)
492
- end
493
-
494
- # @deprecated
495
- # This is deprecated.
496
- # Please use {Line::Bot::V2::MessagingApi::ApiClient#get_room_member_profile} instead.
497
- #
498
- # Get an user's profile of a room.
499
- #
500
- # @param room_id [String] Room's identifier
501
- # @param user_id [String] User Id user_id
502
- #
503
- # @return [Net::HTTPResponse]
504
- def get_room_member_profile(room_id, user_id)
505
- warn '[DEPRECATION] `Line::Bot::Client#get_room_member_profile` is deprecated. Please use `Line::Bot::V2::MessagingApi::ApiClient#get_room_member_profile` instead.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
506
-
507
- channel_token_required
508
-
509
- endpoint_path = "/bot/room/#{room_id}/member/#{user_id}"
510
- get(endpoint, endpoint_path, credentials)
511
- end
512
-
513
- # @deprecated
514
- # This is deprecated.
515
- # Please use {Line::Bot::V2::MessagingApi::ApiClient#get_followers} instead.
516
- #
517
- # Get user IDs of who added your LINE Official Account as a friend
518
- #
519
- # @param start [String] Identifier to return next page (next property to be included in the response)
520
- # @param limit [Integer] The maximum number of user IDs to retrieve in a single request
521
- #
522
- # @return [Net::HTTPResponse]
523
- def get_follower_ids(deprecated_continuation_token = nil, start: nil, limit: nil)
524
- warn '[DEPRECATION] `Line::Bot::Client#get_follower_ids` is deprecated. Please use `Line::Bot::V2::MessagingApi::ApiClient#get_followers` instead.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
525
-
526
- channel_token_required
527
-
528
- if deprecated_continuation_token
529
- warn "continuation_token as the first argument is deprecated. Please use :start instead."
530
- start = deprecated_continuation_token
531
- end
532
-
533
- params = { start: start, limit: limit }.compact
534
-
535
- endpoint_path = "/bot/followers/ids"
536
- endpoint_path += "?" + URI.encode_www_form(params) unless params.empty?
537
- get(endpoint, endpoint_path, credentials)
538
- end
539
-
540
- # @deprecated
541
- # This is deprecated.
542
- # Please use {Line::Bot::V2::MessagingApi::ApiClient#get_group_members_ids} instead.
543
- #
544
- # Get user IDs of a group
545
- #
546
- # @param group_id [String] Group's identifier
547
- # @param continuation_token [String] Identifier to return next page
548
- # (next property to be included in the response)
549
- #
550
- # @return [Net::HTTPResponse]
551
- def get_group_member_ids(group_id, continuation_token = nil)
552
- warn '[DEPRECATION] `Line::Bot::Client#get_group_member_ids` is deprecated. Please use `Line::Bot::V2::MessagingApi::ApiClient#get_group_members_ids` instead.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
553
-
554
- channel_token_required
555
-
556
- endpoint_path = "/bot/group/#{group_id}/members/ids"
557
- endpoint_path += "?start=#{continuation_token}" if continuation_token
558
- get(endpoint, endpoint_path, credentials)
559
- end
560
-
561
- # @deprecated
562
- # This is deprecated.
563
- # Please use {Line::Bot::V2::MessagingApi::ApiClient#get_room_members_ids} instead.
564
- #
565
- # Get user IDs of a room
566
- #
567
- # @param room_id [String] Room's identifier
568
- # @param continuation_token [String] Identifier to return next page
569
- # (next property to be included in the response)
570
- #
571
- # @return [Net::HTTPResponse]
572
- def get_room_member_ids(room_id, continuation_token = nil)
573
- warn '[DEPRECATION] `Line::Bot::Client#get_room_member_ids` is deprecated. Please use `Line::Bot::V2::MessagingApi::ApiClient#get_room_members_ids` instead.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
574
-
575
- channel_token_required
576
-
577
- endpoint_path = "/bot/room/#{room_id}/members/ids"
578
- endpoint_path += "?start=#{continuation_token}" if continuation_token
579
- get(endpoint, endpoint_path, credentials)
580
- end
581
-
582
- # @deprecated
583
- # This is deprecated.
584
- # Please use {Line::Bot::V2::MessagingApi::ApiClient#get_group_summary} instead.
585
- #
586
- # Gets the group ID, group name, and group icon URL of a group where the LINE Official Account is a member.
587
- #
588
- # @param group_id [String] Group's identifier
589
- #
590
- # @return [Net::HTTPResponse]
591
- def get_group_summary(group_id)
592
- warn '[DEPRECATION] `Line::Bot::Client#get_group_summary` is deprecated. Please use `Line::Bot::V2::MessagingApi::ApiClient#get_group_summary` instead.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
593
-
594
- channel_token_required
595
-
596
- endpoint_path = "/bot/group/#{group_id}/summary"
597
- get(endpoint, endpoint_path, credentials)
598
- end
599
-
600
- # @deprecated
601
- # This is deprecated.
602
- # Please use {Line::Bot::V2::MessagingApi::ApiClient#get_group_member_count} instead.
603
- #
604
- # Gets the user IDs of the members of a group that the bot is in.
605
- #
606
- # @param group_id [String] Group's identifier
607
- #
608
- # @return [Net::HTTPResponse]
609
- def get_group_members_count(group_id)
610
- warn '[DEPRECATION] `Line::Bot::Client#get_group_members_count` is deprecated. Please use `Line::Bot::V2::MessagingApi::ApiClient#get_group_member_count` instead.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
611
-
612
- channel_token_required
613
-
614
- endpoint_path = "/bot/group/#{group_id}/members/count"
615
- get(endpoint, endpoint_path, credentials)
616
- end
617
-
618
- # @deprecated
619
- # This is deprecated.
620
- # Please use {Line::Bot::V2::MessagingApi::ApiClient#get_room_member_count} instead.
621
- #
622
- # Gets the count of members in a room.
623
- #
624
- # @param room_id [String] Room's identifier
625
- #
626
- # @return [Net::HTTPResponse]
627
- def get_room_members_count(room_id)
628
- warn '[DEPRECATION] `Line::Bot::Client#get_room_members_count` is deprecated. Please use `Line::Bot::V2::MessagingApi::ApiClient#get_room_member_count` instead.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
629
-
630
- channel_token_required
631
-
632
- endpoint_path = "/bot/room/#{room_id}/members/count"
633
- get(endpoint, endpoint_path, credentials)
634
- end
635
-
636
- # @deprecated
637
- # This is deprecated.
638
- # Please use {Line::Bot::V2::MessagingApi::ApiClient#get_rich_menu_list} instead.
639
- #
640
- # Get a list of all uploaded rich menus
641
- #
642
- # @return [Net::HTTPResponse]
643
- def get_rich_menus
644
- warn '[DEPRECATION] `Line::Bot::Client#get_rich_menus` is deprecated. Please use `Line::Bot::V2::MessagingApi::ApiClient#get_rich_menu_list` instead.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
645
-
646
- channel_token_required
647
-
648
- endpoint_path = '/bot/richmenu/list'
649
- get(endpoint, endpoint_path, credentials)
650
- end
651
-
652
- # @deprecated
653
- # This is deprecated.
654
- # Please use {Line::Bot::V2::MessagingApi::ApiClient#get_rich_menu} instead.
655
- #
656
- # Get a rich menu via a rich menu ID
657
- #
658
- # @param rich_menu_id [String] ID of an uploaded rich menu
659
- #
660
- # @return [Net::HTTPResponse]
661
- def get_rich_menu(rich_menu_id)
662
- warn '[DEPRECATION] `Line::Bot::Client#get_rich_menu` is deprecated. Please use `Line::Bot::V2::MessagingApi::ApiClient#get_rich_menu` instead.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
663
-
664
- channel_token_required
665
-
666
- endpoint_path = "/bot/richmenu/#{rich_menu_id}"
667
- get(endpoint, endpoint_path, credentials)
668
- end
669
-
670
- # @deprecated
671
- # This is deprecated.
672
- # Please use {Line::Bot::V2::MessagingApi::ApiClient#get_number_of_sent_reply_messages} instead.
673
- #
674
- # Gets the number of messages sent with the /bot/message/reply endpoint.
675
- #
676
- # @param date [String] Date the messages were sent (format: yyyyMMdd)
677
- #
678
- # @return [Net::HTTPResponse]
679
- def get_message_delivery_reply(date)
680
- warn '[DEPRECATION] `Line::Bot::Client#get_message_delivery_reply` is deprecated. Please use `Line::Bot::V2::MessagingApi::ApiClient#get_number_of_sent_reply_messages` instead.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
681
-
682
- channel_token_required
683
-
684
- endpoint_path = "/bot/message/delivery/reply?date=#{date}"
685
- get(endpoint, endpoint_path, credentials)
686
- end
687
-
688
- # @deprecated
689
- # This is deprecated.
690
- # Please use {Line::Bot::V2::MessagingApi::ApiClient#get_message_delivery_push} instead.
691
- #
692
- # Gets the number of messages sent with the /bot/message/push endpoint.
693
- #
694
- # @param date [String] Date the messages were sent (format: yyyyMMdd)
695
- #
696
- # @return [Net::HTTPResponse]
697
- def get_message_delivery_push(date)
698
- warn '[DEPRECATION] `Line::Bot::Client#get_message_delivery_push` is deprecated. Please use `Line::Bot::V2::MessagingApi::ApiClient#get_message_delivery_push` instead.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
699
-
700
- channel_token_required
701
-
702
- endpoint_path = "/bot/message/delivery/push?date=#{date}"
703
- get(endpoint, endpoint_path, credentials)
704
- end
705
-
706
- # @deprecated
707
- # This is deprecated.
708
- # Please use {Line::Bot::V2::MessagingApi::ApiClient#get_number_of_sent_multicast_messages} instead.
709
- #
710
- # Gets the number of messages sent with the /bot/message/multicast endpoint.
711
- #
712
- # @param date [String] Date the messages were sent (format: yyyyMMdd)
713
- #
714
- # @return [Net::HTTPResponse]
715
- def get_message_delivery_multicast(date)
716
- warn '[DEPRECATION] `Line::Bot::Client#get_message_delivery_multicast` is deprecated. Please use `Line::Bot::V2::MessagingApi::ApiClient#get_number_of_sent_multicast_messages` instead.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
717
-
718
- channel_token_required
719
-
720
- endpoint_path = "/bot/message/delivery/multicast?date=#{date}"
721
- get(endpoint, endpoint_path, credentials)
722
- end
723
-
724
- # @deprecated
725
- # This is deprecated.
726
- # Please use {Line::Bot::V2::MessagingApi::ApiClient#get_number_of_sent_broadcast_messages} instead.
727
- #
728
- # Gets the number of messages sent with the /bot/message/multicast endpoint.
729
- #
730
- # @param date [String] Date the messages were sent (format: yyyyMMdd)
731
- #
732
- # @return [Net::HTTPResponse]
733
- def get_message_delivery_broadcast(date)
734
- warn '[DEPRECATION] `Line::Bot::Client#get_message_delivery_broadcast` is deprecated. Please use `Line::Bot::V2::MessagingApi::ApiClient#get_number_of_sent_broadcast_messages` instead.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
735
-
736
- channel_token_required
737
-
738
- endpoint_path = "/bot/message/delivery/broadcast?date=#{date}"
739
- get(endpoint, endpoint_path, credentials)
740
- end
741
-
742
- # @deprecated
743
- # This is deprecated.
744
- # Please use {Line::Bot::V2::MessagingApi::ApiClient#validate_reply} instead.
745
- #
746
- # Validate message objects of a reply message
747
- #
748
- # @param messages [Array] Array of message objects to validate
749
- #
750
- # @return [Net::HTTPResponse]
751
- def validate_reply_message_objects(messages)
752
- warn '[DEPRECATION] `Line::Bot::Client#validate_reply_message_objects` is deprecated. Please use `Line::Bot::V2::MessagingApi::ApiClient#validate_reply` instead.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
753
-
754
- channel_token_required
755
-
756
- endpoint_path = '/bot/message/validate/reply'
757
- payload = { messages: messages }.to_json
758
- post(endpoint, endpoint_path, payload, credentials)
759
- end
760
-
761
- # @deprecated
762
- # This is deprecated.
763
- # Please use {Line::Bot::V2::MessagingApi::ApiClient#validate_push} instead.
764
- #
765
- # Validate message objects of a push message
766
- #
767
- # @param messages [Array] Array of message objects to validate
768
- #
769
- # @return [Net::HTTPResponse]
770
- def validate_push_message_objects(messages)
771
- warn '[DEPRECATION] `Line::Bot::Client#validate_push_message_objects` is deprecated. Please use `Line::Bot::V2::MessagingApi::ApiClient#validate_push` instead.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
772
-
773
- channel_token_required
774
-
775
- endpoint_path = '/bot/message/validate/push'
776
- payload = { messages: messages }.to_json
777
- post(endpoint, endpoint_path, payload, credentials)
778
- end
779
-
780
- # @deprecated
781
- # This is deprecated.
782
- # Please use {Line::Bot::V2::MessagingApi::ApiClient#validate_multicast} instead.
783
- #
784
- # Validate message objects of a multicast message
785
- #
786
- # @param messages [Array] Array of message objects to validate
787
- #
788
- # @return [Net::HTTPResponse]
789
- def validate_multicast_message_objects(messages)
790
- warn '[DEPRECATION] `Line::Bot::Client#validate_multicast_message_objects` is deprecated. Please use `Line::Bot::V2::MessagingApi::ApiClient#validate_multicast` instead.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
791
-
792
- channel_token_required
793
-
794
- endpoint_path = '/bot/message/validate/multicast'
795
- payload = { messages: messages }.to_json
796
- post(endpoint, endpoint_path, payload, credentials)
797
- end
798
-
799
- # @deprecated
800
- # This is deprecated.
801
- # Please use {Line::Bot::V2::MessagingApi::ApiClient#validate_narrowcast} instead.
802
- #
803
- # Validate message objects of a narrowcast message
804
- #
805
- # @param messages [Array] Array of message objects to validate
806
- #
807
- # @return [Net::HTTPResponse]
808
- def validate_narrowcast_message_objects(messages)
809
- warn '[DEPRECATION] `Line::Bot::Client#validate_narrowcast_message_objects` is deprecated. Please use `Line::Bot::V2::MessagingApi::ApiClient#validate_narrowcast` instead.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
810
-
811
- channel_token_required
812
-
813
- endpoint_path = '/bot/message/validate/narrowcast'
814
- payload = { messages: messages }.to_json
815
- post(endpoint, endpoint_path, payload, credentials)
816
- end
817
-
818
- # @deprecated
819
- # This is deprecated.
820
- # Please use {Line::Bot::V2::MessagingApi::ApiClient#validate_broadcast} instead.
821
- #
822
- # Validate message objects of a broadcast message
823
- #
824
- # @param messages [Array] Array of message objects to validate
825
- #
826
- # @return [Net::HTTPResponse]
827
- def validate_broadcast_message_objects(messages)
828
- warn '[DEPRECATION] `Line::Bot::Client#validate_broadcast_message_objects` is deprecated. Please use `Line::Bot::V2::MessagingApi::ApiClient#validate_broadcast` instead.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
829
-
830
- channel_token_required
831
-
832
- endpoint_path = '/bot/message/validate/broadcast'
833
- payload = { messages: messages }.to_json
834
- post(endpoint, endpoint_path, payload, credentials)
835
- end
836
-
837
- # @deprecated
838
- # This is deprecated.
839
- # Please use {Line::Bot::V2::MessagingApi::ApiClient#create_rich_menu} instead.
840
- #
841
- # Create a rich menu
842
- #
843
- # @param rich_menu [Hash] The rich menu represented as a rich menu object
844
- #
845
- # @return [Net::HTTPResponse]
846
- def create_rich_menu(rich_menu)
847
- warn '[DEPRECATION] `Line::Bot::Client#create_rich_menu` is deprecated. Please use `Line::Bot::V2::MessagingApi::ApiClient#create_rich_menu` instead.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
848
-
849
- channel_token_required
850
-
851
- endpoint_path = '/bot/richmenu'
852
- post(endpoint, endpoint_path, rich_menu.to_json, credentials)
853
- end
854
-
855
- # @deprecated
856
- # This is deprecated.
857
- # Please use {Line::Bot::V2::MessagingApi::ApiClient#validate_rich_menu_object} instead.
858
- #
859
- # Validate a rich menu object
860
- #
861
- # @param rich_menu [Hash] The rich menu represented as a rich menu object
862
- #
863
- # @return [Net::HTTPResponse]
864
- def validate_rich_menu_object(rich_menu)
865
- warn '[DEPRECATION] `Line::Bot::Client#validate_rich_menu_object` is deprecated. Please use `Line::Bot::V2::MessagingApi::ApiClient#validate_rich_menu_object` instead.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
866
-
867
- channel_token_required
868
-
869
- endpoint_path = '/bot/richmenu/validate'
870
- post(endpoint, endpoint_path, rich_menu.to_json, credentials)
871
- end
872
-
873
- # @deprecated
874
- # This is deprecated.
875
- # Please use {Line::Bot::V2::MessagingApi::ApiClient#delete_rich_menu} instead.
876
- #
877
- # Delete a rich menu
878
- #
879
- # @param rich_menu_id [String] ID of an uploaded rich menu
880
- #
881
- # @return [Net::HTTPResponse]
882
- def delete_rich_menu(rich_menu_id)
883
- warn '[DEPRECATION] `Line::Bot::Client#delete_rich_menu` is deprecated. Please use `Line::Bot::V2::MessagingApi::ApiClient#delete_rich_menu` instead.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
884
-
885
- channel_token_required
886
-
887
- endpoint_path = "/bot/richmenu/#{rich_menu_id}"
888
- delete(endpoint, endpoint_path, credentials)
889
- end
890
-
891
- # @deprecated
892
- # This is deprecated.
893
- # Please use {Line::Bot::V2::MessagingApi::ApiClient#get_rich_menu_id_of_user} instead.
894
- #
895
- # Get the ID of the rich menu linked to a user
896
- #
897
- # @param user_id [String] ID of the user
898
- #
899
- # @return [Net::HTTPResponse]
900
- def get_user_rich_menu(user_id)
901
- warn '[DEPRECATION] `Line::Bot::Client#get_user_rich_menu` is deprecated. Please use `Line::Bot::V2::MessagingApi::ApiClient#get_rich_menu_id_of_user` instead.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
902
-
903
- channel_token_required
904
-
905
- endpoint_path = "/bot/user/#{user_id}/richmenu"
906
- get(endpoint, endpoint_path, credentials)
907
- end
908
-
909
- # @deprecated
910
- # This is deprecated.
911
- # Please use {Line::Bot::V2::MessagingApi::ApiClient#get_default_rich_menu_id} instead.
912
- #
913
- # Get default rich menu
914
- #
915
- # @return [Net::HTTPResponse]
916
- def get_default_rich_menu
917
- warn '[DEPRECATION] `Line::Bot::Client#get_default_rich_menu` is deprecated. Please use `Line::Bot::V2::MessagingApi::ApiClient#get_default_rich_menu_id` instead.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
918
-
919
- channel_token_required
920
-
921
- endpoint_path = '/bot/user/all/richmenu'
922
- get(endpoint, endpoint_path, credentials)
923
- end
924
-
925
- # @deprecated
926
- # This is deprecated.
927
- # Please use {Line::Bot::V2::MessagingApi::ApiClient#set_default_rich_menu} instead.
928
- #
929
- # Set default rich menu (Link a rich menu to all user)
930
- #
931
- # @param rich_menu_id [String] ID of an uploaded rich menu
932
- #
933
- # @return [Net::HTTPResponse]
934
- def set_default_rich_menu(rich_menu_id)
935
- warn '[DEPRECATION] `Line::Bot::Client#set_default_rich_menu` is deprecated. Please use `Line::Bot::V2::MessagingApi::ApiClient#set_default_rich_menu` instead.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
936
-
937
- channel_token_required
938
-
939
- endpoint_path = "/bot/user/all/richmenu/#{rich_menu_id}"
940
- post(endpoint, endpoint_path, nil, credentials)
941
- end
942
-
943
- # @deprecated
944
- # This is deprecated.
945
- # Please use {Line::Bot::V2::MessagingApi::ApiClient#cancel_default_rich_menu} instead.
946
- #
947
- # Unset default rich menu (Unlink a rich menu from all user)
948
- #
949
- # @return [Net::HTTPResponse]
950
- def unset_default_rich_menu
951
- warn '[DEPRECATION] `Line::Bot::Client#unset_default_rich_menu` is deprecated. Please use `Line::Bot::V2::MessagingApi::ApiClient#cancel_default_rich_menu` instead.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
952
-
953
- channel_token_required
954
-
955
- endpoint_path = "/bot/user/all/richmenu"
956
- delete(endpoint, endpoint_path, credentials)
957
- end
958
-
959
- # @deprecated
960
- # This is deprecated.
961
- # Please use {Line::Bot::V2::MessagingApi::ApiClient#create_rich_menu_alias} instead.
962
- #
963
- # Set rich menu alias
964
- #
965
- # @param rich_menu_id [String] ID of an uploaded rich menu
966
- # @param rich_menu_alias_id [String] string of alias words rich menu
967
- #
968
- # @return [Net::HTTPResponse]
969
- def set_rich_menus_alias(rich_menu_id, rich_menu_alias_id)
970
- warn '[DEPRECATION] `Line::Bot::Client#set_rich_menus_alias` is deprecated. Please use `Line::Bot::V2::MessagingApi::ApiClient#create_rich_menu_alias` instead.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
971
-
972
- channel_token_required
973
-
974
- endpoint_path = '/bot/richmenu/alias'
975
- post(endpoint, endpoint_path, { richMenuId: rich_menu_id, richMenuAliasId: rich_menu_alias_id }.to_json, credentials)
976
- end
977
-
978
- # @deprecated
979
- # This is deprecated.
980
- # Please use {Line::Bot::V2::MessagingApi::ApiClient#delete_rich_menu_alias} instead.
981
- #
982
- # Unset rich menu alias
983
- #
984
- # @param rich_menu_alias_id [String] string of alias words rich menu
985
- #
986
- # @return [Net::HTTPResponse]
987
- def unset_rich_menus_alias(rich_menu_alias_id)
988
- warn '[DEPRECATION] `Line::Bot::Client#unset_rich_menus_alias` is deprecated. Please use `Line::Bot::V2::MessagingApi::ApiClient#delete_rich_menu_alias` instead.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
989
-
990
- channel_token_required
991
-
992
- endpoint_path = "/bot/richmenu/alias/#{rich_menu_alias_id}"
993
- delete(endpoint, endpoint_path, credentials)
994
- end
995
-
996
- # @deprecated
997
- # This is deprecated.
998
- # Please use {Line::Bot::V2::MessagingApi::ApiClient#update_rich_menu_alias} instead.
999
- #
1000
- # Update rich menu alias
1001
- #
1002
- # @param rich_menu_id [String] ID of an uploaded rich menu
1003
- # @param rich_menu_alias_id [String] string of alias words rich menu
1004
- #
1005
- # @return [Net::HTTPResponse]
1006
- def update_rich_menus_alias(rich_menu_id, rich_menu_alias_id)
1007
- warn '[DEPRECATION] `Line::Bot::Client#update_rich_menus_alias` is deprecated. Please use `Line::Bot::V2::MessagingApi::ApiClient#update_rich_menu_alias` instead.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
1008
-
1009
- channel_token_required
1010
-
1011
- endpoint_path = "/bot/richmenu/alias/#{rich_menu_alias_id}"
1012
- post(endpoint, endpoint_path, { richMenuId: rich_menu_id }.to_json, credentials)
1013
- end
1014
-
1015
- # @deprecated
1016
- # This is deprecated.
1017
- # Please use {Line::Bot::V2::MessagingApi::ApiClient#get_rich_menu_alias} instead.
1018
- #
1019
- # Get a rich menu alias via a rich menu alias ID
1020
- #
1021
- # @param rich_menu_alias_id [String] string of alias words rich menu
1022
- #
1023
- # @return [Net::HTTPResponse]
1024
- def get_rich_menus_alias(rich_menu_alias_id)
1025
- warn '[DEPRECATION] `Line::Bot::Client#get_rich_menus_alias` is deprecated. Please use `Line::Bot::V2::MessagingApi::ApiClient#get_rich_menu_alias` instead.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
1026
-
1027
- channel_token_required
1028
-
1029
- endpoint_path = "/bot/richmenu/alias/#{rich_menu_alias_id}"
1030
- get(endpoint, endpoint_path, credentials)
1031
- end
1032
-
1033
- # @deprecated
1034
- # This is deprecated.
1035
- # Please use {Line::Bot::V2::MessagingApi::ApiClient#get_rich_menu_alias_list} instead.
1036
- #
1037
- # Get a list of all uploaded rich menus alias
1038
- #
1039
- # @return [Net::HTTPResponse]
1040
- def get_rich_menus_alias_list
1041
- warn '[DEPRECATION] `Line::Bot::Client#get_rich_menus_alias_list` is deprecated. Please use `Line::Bot::V2::MessagingApi::ApiClient#get_rich_menu_alias_list` instead.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
1042
-
1043
- channel_token_required
1044
-
1045
- endpoint_path = "/bot/richmenu/alias/list"
1046
- get(endpoint, endpoint_path, credentials)
1047
- end
1048
-
1049
- # @deprecated
1050
- # This is deprecated.
1051
- # Please use {Line::Bot::V2::MessagingApi::ApiClient#link_rich_menu_id_to_user} instead.
1052
- #
1053
- # Link a rich menu to a user
1054
- #
1055
- # If you want to link a rich menu to multiple users,
1056
- # please consider to use bulk_link_rich_menus.
1057
- #
1058
- # @param user_id [String] ID of the user
1059
- # @param rich_menu_id [String] ID of an uploaded rich menu
1060
- #
1061
- # @return [Net::HTTPResponse]
1062
- def link_user_rich_menu(user_id, rich_menu_id)
1063
- warn '[DEPRECATION] `Line::Bot::Client#link_user_rich_menu` is deprecated. Please use `Line::Bot::V2::MessagingApi::ApiClient#link_rich_menu_id_to_user` instead.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
1064
-
1065
- channel_token_required
1066
-
1067
- endpoint_path = "/bot/user/#{user_id}/richmenu/#{rich_menu_id}"
1068
- post(endpoint, endpoint_path, nil, credentials)
1069
- end
1070
-
1071
- # @deprecated
1072
- # This is deprecated.
1073
- # Please use {Line::Bot::V2::MessagingApi::ApiClient#unlink_rich_menu_id_from_user} instead.
1074
- #
1075
- # Unlink a rich menu from a user
1076
- #
1077
- # @param user_id [String] ID of the user
1078
- #
1079
- # @return [Net::HTTPResponse]
1080
- def unlink_user_rich_menu(user_id)
1081
- warn '[DEPRECATION] `Line::Bot::Client#unlink_user_rich_menu` is deprecated. Please use `Line::Bot::V2::MessagingApi::ApiClient#unlink_rich_menu_id_from_user` instead.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
1082
-
1083
- channel_token_required
1084
-
1085
- endpoint_path = "/bot/user/#{user_id}/richmenu"
1086
- delete(endpoint, endpoint_path, credentials)
1087
- end
1088
-
1089
- # @deprecated
1090
- # This is deprecated.
1091
- # Please use {Line::Bot::V2::MessagingApi::ApiClient#link_rich_menu_id_to_users} instead.
1092
- #
1093
- # To link a rich menu to multiple users at a time
1094
- #
1095
- # @param user_ids [Array] ID of the user
1096
- # @param rich_menu_id [String] ID of the uploaded rich menu
1097
- #
1098
- # @return [Net::HTTPResponse]
1099
- def bulk_link_rich_menus(user_ids, rich_menu_id)
1100
- warn '[DEPRECATION] `Line::Bot::Client#bulk_link_rich_menus` is deprecated. Please use `Line::Bot::V2::MessagingApi::ApiClient#link_rich_menu_id_to_users` instead.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
1101
-
1102
- channel_token_required
1103
-
1104
- endpoint_path = "/bot/richmenu/bulk/link"
1105
- post(endpoint, endpoint_path, { richMenuId: rich_menu_id, userIds: user_ids }.to_json, credentials)
1106
- end
1107
-
1108
- # @deprecated
1109
- # This is deprecated.
1110
- # Please use {Line::Bot::V2::MessagingApi::ApiClient#unlink_rich_menu_id_from_users} instead.
1111
- #
1112
- # To unlink a rich menu from multiple users at a time
1113
- #
1114
- # @param user_ids [Array] ID of the user
1115
- #
1116
- # @return [Net::HTTPResponse]
1117
- def bulk_unlink_rich_menus(user_ids)
1118
- warn '[DEPRECATION] `Line::Bot::Client#bulk_unlink_rich_menus` is deprecated. Please use `Line::Bot::V2::MessagingApi::ApiClient#unlink_rich_menu_id_from_users` instead.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
1119
-
1120
- channel_token_required
1121
-
1122
- endpoint_path = "/bot/richmenu/bulk/unlink"
1123
- post(endpoint, endpoint_path, { userIds: user_ids }.to_json, credentials)
1124
- end
1125
-
1126
- # @deprecated
1127
- # This is deprecated.
1128
- # Please use {Line::Bot::V2::MessagingApi::ApiBlobClient#get_rich_menu_image} instead.
1129
- #
1130
- # Download an image associated with a rich menu
1131
- #
1132
- # @param rich_menu_id [String] ID of an uploaded rich menu
1133
- #
1134
- # @return [Net::HTTPResponse]
1135
- def get_rich_menu_image(rich_menu_id)
1136
- warn '[DEPRECATION] `Line::Bot::Client#get_rich_menu_image` is deprecated. Please use `Line::Bot::V2::MessagingApi::ApiBlobClient#get_rich_menu_image` instead.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
1137
-
1138
- channel_token_required
1139
-
1140
- endpoint_path = "/bot/richmenu/#{rich_menu_id}/content"
1141
- get(blob_endpoint, endpoint_path, credentials)
1142
- end
1143
-
1144
- # @deprecated
1145
- # This is deprecated.
1146
- # Please use {Line::Bot::V2::MessagingApi::ApiBlobClient#set_rich_menu_image} instead.
1147
- #
1148
- # Upload and attaches an image to a rich menu
1149
- #
1150
- # @param rich_menu_id [String] The ID of the rich menu to attach the image to
1151
- # @param file [File] Image file to attach rich menu
1152
- #
1153
- # @return [Net::HTTPResponse]
1154
- def create_rich_menu_image(rich_menu_id, file)
1155
- warn '[DEPRECATION] `Line::Bot::Client#create_rich_menu_image` is deprecated. Please use `Line::Bot::V2::MessagingApi::ApiBlobClient#set_rich_menu_image` instead.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
1156
-
1157
- channel_token_required
1158
-
1159
- endpoint_path = "/bot/richmenu/#{rich_menu_id}/content"
1160
- headers = credentials.merge('Content-Type' => content_type(file))
1161
- post(blob_endpoint, endpoint_path, file.rewind && file.read, headers)
1162
- end
1163
-
1164
- # @deprecated
1165
- # This is deprecated.
1166
- # Please use {Line::Bot::V2::MessagingApi::ApiClient#issue_link_token} instead.
1167
- #
1168
- # Issue a link token to a user
1169
- #
1170
- # @param user_id [String] ID of the user
1171
- #
1172
- # @return [Net::HTTPResponse]
1173
- def create_link_token(user_id)
1174
- warn '[DEPRECATION] `Line::Bot::Client#create_link_token` is deprecated. Please use `Line::Bot::V2::MessagingApi::ApiClient#issue_link_token` instead.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
1175
-
1176
- channel_token_required
1177
-
1178
- endpoint_path = "/bot/user/#{user_id}/linkToken"
1179
- post(endpoint, endpoint_path, nil, credentials)
1180
- end
1181
-
1182
- # @deprecated
1183
- # This is deprecated.
1184
- # Please use {Line::Bot::V2::MessagingApi::ApiClient#get_message_quota} instead.
1185
- #
1186
- # Get the target limit for additional messages
1187
- #
1188
- # @return [Net::HTTPResponse]
1189
- def get_quota
1190
- warn '[DEPRECATION] `Line::Bot::Client#get_quota` is deprecated. Please use `Line::Bot::V2::MessagingApi::ApiClient#get_message_quota` instead.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
1191
-
1192
- channel_token_required
1193
-
1194
- endpoint_path = "/bot/message/quota"
1195
- get(endpoint, endpoint_path, credentials)
1196
- end
1197
-
1198
- # @deprecated
1199
- # This is deprecated.
1200
- # Please use {Line::Bot::V2::MessagingApi::ApiClient#get_message_quota_consumption} instead.
1201
- #
1202
- # Get number of messages sent this month
1203
- #
1204
- # @return [Net::HTTPResponse]
1205
- def get_quota_consumption
1206
- warn '[DEPRECATION] `Line::Bot::Client#get_quota_consumption` is deprecated. Please use `Line::Bot::V2::MessagingApi::ApiClient#get_message_quota_consumption` instead.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
1207
-
1208
- channel_token_required
1209
-
1210
- endpoint_path = "/bot/message/quota/consumption"
1211
- get(endpoint, endpoint_path, credentials)
1212
- end
1213
-
1214
- # @deprecated
1215
- # This is deprecated.
1216
- # Please use {Line::Bot::V2::Insight::ApiClient#get_number_of_message_deliveries} instead.
1217
- #
1218
- # Returns the number of messages sent on a specified day
1219
- #
1220
- # @param [String] date (Format:yyyyMMdd, Example:20191231)
1221
- #
1222
- # @return [Net::HTTPResponse]
1223
- def get_number_of_message_deliveries(date)
1224
- warn '[DEPRECATION] `Line::Bot::Client#get_number_of_message_deliveries` is deprecated. Please use `Line::Bot::V2::Insight::ApiClient#get_number_of_message_deliveries` instead.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
1225
-
1226
- channel_token_required
1227
-
1228
- endpoint_path = "/bot/insight/message/delivery?date=#{date}"
1229
- get(endpoint, endpoint_path, credentials)
1230
- end
1231
-
1232
- # @deprecated
1233
- # This is deprecated.
1234
- # Please use {Line::Bot::V2::Insight::ApiClient#get_message_event} instead.
1235
- #
1236
- # Returns statistics about how users interact with narrowcast messages or broadcast messages sent from your LINE Official Account.
1237
- #
1238
- # @param [String] request_id
1239
- #
1240
- # @return [Net::HTTPResponse]
1241
- def get_user_interaction_statistics(request_id)
1242
- warn '[DEPRECATION] `Line::Bot::Client#get_user_interaction_statistics` is deprecated. Please use `Line::Bot::V2::Insight::ApiClient#get_message_event` instead.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
1243
-
1244
- channel_token_required
1245
-
1246
- endpoint_path = "/bot/insight/message/event?requestId=#{request_id}"
1247
- get(endpoint, endpoint_path, credentials)
1248
- end
1249
-
1250
- # @deprecated
1251
- # This is deprecated.
1252
- # Please use {Line::Bot::V2::Insight::ApiClient#get_number_of_followers} instead.
1253
- #
1254
- # Returns the number of followers
1255
- #
1256
- # @param [String] date (Format:yyyyMMdd, Example:20191231)
1257
- #
1258
- # @return [Net::HTTPResponse]
1259
- def get_number_of_followers(date)
1260
- warn '[DEPRECATION] `Line::Bot::Client#get_number_of_followers` is deprecated. Please use `Line::Bot::V2::Insight::ApiClient#get_number_of_followers` instead.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
1261
-
1262
- channel_token_required
1263
-
1264
- endpoint_path = "/bot/insight/followers?date=#{date}"
1265
- get(endpoint, endpoint_path, credentials)
1266
- end
1267
-
1268
- # @deprecated
1269
- # This is deprecated.
1270
- # Please use {Line::Bot::V2::Insight::ApiClient#get_friends_demographics} instead.
1271
- #
1272
- # Get the demographic attributes for a bot's friends.
1273
- #
1274
- # @return [Net::HTTPResponse]
1275
- def get_friend_demographics
1276
- warn '[DEPRECATION] `Line::Bot::Client#get_friend_demographics` is deprecated. Please use `Line::Bot::V2::Insight::ApiClient#get_friends_demographics` instead.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
1277
-
1278
- channel_token_required
1279
-
1280
- endpoint_path = '/bot/insight/demographic'
1281
- get(endpoint, endpoint_path, credentials)
1282
- end
1283
-
1284
- # @deprecated
1285
- # This is deprecated.
1286
- # Please use {Line::Bot::V2::MessagingApi::ApiClient#get_bot_info} instead.
1287
- #
1288
- # Gets a bot's basic information.
1289
- #
1290
- # @return [Net::HTTPResponse]
1291
- def get_bot_info
1292
- warn '[DEPRECATION] `Line::Bot::Client#get_bot_info` is deprecated. Please use `Line::Bot::V2::MessagingApi::ApiClient#get_bot_info` instead.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
1293
-
1294
- channel_token_required
1295
-
1296
- endpoint_path = '/bot/info'
1297
- get(endpoint, endpoint_path, credentials)
1298
- end
1299
-
1300
- # @deprecated
1301
- # This is deprecated.
1302
- # Please use {Line::Bot::V2::MessagingApi::ApiClient#get_webhook_endpoint} instead.
1303
- #
1304
- # Gets information on a webhook endpoint.
1305
- #
1306
- # @return [Net::HTTPResponse]
1307
- def get_webhook_endpoint
1308
- warn '[DEPRECATION] `Line::Bot::Client#get_webhook_endpoint` is deprecated. Please use `Line::Bot::V2::MessagingApi::ApiClient#get_webhook_endpoint` instead.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
1309
-
1310
- channel_token_required
1311
-
1312
- endpoint_path = '/bot/channel/webhook/endpoint'
1313
- get(endpoint, endpoint_path, credentials)
1314
- end
1315
-
1316
- # @deprecated
1317
- # This is deprecated.
1318
- # Please use {Line::Bot::V2::MessagingApi::ApiClient#set_webhook_endpoint} instead.
1319
- #
1320
- # Sets the webhook endpoint URL.
1321
- #
1322
- # @param webhook_endpoint [String]
1323
- #
1324
- # @return [Net::HTTPResponse]
1325
- def set_webhook_endpoint(webhook_endpoint)
1326
- warn '[DEPRECATION] `Line::Bot::Client#set_webhook_endpoint` is deprecated. Please use `Line::Bot::V2::MessagingApi::ApiClient#set_webhook_endpoint` instead.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
1327
-
1328
- channel_token_required
1329
-
1330
- endpoint_path = '/bot/channel/webhook/endpoint'
1331
- body = {endpoint: webhook_endpoint}
1332
- put(endpoint, endpoint_path, body.to_json, credentials)
1333
- end
1334
-
1335
- # @deprecated
1336
- # This is deprecated.
1337
- # Please use {Line::Bot::V2::MessagingApi::ApiClient#test_webhook_endpoint} instead.
1338
- #
1339
- # Checks if the configured webhook endpoint can receive a test webhook event.
1340
- #
1341
- # @param webhook_endpoint [String] options
1342
- #
1343
- # @return [Net::HTTPResponse]
1344
- def test_webhook_endpoint(webhook_endpoint = nil)
1345
- warn '[DEPRECATION] `Line::Bot::Client#test_webhook_endpoint` is deprecated. Please use `Line::Bot::V2::MessagingApi::ApiClient#test_webhook_endpoint` instead.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
1346
-
1347
- channel_token_required
1348
-
1349
- endpoint_path = '/bot/channel/webhook/test'
1350
- body = if webhook_endpoint.nil?
1351
- {}
1352
- else
1353
- {endpoint: webhook_endpoint}
1354
- end
1355
- post(endpoint, endpoint_path, body.to_json, credentials)
1356
- end
1357
-
1358
- # @deprecated
1359
- # This is deprecated.
1360
- # Please use {Line::Bot::V2::Liff::ApiClient#get_all_liff_apps} instead.
1361
- #
1362
- def get_liff_apps
1363
- warn '[DEPRECATION] `Line::Bot::Client#get_liff_apps` is deprecated. Please use `Line::Bot::V2::Liff::ApiClient#get_all_liff_apps` instead.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
1364
-
1365
- channel_token_required
1366
-
1367
- endpoint_path = '/apps'
1368
- get(liff_endpoint, endpoint_path, credentials)
1369
- end
1370
-
1371
- # @deprecated
1372
- # This is deprecated.
1373
- # Please use {Line::Bot::V2::Liff::ApiClient#add_liff_app} instead.
1374
- #
1375
- def create_liff_app(app)
1376
- warn '[DEPRECATION] `Line::Bot::Client#create_liff_app` is deprecated. Please use `Line::Bot::V2::Liff::ApiClient#add_liff_app` instead.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
1377
-
1378
- channel_token_required
1379
-
1380
- endpoint_path = '/apps'
1381
- post(liff_endpoint, endpoint_path, app.to_json, credentials)
1382
- end
1383
-
1384
- # @deprecated
1385
- # This is deprecated.
1386
- # Please use {Line::Bot::V2::Liff::ApiClient#update_liff_app} instead.
1387
- #
1388
- def update_liff_app(liff_id, app)
1389
- warn '[DEPRECATION] `Line::Bot::Client#update_liff_app` is deprecated. Please use `Line::Bot::V2::Liff::ApiClient#update_liff_app` instead.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
1390
-
1391
- channel_token_required
1392
-
1393
- endpoint_path = "/apps/#{liff_id}"
1394
- put(liff_endpoint, endpoint_path, app.to_json, credentials)
1395
- end
1396
-
1397
- # @deprecated
1398
- # This is deprecated.
1399
- # Please use {Line::Bot::V2::Liff::ApiClient#delete_liff_app} instead.
1400
- #
1401
- def delete_liff_app(liff_id)
1402
- warn '[DEPRECATION] `Line::Bot::Client#delete_liff_app` is deprecated. Please use `Line::Bot::V2::Liff::ApiClient#delete_liff_app` instead.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
1403
-
1404
- channel_token_required
1405
-
1406
- endpoint_path = "/apps/#{liff_id}"
1407
- delete(liff_endpoint, endpoint_path, credentials)
1408
- end
1409
-
1410
- # @deprecated
1411
- # This is deprecated.
1412
- # Please use {Line::Bot::V2::ManageAudience::ApiClient#create_audience_group} instead.
1413
- #
1414
- # Create an audience group by uploading user_ids
1415
- #
1416
- # Parameters are described here.
1417
- # https://developers.line.biz/en/reference/messaging-api/#create-upload-audience-group
1418
- #
1419
- # @param params [Hash] options
1420
- #
1421
- # @return [Net::HTTPResponse] This response includes an audience_group_id.
1422
- def create_user_id_audience(params)
1423
- warn '[DEPRECATION] `Line::Bot::Client#create_user_id_audience` is deprecated. Please use `Line::Bot::V2::ManageAudience::ApiClient#create_audience_group` instead.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
1424
-
1425
- channel_token_required
1426
-
1427
- endpoint_path = '/bot/audienceGroup/upload'
1428
- post(endpoint, endpoint_path, params.to_json, credentials)
1429
- end
1430
-
1431
- # @deprecated
1432
- # This is deprecated.
1433
- # Please use {Line::Bot::V2::ManageAudience::ApiClient#add_audience_to_audience_group} instead.
1434
- #
1435
- # Update an audience group
1436
- #
1437
- # Parameters are described here.
1438
- # https://developers.line.biz/en/reference/messaging-api/#update-upload-audience-group
1439
- #
1440
- # @param params [Hash] options
1441
- #
1442
- # @return [Net::HTTPResponse] This response includes an audience_group_id.
1443
- def update_user_id_audience(params)
1444
- warn '[DEPRECATION] `Line::Bot::Client#update_user_id_audience` is deprecated. Please use `Line::Bot::V2::ManageAudience::ApiClient#add_audience_to_audience_group` instead.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
1445
-
1446
- channel_token_required
1447
-
1448
- endpoint_path = '/bot/audienceGroup/upload'
1449
- put(endpoint, endpoint_path, params.to_json, credentials)
1450
- end
1451
-
1452
- # @deprecated
1453
- # This is deprecated.
1454
- # Please use {Line::Bot::V2::ManageAudience::ApiClient#create_click_based_audience_group} instead.
1455
- #
1456
- # Create an audience group of users that clicked a URL in a message sent in the past
1457
- #
1458
- # Parameters are described here.
1459
- # https://developers.line.biz/en/reference/messaging-api/#create-click-audience-group
1460
- #
1461
- # @param params [Hash] options
1462
- #
1463
- # @return [Net::HTTPResponse] This response includes an audience_group_id.
1464
- def create_click_audience(params)
1465
- warn '[DEPRECATION] `Line::Bot::Client#create_click_audience` is deprecated. Please use `Line::Bot::V2::ManageAudience::ApiClient#create_click_based_audience_group` instead.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
1466
-
1467
- channel_token_required
1468
-
1469
- endpoint_path = '/bot/audienceGroup/click'
1470
- post(endpoint, endpoint_path, params.to_json, credentials)
1471
- end
1472
-
1473
- # @deprecated
1474
- # This is deprecated.
1475
- # Please use {Line::Bot::V2::ManageAudience::ApiClient#create_imp_based_audience_group} instead.
1476
- #
1477
- # Create an audience group of users that opened a message sent in the past
1478
- #
1479
- # Parameters are described here.
1480
- # https://developers.line.biz/en/reference/messaging-api/#create-imp-audience-group
1481
- #
1482
- # @param params [Hash] options
1483
- #
1484
- # @return [Net::HTTPResponse] This response includes an audience_group_id.
1485
- def create_impression_audience(params)
1486
- warn '[DEPRECATION] `Line::Bot::Client#create_impression_audience` is deprecated. Please use `Line::Bot::V2::ManageAudience::ApiClient#create_imp_based_audience_group` instead.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
1487
-
1488
- channel_token_required
1489
-
1490
- endpoint_path = '/bot/audienceGroup/imp'
1491
- post(endpoint, endpoint_path, params.to_json, credentials)
1492
- end
1493
-
1494
- # @deprecated
1495
- # This is deprecated.
1496
- # Please use {Line::Bot::V2::ManageAudience::ApiClient#update_audience_group_description} instead.
1497
- #
1498
- # Rename an existing audience group
1499
- #
1500
- # @param audience_group_id [Integer]
1501
- # @param description [String]
1502
- #
1503
- # @return [Net::HTTPResponse]
1504
- def rename_audience(audience_group_id, description)
1505
- warn '[DEPRECATION] `Line::Bot::Client#rename_audience` is deprecated. Please use `Line::Bot::V2::ManageAudience::ApiClient#update_audience_group_description` instead.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
1506
-
1507
- channel_token_required
1508
-
1509
- endpoint_path = "/bot/audienceGroup/#{audience_group_id}/updateDescription"
1510
- body = {description: description}
1511
- put(endpoint, endpoint_path, body.to_json, credentials)
1512
- end
1513
-
1514
- # @deprecated
1515
- # This is deprecated.
1516
- # Please use {Line::Bot::V2::ManageAudience::ApiClient#delete_audience_group} instead.
1517
- #
1518
- # Delete an existing audience group
1519
- #
1520
- # Parameters are described here.
1521
- # https://developers.line.biz/en/reference/messaging-api/#delete-audience-group
1522
- #
1523
- # @param audience_group_id [Integer]
1524
- #
1525
- # @return [Net::HTTPResponse]
1526
- def delete_audience(audience_group_id)
1527
- warn '[DEPRECATION] `Line::Bot::Client#delete_audience` is deprecated. Please use `Line::Bot::V2::ManageAudience::ApiClient#delete_audience_group` instead.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
1528
-
1529
- channel_token_required
1530
-
1531
- endpoint_path = "/bot/audienceGroup/#{audience_group_id}"
1532
- delete(endpoint, endpoint_path, credentials)
1533
- end
1534
-
1535
- # @deprecated
1536
- # This is deprecated.
1537
- # Please use {Line::Bot::V2::ManageAudience::ApiClient#get_audience_data} instead.
1538
- #
1539
- # Get audience group data
1540
- #
1541
- # Parameters are described here.
1542
- # https://developers.line.biz/en/reference/messaging-api/#get-audience-group
1543
- #
1544
- # @param audience_group_id [Integer]
1545
- #
1546
- # @return [Net::HTTPResponse]
1547
- def get_audience(audience_group_id)
1548
- warn '[DEPRECATION] `Line::Bot::Client#get_audience` is deprecated. Please use `Line::Bot::V2::ManageAudience::ApiClient#get_audience_data` instead.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
1549
-
1550
- channel_token_required
1551
-
1552
- endpoint_path = "/bot/audienceGroup/#{audience_group_id}"
1553
- get(endpoint, endpoint_path, credentials)
1554
- end
1555
-
1556
- # @deprecated
1557
- # This is deprecated.
1558
- # Please use {Line::Bot::V2::ManageAudience::ApiClient#get_audience_groups} instead.
1559
- #
1560
- # Get data for more than one audience group
1561
- #
1562
- # Parameters are described here.
1563
- # https://developers.line.biz/en/reference/messaging-api/#get-audience-groups
1564
- #
1565
- # @param params [Hash] key name `page` is required
1566
- #
1567
- # @return [Net::HTTPResponse]
1568
- def get_audiences(params)
1569
- warn '[DEPRECATION] `Line::Bot::Client#get_audiences` is deprecated. Please use `Line::Bot::V2::ManageAudience::ApiClient#get_audience_groups` instead.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
1570
-
1571
- channel_token_required
1572
-
1573
- endpoint_path = "/bot/audienceGroup/list?" + URI.encode_www_form(params)
1574
- get(endpoint, endpoint_path, credentials)
1575
- end
1576
-
1577
- # @deprecated
1578
- # This is obsolete.
1579
- #
1580
- # Get the authority level of the audience
1581
- #
1582
- # Parameters are described here.
1583
- # https://developers.line.biz/en/reference/messaging-api/#get-authority-level
1584
- #
1585
- # @return [Net::HTTPResponse]
1586
- def get_audience_authority_level
1587
- warn '[DEPRECATION] `Line::Bot::Client#get_audience_authority_level` is obsolete.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
1588
-
1589
- channel_token_required
1590
-
1591
- endpoint_path = "/bot/audienceGroup/authorityLevel"
1592
- get(endpoint, endpoint_path, credentials)
1593
- end
1594
-
1595
- # @deprecated
1596
- # This is obsolete.
1597
- #
1598
- # Change the authority level of the audience
1599
- #
1600
- # Parameters are described here.
1601
- # https://developers.line.biz/en/reference/messaging-api/#change-authority-level
1602
- #
1603
- # @param authority_level [String] value must be `PUBLIC` or `PRIVATE`
1604
- #
1605
- # @return [Net::HTTPResponse]
1606
- def update_audience_authority_level(authority_level)
1607
- warn '[DEPRECATION] `Line::Bot::Client#update_audience_authority_level` is obsolete.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
1608
-
1609
- channel_token_required
1610
-
1611
- endpoint_path = "/bot/audienceGroup/authorityLevel"
1612
- body = {authorityLevel: authority_level}
1613
- put(endpoint, endpoint_path, body.to_json, credentials)
1614
- end
1615
-
1616
- # @deprecated
1617
- # This is deprecated.
1618
- # Please use {Line::Bot::V2::Insight::ApiClient#get_statistics_per_unit} instead.
1619
- #
1620
- # Get the per-unit statistics of how users interact with push messages and multicast messages.
1621
- #
1622
- # @param unit [String] Case-sensitive name of aggregation unit specified when sending the message.
1623
- # @param from [String] Start date of aggregation period in UTC+9 with `yyyyMMdd` format
1624
- # @param to [String] End date of aggregation period in UTC+9 with `yyyyMMdd` format.
1625
- #
1626
- # @return [Net::HTTPResponse]
1627
- def get_statistics_per_unit(unit:, from:, to:)
1628
- warn '[DEPRECATION] `Line::Bot::Client#get_statistics_per_unit` is deprecated. Please use `Line::Bot::V2::Insight::ApiClient#get_statistics_per_unit` instead.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
1629
-
1630
- channel_token_required
1631
-
1632
- params = {customAggregationUnit: unit, from: from, to: to}
1633
- endpoint_path = "/bot/insight/message/event/aggregation?" + URI.encode_www_form(params)
1634
- get(endpoint, endpoint_path, credentials)
1635
- end
1636
-
1637
- # @deprecated
1638
- # This is deprecated.
1639
- # Please use {Line::Bot::V2::MessagingApi::ApiClient#get_aggregation_unit_usage} instead.
1640
- #
1641
- # Get the number of aggregation units used this month.
1642
- #
1643
- # @return [Net::HTTPResponse]
1644
- def get_aggregation_info
1645
- warn '[DEPRECATION] `Line::Bot::Client#get_aggregation_info` is deprecated. Please use `Line::Bot::V2::MessagingApi::ApiClient#get_aggregation_unit_usage` instead.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
1646
-
1647
- channel_token_required
1648
-
1649
- endpoint_path = "/bot/message/aggregation/info"
1650
- get(endpoint, endpoint_path, credentials)
1651
- end
1652
-
1653
- # @deprecated
1654
- # This is deprecated.
1655
- # Please use {Line::Bot::V2::MessagingApi::ApiClient#get_aggregation_unit_name_list} instead.
1656
- #
1657
- # Get the name list of units used this month for statistics aggregation.
1658
- #
1659
- # @param limit [Integer] Maximum number of aggregation units per request. Maximum: 100, Default: 100.
1660
- # @param start [String] Value of the continuation token found in the `next` property of the JSON object returned in the response.
1661
- #
1662
- # @return [Net::HTTPResponse]
1663
- def get_aggregation_list(limit: nil, start: nil)
1664
- warn '[DEPRECATION] `Line::Bot::Client#get_aggregation_list` is deprecated. Please use `Line::Bot::V2::MessagingApi::ApiClient#get_aggregation_unit_name_list` instead.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
1665
-
1666
- channel_token_required
1667
-
1668
- params = {limit: limit, start: start}.compact
1669
- endpoint_path = "/bot/message/aggregation/list?" + URI.encode_www_form(params)
1670
- get(endpoint, endpoint_path, credentials)
1671
- end
1672
-
1673
- # @deprecated
1674
- # This is deprecated.
1675
- # Please use {Line::Bot::V2::MessagingApi::ApiClient#get_narrowcast_progress} instead.
1676
- #
1677
- # Gets the status of a narrowcast message.
1678
- #
1679
- # @param request_id [String] The narrowcast message's request ID. Each Messaging API request has a request ID. Find it in the response headers.
1680
- #
1681
- # @return [Net::HTTPResponse]
1682
- def get_narrowcast_message_status(request_id)
1683
- warn '[DEPRECATION] `Line::Bot::Client#get_narrowcast_message_status` is deprecated. Please use `Line::Bot::V2::MessagingApi::ApiClient#get_narrowcast_progress` instead.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
1684
-
1685
- channel_token_required
1686
-
1687
- endpoint_path = "/bot/message/progress/narrowcast?requestId=#{request_id}"
1688
- get(endpoint, endpoint_path, credentials)
1689
- end
1690
-
1691
- # @deprecated
1692
- # This is obsolete.
1693
- #
1694
- # Send messages to multiple users using phone numbers.
1695
- #
1696
- # @param to [Array, String] Array of hashed phone numbers.
1697
- # @param messages [Hash, Array] Message Objects.
1698
- # @param headers [Hash] HTTP Headers.
1699
- # @param payload [Hash] Additional request body.
1700
- #
1701
- # @return [Net::HTTPResponse]
1702
- def multicast_by_phone_numbers(to, messages, headers: {}, payload: {})
1703
- warn '[DEPRECATION] `Line::Bot::Client#get_narrowcast_message_status` is obsolete.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
1704
-
1705
- channel_token_required
1706
-
1707
- to = [to] if to.is_a?(String)
1708
- messages = [messages] if messages.is_a?(Hash)
1709
-
1710
- endpoint_path = 'bot/ad/multicast/phone'
1711
- payload = payload.merge({ to: to, messages: messages }).to_json
1712
- post(oauth_endpoint, endpoint_path, payload, credentials.merge(headers))
1713
- end
1714
-
1715
- # @deprecated
1716
- # This is obsolete.
1717
- #
1718
- # Get the delivery result of the message delivered in Send message using phone number. (`#multicast_by_phone_numbers`)
1719
- #
1720
- # @param date [String] Date the message was sent in UTC+9 with `yyyyMMdd` format.
1721
- #
1722
- # @return [Net::HTTPResponse]
1723
- def get_delivery_result_sent_by_phone_numbers(date)
1724
- warn '[DEPRECATION] `Line::Bot::Client#get_delivery_result_sent_by_phone_numbers` is obsolete.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
1725
-
1726
- channel_token_required
1727
-
1728
- endpoint_path = "/bot/message/delivery/ad_phone?date=#{date}"
1729
- get(endpoint, endpoint_path, credentials)
1730
- end
1731
-
1732
- # @deprecated
1733
- # This is deprecated.
1734
- # Please use {Line::Bot::V2::MessagingApi::ApiClient#push_messages_by_phone} instead.
1735
- #
1736
- # Send a LINE notification message by specifying the user's phone number.
1737
- #
1738
- # @param hashed_phone_number [String] Phone number that has been normalized.
1739
- # @param messages [Hash, Array] Message Objects.
1740
- # @param headers [Hash] HTTP Headers.
1741
- # @param payload [Hash] Additional request body.
1742
- #
1743
- # @return [Net::HTTPResponse]
1744
- def push_pnp(hashed_phone_number, messages, headers: {}, payload: {})
1745
- warn '[DEPRECATION] `Line::Bot::Client#push_pnp` is deprecated. Please use `Line::Bot::V2::MessagingApi::ApiClient#push_messages_by_phone` instead.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
1746
-
1747
- channel_token_required
1748
-
1749
- messages = [messages] if messages.is_a?(Hash)
1750
-
1751
- endpoint_path = '/bot/pnp/push'
1752
- payload = payload.merge({ to: hashed_phone_number, messages: messages }).to_json
1753
- post(oauth_endpoint, endpoint_path, payload, credentials.merge(headers))
1754
- end
1755
-
1756
- # @deprecated
1757
- # This is deprecated.
1758
- # Please use {Line::Bot::V2::MessagingApi::ApiClient#get_pnp_message_statistics} instead.
1759
- #
1760
- # Get the number of LINE notification messages sent using the /bot/pnp/push endpoint.
1761
- #
1762
- # @param date [String] Date the messages were sent (format: yyyyMMdd).
1763
- #
1764
- # @return [Net::HTTPResponse]
1765
- def get_message_delivery_pnp(date)
1766
- warn '[DEPRECATION] `Line::Bot::Client#get_message_delivery_pnp` is deprecated. Please use `Line::Bot::V2::MessagingApi::ApiClient#get_pnp_message_statistics` instead.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
1767
-
1768
- channel_token_required
1769
-
1770
- endpoint_path = "/bot/message/delivery/pnp?date=#{date}"
1771
- get(endpoint, endpoint_path, credentials)
1772
- end
1773
-
1774
- # @deprecated
1775
- # This is obsolete.
1776
- # You may use {Line::Bot::V2::HttpClient#get} instead, but it is not recommended.
1777
- #
1778
- # Fetch data, get content of specified URL.
1779
- #
1780
- # @param endpoint_base [String]
1781
- # @param endpoint_path [String]
1782
- # @param headers [Hash]
1783
- #
1784
- # @return [Net::HTTPResponse]
1785
- def get(endpoint_base, endpoint_path, headers = {})
1786
- headers = API::DEFAULT_HEADERS.merge(headers)
1787
- httpclient.get(endpoint_base + endpoint_path, headers)
1788
- end
1789
-
1790
- # @deprecated
1791
- # This is obsolete.
1792
- # You may use {Line::Bot::V2::HttpClient#post} instead, but it is not recommended.
1793
- #
1794
- # Post data, get content of specified URL.
1795
- #
1796
- # @param endpoint_base [String]
1797
- # @param endpoint_path [String]
1798
- # @param payload [String, NilClass]
1799
- # @param headers [Hash]
1800
- #
1801
- # @return [Net::HTTPResponse]
1802
- def post(endpoint_base, endpoint_path, payload = nil, headers = {})
1803
- headers = API::DEFAULT_HEADERS.merge(headers)
1804
- httpclient.post(endpoint_base + endpoint_path, payload, headers)
1805
- end
1806
-
1807
- # @deprecated
1808
- # This is obsolete.
1809
- # You may use {Line::Bot::V2::HttpClient#put} instead, but it is not recommended.
1810
- #
1811
- # Put data, get content of specified URL.
1812
- #
1813
- # @param endpoint_base [String]
1814
- # @param endpoint_path [String]
1815
- # @param payload [String, NilClass]
1816
- # @param headers [Hash]
1817
- #
1818
- # @return [Net::HTTPResponse]
1819
- def put(endpoint_base, endpoint_path, payload = nil, headers = {})
1820
- headers = API::DEFAULT_HEADERS.merge(headers)
1821
- httpclient.put(endpoint_base + endpoint_path, payload, headers)
1822
- end
1823
-
1824
- # @deprecated
1825
- # This is obsolete.
1826
- # You may use {Line::Bot::V2::HttpClient#delete} instead, but it is not recommended.
1827
- #
1828
- # Delete content of specified URL.
1829
- #
1830
- # @param endpoint_base [String]
1831
- # @param endpoint_path [String]
1832
- # @param headers [Hash]
1833
- #
1834
- # @return [Net::HTTPResponse]
1835
- def delete(endpoint_base, endpoint_path, headers = {})
1836
- headers = API::DEFAULT_HEADERS.merge(headers)
1837
- httpclient.delete(endpoint_base + endpoint_path, headers)
1838
- end
1839
-
1840
- # @deprecated
1841
- # This is deprecated.
1842
- # Please use {Line::Bot::V2::WebhookParser#parse} instead.
1843
- #
1844
- # Parse events from request.body
1845
- #
1846
- # @param request_body [String]
1847
- #
1848
- # @return [Array<Line::Bot::Event::Class>]
1849
- def parse_events_from(request_body)
1850
- warn '[DEPRECATION] `Line::Bot::Client#parse_events_from` is deprecated. Please use `Line::Bot::V2::WebhookParser#parse` instead.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
1851
- json = JSON.parse(request_body)
1852
-
1853
- json['events'].map do |item|
1854
- begin
1855
- klass = Event.const_get(Util.camelize(item['type']))
1856
- klass.new(item)
1857
- rescue NameError
1858
- Event::Base.new(item)
1859
- end
1860
- end
1861
- end
1862
-
1863
- # @deprecated
1864
- # This is deprecated.
1865
- # Please use {Line::Bot::V2::WebhookParser#parse} instead.
1866
- #
1867
- # Validate signature of a webhook event.
1868
- #
1869
- # https://developers.line.biz/en/reference/messaging-api/#signature-validation
1870
- #
1871
- # @param content [String] Request's body
1872
- # @param channel_signature [String] Request'header 'X-LINE-Signature' # HTTP_X_LINE_SIGNATURE
1873
- #
1874
- # @return [Boolean]
1875
- def validate_signature(content, channel_signature)
1876
- warn '[DEPRECATION] `Line::Bot::Client#validate_signature` is deprecated. Please use `Line::Bot::V2::WebhookParser#parse` instead.' unless ENV['SUPRESS_V1_DEPRECATION_WARNINGS']
1877
- return false if !channel_signature || !channel_secret
1878
-
1879
- hash = OpenSSL::HMAC.digest(OpenSSL::Digest.new('SHA256'), channel_secret, content)
1880
- signature = Base64.strict_encode64(hash)
1881
-
1882
- variable_secure_compare(channel_signature, signature)
1883
- end
1884
-
1885
- private
1886
-
1887
- # Constant time string comparison.
1888
- #
1889
- # via timing attacks.
1890
- # reference: https://github.com/rails/rails/blob/master/activesupport/lib/active_support/security_utils.rb
1891
- # @return [Boolean]
1892
- def variable_secure_compare(a, b)
1893
- secure_compare(::Digest::SHA256.hexdigest(a), ::Digest::SHA256.hexdigest(b))
1894
- end
1895
-
1896
- # @return [Boolean]
1897
- def secure_compare(a, b)
1898
- return false unless a.bytesize == b.bytesize
1899
-
1900
- l = a.unpack "C#{a.bytesize}"
1901
-
1902
- res = 0
1903
- b.each_byte { |byte| res |= byte ^ l.shift }
1904
- res == 0
1905
- end
1906
-
1907
- def content_type(file)
1908
- if file.respond_to?(:content_type)
1909
- content_type = file.content_type
1910
- raise ArgumentError, "invalid content type: #{content_type}" unless ['image/jpeg', 'image/png'].include?(content_type)
1911
-
1912
- content_type
1913
- else
1914
- case file.path
1915
- when /\.jpe?g\z/i then 'image/jpeg'
1916
- when /\.png\z/i then 'image/png'
1917
- else
1918
- raise ArgumentError, "invalid file extension: #{file.path}"
1919
- end
1920
- end
1921
- end
1922
-
1923
- def channel_token_required
1924
- raise ArgumentError, '`channel_token` is not configured' unless channel_token
1925
- end
1926
-
1927
- def channel_id_required
1928
- raise ArgumentError, '`channel_id` is not configured' unless channel_id
1929
- end
1930
-
1931
- def channel_secret_required
1932
- raise ArgumentError, '`channel_secret` is not configured' unless channel_secret
1933
- end
1934
- end
1935
- end
1936
- end