line-bot-api 1.21.0 → 1.24.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.
- checksums.yaml +4 -4
- data/lib/line/bot/api/version.rb +1 -1
- data/lib/line/bot/client.rb +138 -14
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e6b6ba33d24c43ef8485e0b9de1a5a36b928ec5cc89a259cc813c0952ada238d
|
4
|
+
data.tar.gz: 2bc49b9ee22a628cc94abfe4193627fc44ca10b02acb03441febb41052d00597
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 29985c36fc9b6273acbaf53b78ace56a278f16db96c43696dbfb0163638f64c2c567693c127883d7e2bea31a9ea3576972d83c0a8252a0b474be2da50ffb69ef
|
7
|
+
data.tar.gz: 540067af91254691fe7affa878f5a6197aa33bb0ea1ece0ff11e70bd91c2ebf05c496f226454c304339292f9e1c91fcee34366fbbcb055ea00cbe7a133654937
|
data/lib/line/bot/api/version.rb
CHANGED
data/lib/line/bot/client.rb
CHANGED
@@ -116,9 +116,6 @@ module Line
|
|
116
116
|
#
|
117
117
|
# @return [Net::HTTPResponse]
|
118
118
|
def issue_channel_access_token_jwt(jwt)
|
119
|
-
channel_id_required
|
120
|
-
channel_secret_required
|
121
|
-
|
122
119
|
endpoint_path = '/oauth2/v2.1/token'
|
123
120
|
payload = URI.encode_www_form(
|
124
121
|
grant_type: 'client_credentials',
|
@@ -148,15 +145,46 @@ module Line
|
|
148
145
|
post(oauth_endpoint, endpoint_path, payload, headers)
|
149
146
|
end
|
150
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
|
+
|
151
182
|
# Get all valid channel access token key IDs v2.1
|
152
183
|
#
|
153
184
|
# @param jwt [String]
|
154
185
|
#
|
155
186
|
# @return [Net::HTTPResponse]
|
156
187
|
def get_channel_access_token_key_ids_jwt(jwt)
|
157
|
-
channel_id_required
|
158
|
-
channel_secret_required
|
159
|
-
|
160
188
|
payload = URI.encode_www_form(
|
161
189
|
client_assertion_type: 'urn:ietf:params:oauth:client-assertion-type:jwt-bearer',
|
162
190
|
client_assertion: jwt
|
@@ -167,19 +195,33 @@ module Line
|
|
167
195
|
get(oauth_endpoint, endpoint_path, headers)
|
168
196
|
end
|
169
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
|
+
|
170
211
|
# Push messages to a user using user_id.
|
171
212
|
#
|
172
213
|
# @param user_id [String] User Id
|
173
214
|
# @param messages [Hash or Array] Message Objects
|
174
215
|
# @param headers [Hash] HTTP Headers
|
216
|
+
# @param payload [Hash] Additional request body
|
175
217
|
# @return [Net::HTTPResponse]
|
176
|
-
def push_message(user_id, messages, headers: {})
|
218
|
+
def push_message(user_id, messages, headers: {}, payload: {})
|
177
219
|
channel_token_required
|
178
220
|
|
179
221
|
messages = [messages] if messages.is_a?(Hash)
|
180
222
|
|
181
223
|
endpoint_path = '/bot/message/push'
|
182
|
-
payload = { to: user_id, messages: messages }.to_json
|
224
|
+
payload = payload.merge({ to: user_id, messages: messages }).to_json
|
183
225
|
post(endpoint, endpoint_path, payload, credentials.merge(headers))
|
184
226
|
end
|
185
227
|
|
@@ -218,15 +260,16 @@ module Line
|
|
218
260
|
# @param to [Array or String] Array of userIds
|
219
261
|
# @param messages [Hash or Array] Message Objects
|
220
262
|
# @param headers [Hash] HTTP Headers
|
263
|
+
# @param payload [Hash] Additional request body
|
221
264
|
# @return [Net::HTTPResponse]
|
222
|
-
def multicast(to, messages, headers: {})
|
265
|
+
def multicast(to, messages, headers: {}, payload: {})
|
223
266
|
channel_token_required
|
224
267
|
|
225
268
|
to = [to] if to.is_a?(String)
|
226
269
|
messages = [messages] if messages.is_a?(Hash)
|
227
270
|
|
228
271
|
endpoint_path = '/bot/message/multicast'
|
229
|
-
payload = { to: to, messages: messages }.to_json
|
272
|
+
payload = payload.merge({ to: to, messages: messages }).to_json
|
230
273
|
post(endpoint, endpoint_path, payload, credentials.merge(headers))
|
231
274
|
end
|
232
275
|
|
@@ -337,15 +380,22 @@ module Line
|
|
337
380
|
|
338
381
|
# Get user IDs of who added your LINE Official Account as a friend
|
339
382
|
#
|
340
|
-
# @param
|
341
|
-
#
|
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
|
342
385
|
#
|
343
386
|
# @return [Net::HTTPResponse]
|
344
|
-
def get_follower_ids(
|
387
|
+
def get_follower_ids(deprecated_continuation_token = nil, start: nil, limit: nil)
|
345
388
|
channel_token_required
|
346
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
|
+
|
347
397
|
endpoint_path = "/bot/followers/ids"
|
348
|
-
endpoint_path += "?
|
398
|
+
endpoint_path += "?" + URI.encode_www_form(params) unless params.empty?
|
349
399
|
get(endpoint, endpoint_path, credentials)
|
350
400
|
end
|
351
401
|
|
@@ -578,6 +628,41 @@ module Line
|
|
578
628
|
delete(endpoint, endpoint_path, credentials)
|
579
629
|
end
|
580
630
|
|
631
|
+
# Update rich menu alias
|
632
|
+
#
|
633
|
+
# @param rich_menu_id [String] ID of an uploaded rich menu
|
634
|
+
# @param rich_menu_alias_id [String] string of alias words rich menu
|
635
|
+
#
|
636
|
+
# @return [Net::HTTPResponse]
|
637
|
+
def update_rich_menus_alias(rich_menu_id, rich_menu_alias_id)
|
638
|
+
channel_token_required
|
639
|
+
|
640
|
+
endpoint_path = "/bot/richmenu/alias/#{rich_menu_alias_id}"
|
641
|
+
post(endpoint, endpoint_path, { richMenuId: rich_menu_id }.to_json, credentials)
|
642
|
+
end
|
643
|
+
|
644
|
+
# Get a rich menu alias via a rich menu alias ID
|
645
|
+
#
|
646
|
+
# @param rich_menu_alias_id [String] string of alias words rich menu
|
647
|
+
#
|
648
|
+
# @return [Net::HTTPResponse]
|
649
|
+
def get_rich_menus_alias(rich_menu_alias_id)
|
650
|
+
channel_token_required
|
651
|
+
|
652
|
+
endpoint_path = "/bot/richmenu/alias/#{rich_menu_alias_id}"
|
653
|
+
get(endpoint, endpoint_path, credentials)
|
654
|
+
end
|
655
|
+
|
656
|
+
# Get a list of all uploaded rich menus alias
|
657
|
+
#
|
658
|
+
# @return [Net::HTTPResponse]
|
659
|
+
def get_rich_menus_alias_list
|
660
|
+
channel_token_required
|
661
|
+
|
662
|
+
endpoint_path = "/bot/richmenu/alias/list"
|
663
|
+
get(endpoint, endpoint_path, credentials)
|
664
|
+
end
|
665
|
+
|
581
666
|
# Link a rich menu to a user
|
582
667
|
#
|
583
668
|
# If you want to link a rich menu to multiple users,
|
@@ -961,6 +1046,45 @@ module Line
|
|
961
1046
|
put(endpoint, endpoint_path, body.to_json, credentials)
|
962
1047
|
end
|
963
1048
|
|
1049
|
+
# Get the per-unit statistics of how users interact with push messages and multicast messages.
|
1050
|
+
#
|
1051
|
+
# @param unit [String] Case-sensitive name of aggregation unit specified when sending the message.
|
1052
|
+
# @param from [String] Start date of aggregation period in UTC+9 with `yyyyMMdd` format
|
1053
|
+
# @param to [String] End date of aggregation period in UTC+9 with `yyyyMMdd` format.
|
1054
|
+
#
|
1055
|
+
# @return [Net::HTTPResponse]
|
1056
|
+
def get_statistics_per_unit(unit:, from:, to:)
|
1057
|
+
channel_token_required
|
1058
|
+
|
1059
|
+
params = {customAggregationUnit: unit, from: from, to: to}
|
1060
|
+
endpoint_path = "/bot/insight/message/event/aggregation?" + URI.encode_www_form(params)
|
1061
|
+
get(endpoint, endpoint_path, credentials)
|
1062
|
+
end
|
1063
|
+
|
1064
|
+
# Get the number of aggregation units used this month.
|
1065
|
+
#
|
1066
|
+
# @return [Net::HTTPResponse]
|
1067
|
+
def get_aggregation_info
|
1068
|
+
channel_token_required
|
1069
|
+
|
1070
|
+
endpoint_path = "/bot/message/aggregation/info"
|
1071
|
+
get(endpoint, endpoint_path, credentials)
|
1072
|
+
end
|
1073
|
+
|
1074
|
+
# Get the name list of units used this month for statistics aggregation.
|
1075
|
+
#
|
1076
|
+
# @param limit [Integer] Maximum number of aggregation units per request. Maximum: 100, Default: 100.
|
1077
|
+
# @param start [String] Value of the continuation token found in the `next` property of the JSON object returned in the response.
|
1078
|
+
#
|
1079
|
+
# @return [Net::HTTPResponse]
|
1080
|
+
def get_aggregation_list(limit: nil, start: nil)
|
1081
|
+
channel_token_required
|
1082
|
+
|
1083
|
+
params = {limit: limit, start: start}.compact
|
1084
|
+
endpoint_path = "/bot/message/aggregation/list?" + URI.encode_www_form(params)
|
1085
|
+
get(endpoint, endpoint_path, credentials)
|
1086
|
+
end
|
1087
|
+
|
964
1088
|
# Fetch data, get content of specified URL.
|
965
1089
|
#
|
966
1090
|
# @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.
|
4
|
+
version: 1.24.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:
|
11
|
+
date: 2022-05-30 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.
|
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: []
|