line-bot-api 1.22.0 → 1.23.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: 17ed6a316ad332e424e59aa498c8e9ee3bc7062204f191ea3b78e44f74a623b0
4
+ data.tar.gz: 3a9cc6bbf3cbf658685873f4ea92c501cda4d73d6b6f969ec1620af4d34322ba
5
5
  SHA512:
6
- metadata.gz: d1f110ae8342f09be0d07bc335ce8f982868d10e26b9bc3eef0c0a60b77b0c1a06dde346eab279250b0c521888978db673a50c6db17d070d1650608fc2fb080a
7
- data.tar.gz: 7ab72e341fb0db004519df79eb2ef95e802f54da19fa90087d193c7bd493523fbb1069a70fd1c8b6be07ba7249491f1c4775fca298d8e6c4a97530ce9046279f
6
+ metadata.gz: 264355c41cc59a4063284d83902639df915df5dfa82b9787d1a4a973dfe4af2d729c171428c12b013e9f87ca6b667e1f8f0c41de5b93843a37040cafb1ea7f54
7
+ data.tar.gz: '08ef6e828069cf6a8d971450f054fc8c4a662b6244da697138cb33305b38e0a6711e0e75d82fccb9574f88b86e9f7bb8cf7cd13e247bab53c612c989572efc55'
@@ -15,7 +15,7 @@
15
15
  module Line
16
16
  module Bot
17
17
  module API
18
- VERSION = "1.22.0"
18
+ VERSION = "1.23.0"
19
19
  end
20
20
  end
21
21
  end
@@ -166,14 +166,15 @@ module Line
166
166
  # @param user_id [String] User Id
167
167
  # @param messages [Hash or Array] Message Objects
168
168
  # @param headers [Hash] HTTP Headers
169
+ # @param payload [Hash] Additional request body
169
170
  # @return [Net::HTTPResponse]
170
- def push_message(user_id, messages, headers: {})
171
+ def push_message(user_id, messages, headers: {}, payload: {})
171
172
  channel_token_required
172
173
 
173
174
  messages = [messages] if messages.is_a?(Hash)
174
175
 
175
176
  endpoint_path = '/bot/message/push'
176
- payload = { to: user_id, messages: messages }.to_json
177
+ payload = payload.merge({ to: user_id, messages: messages }).to_json
177
178
  post(endpoint, endpoint_path, payload, credentials.merge(headers))
178
179
  end
179
180
 
@@ -212,15 +213,16 @@ module Line
212
213
  # @param to [Array or String] Array of userIds
213
214
  # @param messages [Hash or Array] Message Objects
214
215
  # @param headers [Hash] HTTP Headers
216
+ # @param payload [Hash] Additional request body
215
217
  # @return [Net::HTTPResponse]
216
- def multicast(to, messages, headers: {})
218
+ def multicast(to, messages, headers: {}, payload: {})
217
219
  channel_token_required
218
220
 
219
221
  to = [to] if to.is_a?(String)
220
222
  messages = [messages] if messages.is_a?(Hash)
221
223
 
222
224
  endpoint_path = '/bot/message/multicast'
223
- payload = { to: to, messages: messages }.to_json
225
+ payload = payload.merge({ to: to, messages: messages }).to_json
224
226
  post(endpoint, endpoint_path, payload, credentials.merge(headers))
225
227
  end
226
228
 
@@ -331,15 +333,22 @@ module Line
331
333
 
332
334
  # Get user IDs of who added your LINE Official Account as a friend
333
335
  #
334
- # @param continuation_token [String] Identifier to return next page
335
- # (next property to be included in the response)
336
+ # @param start [String] Identifier to return next page (next property to be included in the response)
337
+ # @param limit [Integer] The maximum number of user IDs to retrieve in a single request
336
338
  #
337
339
  # @return [Net::HTTPResponse]
338
- def get_follower_ids(continuation_token = nil)
340
+ def get_follower_ids(deprecated_continuation_token = nil, start: nil, limit: nil)
339
341
  channel_token_required
340
342
 
343
+ if deprecated_continuation_token
344
+ warn "continuation_token as the first argument is deprecated. Please use :start instead."
345
+ start = deprecated_continuation_token
346
+ end
347
+
348
+ params = { start: start, limit: limit }.compact
349
+
341
350
  endpoint_path = "/bot/followers/ids"
342
- endpoint_path += "?start=#{continuation_token}" if continuation_token
351
+ endpoint_path += "?" + URI.encode_www_form(params) unless params.empty?
343
352
  get(endpoint, endpoint_path, credentials)
344
353
  end
345
354
 
@@ -990,6 +999,45 @@ module Line
990
999
  put(endpoint, endpoint_path, body.to_json, credentials)
991
1000
  end
992
1001
 
1002
+ # Get the per-unit statistics of how users interact with push messages and multicast messages.
1003
+ #
1004
+ # @param unit [String] Case-sensitive name of aggregation unit specified when sending the message.
1005
+ # @param from [String] Start date of aggregation period in UTC+9 with `yyyyMMdd` format
1006
+ # @param to [String] End date of aggregation period in UTC+9 with `yyyyMMdd` format.
1007
+ #
1008
+ # @return [Net::HTTPResponse]
1009
+ def get_statistics_per_unit(unit:, from:, to:)
1010
+ channel_token_required
1011
+
1012
+ params = {customAggregationUnit: unit, from: from, to: to}
1013
+ endpoint_path = "/bot/insight/message/event/aggregation?" + URI.encode_www_form(params)
1014
+ get(endpoint, endpoint_path, credentials)
1015
+ end
1016
+
1017
+ # Get the number of aggregation units used this month.
1018
+ #
1019
+ # @return [Net::HTTPResponse]
1020
+ def get_aggregation_info
1021
+ channel_token_required
1022
+
1023
+ endpoint_path = "/bot/message/aggregation/info"
1024
+ get(endpoint, endpoint_path, credentials)
1025
+ end
1026
+
1027
+ # Get the name list of units used this month for statistics aggregation.
1028
+ #
1029
+ # @param limit [Integer] Maximum number of aggregation units per request. Maximum: 100, Default: 100.
1030
+ # @param start [String] Value of the continuation token found in the `next` property of the JSON object returned in the response.
1031
+ #
1032
+ # @return [Net::HTTPResponse]
1033
+ def get_aggregation_list(limit: nil, start: nil)
1034
+ channel_token_required
1035
+
1036
+ params = {limit: limit, start: start}.compact
1037
+ endpoint_path = "/bot/message/aggregation/list?" + URI.encode_www_form(params)
1038
+ get(endpoint, endpoint_path, credentials)
1039
+ end
1040
+
993
1041
  # Fetch data, get content of specified URL.
994
1042
  #
995
1043
  # @param endpoint_base [String]
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.23.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - LINE Corporation
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-09-28 00:00:00.000000000 Z
11
+ date: 2022-01-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable