line-bot-api 1.22.0 → 1.25.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a36da29494cce63f76dcb86eeb598ee138cdac97c3e8d1b9a3cd630de77f969e
4
- data.tar.gz: e44f44089b1047692f57a95733a7fe73aa6362f45838280eedb8e14286d832ee
3
+ metadata.gz: d2b1b0e62ac703e48b3153c9214d0de1f7df4a394b485b1c1daf142744467ee4
4
+ data.tar.gz: 372be3bfd378274cc8f465ff1a16b41842110b9755d22a3bcfb5e4bd4323a6af
5
5
  SHA512:
6
- metadata.gz: d1f110ae8342f09be0d07bc335ce8f982868d10e26b9bc3eef0c0a60b77b0c1a06dde346eab279250b0c521888978db673a50c6db17d070d1650608fc2fb080a
7
- data.tar.gz: 7ab72e341fb0db004519df79eb2ef95e802f54da19fa90087d193c7bd493523fbb1069a70fd1c8b6be07ba7249491f1c4775fca298d8e6c4a97530ce9046279f
6
+ metadata.gz: b56beefbf79c9db2154e97be3e9cd82bcdea9833a17fda92e0f38c4ada37c05394ec8942e18190e8bcbbbb2566ba28a83ee81fee71bbdeb181b6f0e8326d5074
7
+ data.tar.gz: 2da6d7329e36b8da62e20da99669273ff12f1478e3c6f13d892b98cfc75970b62acdc47fbdecb689066e2450574179c6c224dcf305cfbaccf754ae0872945857
@@ -15,7 +15,7 @@
15
15
  module Line
16
16
  module Bot
17
17
  module API
18
- VERSION = "1.22.0"
18
+ VERSION = "1.25.0"
19
19
  end
20
20
  end
21
21
  end
@@ -145,6 +145,40 @@ module Line
145
145
  post(oauth_endpoint, endpoint_path, payload, headers)
146
146
  end
147
147
 
148
+ # Verify ID token
149
+ #
150
+ # @param id_token [String] ID token
151
+ # @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.
152
+ # @param user_id [String] Expected user ID.
153
+ #
154
+ # @return [Net::HTTPResponse]
155
+ def verify_id_token(id_token, nonce: nil, user_id: nil)
156
+ channel_id_required
157
+
158
+ endpoint_path = '/oauth2/v2.1/verify'
159
+ payload = URI.encode_www_form({
160
+ client_id: channel_id,
161
+ id_token: id_token,
162
+ nonce: nonce,
163
+ user_id: user_id
164
+ }.compact)
165
+ headers = { 'Content-Type' => 'application/x-www-form-urlencoded' }
166
+ post(oauth_endpoint, endpoint_path, payload, headers)
167
+ end
168
+
169
+ # Verify access token v2.1
170
+ #
171
+ # @param access_token [String] access token
172
+ #
173
+ # @return [Net::HTTPResponse]
174
+ def verify_access_token(access_token)
175
+ payload = URI.encode_www_form(
176
+ access_token: access_token
177
+ )
178
+ endpoint_path = "/oauth2/v2.1/verify?#{payload}"
179
+ get(oauth_endpoint, endpoint_path)
180
+ end
181
+
148
182
  # Get all valid channel access token key IDs v2.1
149
183
  #
150
184
  # @param jwt [String]
@@ -161,19 +195,33 @@ module Line
161
195
  get(oauth_endpoint, endpoint_path, headers)
162
196
  end
163
197
 
198
+ # Get user profile by access token
199
+ #
200
+ # @param access_token [String] access token
201
+ #
202
+ # @return [Net::HTTPResponse]
203
+ def get_profile_by_access_token(access_token)
204
+ headers = {
205
+ "Authorization" => "Bearer #{access_token}",
206
+ }
207
+ endpoint_path = "/v2/profile"
208
+ get(oauth_endpoint, endpoint_path, headers)
209
+ end
210
+
164
211
  # Push messages to a user using user_id.
165
212
  #
166
213
  # @param user_id [String] User Id
167
- # @param messages [Hash or Array] Message Objects
214
+ # @param messages [Hash, Array] Message Objects
168
215
  # @param headers [Hash] HTTP Headers
216
+ # @param payload [Hash] Additional request body
169
217
  # @return [Net::HTTPResponse]
170
- def push_message(user_id, messages, headers: {})
218
+ def push_message(user_id, messages, headers: {}, payload: {})
171
219
  channel_token_required
172
220
 
173
221
  messages = [messages] if messages.is_a?(Hash)
174
222
 
175
223
  endpoint_path = '/bot/message/push'
176
- payload = { to: user_id, messages: messages }.to_json
224
+ payload = payload.merge({ to: user_id, messages: messages }).to_json
177
225
  post(endpoint, endpoint_path, payload, credentials.merge(headers))
178
226
  end
179
227
 
@@ -195,7 +243,7 @@ module Line
195
243
  # client.reply_message(event['replyToken'], messages)
196
244
  #
197
245
  # @param token [String] Reply Token
198
- # @param messages [Hash or Array] Message Objects
246
+ # @param messages [Hash, Array] Message Objects
199
247
  # @return [Net::HTTPResponse]
200
248
  def reply_message(token, messages)
201
249
  channel_token_required
@@ -209,24 +257,25 @@ module Line
209
257
 
210
258
  # Send messages to multiple users using userIds.
211
259
  #
212
- # @param to [Array or String] Array of userIds
213
- # @param messages [Hash or Array] Message Objects
260
+ # @param to [Array, String] Array of userIds
261
+ # @param messages [Hash, Array] Message Objects
214
262
  # @param headers [Hash] HTTP Headers
263
+ # @param payload [Hash] Additional request body
215
264
  # @return [Net::HTTPResponse]
216
- def multicast(to, messages, headers: {})
265
+ def multicast(to, messages, headers: {}, payload: {})
217
266
  channel_token_required
218
267
 
219
268
  to = [to] if to.is_a?(String)
220
269
  messages = [messages] if messages.is_a?(Hash)
221
270
 
222
271
  endpoint_path = '/bot/message/multicast'
223
- payload = { to: to, messages: messages }.to_json
272
+ payload = payload.merge({ to: to, messages: messages }).to_json
224
273
  post(endpoint, endpoint_path, payload, credentials.merge(headers))
225
274
  end
226
275
 
227
276
  # Send messages to all friends.
228
277
  #
229
- # @param messages [Hash or Array] Message Objects
278
+ # @param messages [Hash, Array] Message Objects
230
279
  # @param headers [Hash] HTTP Headers
231
280
  #
232
281
  # @return [Net::HTTPResponse]
@@ -245,7 +294,7 @@ module Line
245
294
  # API Documentation is here.
246
295
  # https://developers.line.biz/en/reference/messaging-api/#send-narrowcast-message
247
296
  #
248
- # @param messages [Hash or Array]
297
+ # @param messages [Hash, Array]
249
298
  # @param recipient [Hash]
250
299
  # @param filter [Hash]
251
300
  # @param limit [Hash]
@@ -331,15 +380,22 @@ module Line
331
380
 
332
381
  # Get user IDs of who added your LINE Official Account as a friend
333
382
  #
334
- # @param continuation_token [String] Identifier to return next page
335
- # (next property to be included in the response)
383
+ # @param start [String] Identifier to return next page (next property to be included in the response)
384
+ # @param limit [Integer] The maximum number of user IDs to retrieve in a single request
336
385
  #
337
386
  # @return [Net::HTTPResponse]
338
- def get_follower_ids(continuation_token = nil)
387
+ def get_follower_ids(deprecated_continuation_token = nil, start: nil, limit: nil)
339
388
  channel_token_required
340
389
 
390
+ if deprecated_continuation_token
391
+ warn "continuation_token as the first argument is deprecated. Please use :start instead."
392
+ start = deprecated_continuation_token
393
+ end
394
+
395
+ params = { start: start, limit: limit }.compact
396
+
341
397
  endpoint_path = "/bot/followers/ids"
342
- endpoint_path += "?start=#{continuation_token}" if continuation_token
398
+ endpoint_path += "?" + URI.encode_www_form(params) unless params.empty?
343
399
  get(endpoint, endpoint_path, credentials)
344
400
  end
345
401
 
@@ -491,6 +547,18 @@ module Line
491
547
  post(endpoint, endpoint_path, rich_menu.to_json, credentials)
492
548
  end
493
549
 
550
+ # Validate a rich menu object
551
+ #
552
+ # @param rich_menu [Hash] The rich menu represented as a rich menu object
553
+ #
554
+ # @return [Net::HTTPResponse]
555
+ def validate_rich_menu_object(rich_menu)
556
+ channel_token_required
557
+
558
+ endpoint_path = '/bot/richmenu/validate'
559
+ post(endpoint, endpoint_path, rich_menu.to_json, credentials)
560
+ end
561
+
494
562
  # Delete a rich menu
495
563
  #
496
564
  # @param rich_menu_id [String] ID of an uploaded rich menu
@@ -990,6 +1058,45 @@ module Line
990
1058
  put(endpoint, endpoint_path, body.to_json, credentials)
991
1059
  end
992
1060
 
1061
+ # Get the per-unit statistics of how users interact with push messages and multicast messages.
1062
+ #
1063
+ # @param unit [String] Case-sensitive name of aggregation unit specified when sending the message.
1064
+ # @param from [String] Start date of aggregation period in UTC+9 with `yyyyMMdd` format
1065
+ # @param to [String] End date of aggregation period in UTC+9 with `yyyyMMdd` format.
1066
+ #
1067
+ # @return [Net::HTTPResponse]
1068
+ def get_statistics_per_unit(unit:, from:, to:)
1069
+ channel_token_required
1070
+
1071
+ params = {customAggregationUnit: unit, from: from, to: to}
1072
+ endpoint_path = "/bot/insight/message/event/aggregation?" + URI.encode_www_form(params)
1073
+ get(endpoint, endpoint_path, credentials)
1074
+ end
1075
+
1076
+ # Get the number of aggregation units used this month.
1077
+ #
1078
+ # @return [Net::HTTPResponse]
1079
+ def get_aggregation_info
1080
+ channel_token_required
1081
+
1082
+ endpoint_path = "/bot/message/aggregation/info"
1083
+ get(endpoint, endpoint_path, credentials)
1084
+ end
1085
+
1086
+ # Get the name list of units used this month for statistics aggregation.
1087
+ #
1088
+ # @param limit [Integer] Maximum number of aggregation units per request. Maximum: 100, Default: 100.
1089
+ # @param start [String] Value of the continuation token found in the `next` property of the JSON object returned in the response.
1090
+ #
1091
+ # @return [Net::HTTPResponse]
1092
+ def get_aggregation_list(limit: nil, start: nil)
1093
+ channel_token_required
1094
+
1095
+ params = {limit: limit, start: start}.compact
1096
+ endpoint_path = "/bot/message/aggregation/list?" + URI.encode_www_form(params)
1097
+ get(endpoint, endpoint_path, credentials)
1098
+ end
1099
+
993
1100
  # Fetch data, get content of specified URL.
994
1101
  #
995
1102
  # @param endpoint_base [String]
@@ -1006,7 +1113,7 @@ module Line
1006
1113
  #
1007
1114
  # @param endpoint_base [String]
1008
1115
  # @param endpoint_path [String]
1009
- # @param payload [String or NilClass]
1116
+ # @param payload [String, NilClass]
1010
1117
  # @param headers [Hash]
1011
1118
  #
1012
1119
  # @return [Net::HTTPResponse]
@@ -1019,7 +1126,7 @@ module Line
1019
1126
  #
1020
1127
  # @param endpoint_base [String]
1021
1128
  # @param endpoint_path [String]
1022
- # @param payload [String or NilClass]
1129
+ # @param payload [String, NilClass]
1023
1130
  # @param headers [Hash]
1024
1131
  #
1025
1132
  # @return [Net::HTTPResponse]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: line-bot-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.22.0
4
+ version: 1.25.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - LINE Corporation
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-09-28 00:00:00.000000000 Z
11
+ date: 2022-07-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -106,7 +106,7 @@ homepage: https://github.com/line/line-bot-sdk-ruby
106
106
  licenses:
107
107
  - Apache-2.0
108
108
  metadata: {}
109
- post_install_message:
109
+ post_install_message:
110
110
  rdoc_options: []
111
111
  require_paths:
112
112
  - lib
@@ -121,8 +121,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
121
121
  - !ruby/object:Gem::Version
122
122
  version: '0'
123
123
  requirements: []
124
- rubygems_version: 3.1.6
125
- signing_key:
124
+ rubygems_version: 3.3.3
125
+ signing_key:
126
126
  specification_version: 4
127
127
  summary: SDK of the LINE Messaging API
128
128
  test_files: []