line-bot-api 1.20.0 → 1.21.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 06c883b0ee3ec91de695af601b3e147a9da46b4e75688522adbc76d98ef03758
4
- data.tar.gz: 2fb79d8e282e2e832a9f66dad91f51db41bf9381ad7f015fb4efb5e6bac592af
3
+ metadata.gz: 0c7c212cf7261c341fbd02845a3f678aa8d2eadd302a5fef4bb4e574a4013062
4
+ data.tar.gz: b87face2a4aacc3245a678c6cf21099702ca352c26e42ed3377e98565dceaf1f
5
5
  SHA512:
6
- metadata.gz: '05859f1da6840e6803ee814b335af6b854db5832d52a6f9b5760a56cd38a33d2f6c2655ea82b8b3026855714454d74ae231ec66739677f28147743973511a793'
7
- data.tar.gz: 25dc42c2df495b0221d74306cf831f68ab72004808a92f72d415e50b75837b937dc95f49f3bd8673ee2b16475d829f3e5d14c189f4170b5a0b645f5217f934db
6
+ metadata.gz: 860c6649dcb835b6f495fefd96b27b98cd2501fc5b3c93479b7cd10a65fd396e4008f86d6cd6fe74dc3cba8f9fd3392f20ee2151d6345087e7ab216124e12ab6
7
+ data.tar.gz: 18f79d5e93ec212165d4855e60060f8fc5b9c91e9b6f804e0469f4d18215565f0141ff17b6dfcf0fed35eefd6d289ce7fa4d15c138b345d0d2047fe3d7f6c807
data/lib/line/bot/api.rb CHANGED
@@ -17,6 +17,7 @@ require 'line/bot/api/version'
17
17
  module Line
18
18
  module Bot
19
19
  module API
20
+ DEFAULT_OAUTH_ENDPOINT = "https://api.line.me"
20
21
  DEFAULT_ENDPOINT = "https://api.line.me/v2"
21
22
  DEFAULT_BLOB_ENDPOINT = "https://api-data.line.me/v2"
22
23
  DEFAULT_LIFF_ENDPOINT = "https://api.line.me/liff/v1"
@@ -15,7 +15,7 @@
15
15
  module Line
16
16
  module Bot
17
17
  module API
18
- VERSION = "1.20.0"
18
+ VERSION = "1.21.0"
19
19
  end
20
20
  end
21
21
  end
@@ -55,6 +55,10 @@ module Line
55
55
  @endpoint ||= API::DEFAULT_ENDPOINT
56
56
  end
57
57
 
58
+ def oauth_endpoint
59
+ @oauth_endpoint ||= API::DEFAULT_OAUTH_ENDPOINT
60
+ end
61
+
58
62
  def blob_endpoint
59
63
  return @blob_endpoint if @blob_endpoint
60
64
 
@@ -106,6 +110,63 @@ module Line
106
110
  post(endpoint, endpoint_path, payload, headers)
107
111
  end
108
112
 
113
+ # Issue channel access token v2.1
114
+ #
115
+ # @param jwt [String]
116
+ #
117
+ # @return [Net::HTTPResponse]
118
+ def issue_channel_access_token_jwt(jwt)
119
+ channel_id_required
120
+ channel_secret_required
121
+
122
+ endpoint_path = '/oauth2/v2.1/token'
123
+ payload = URI.encode_www_form(
124
+ grant_type: 'client_credentials',
125
+ client_assertion_type: 'urn:ietf:params:oauth:client-assertion-type:jwt-bearer',
126
+ client_assertion: jwt
127
+ )
128
+ headers = { 'Content-Type' => 'application/x-www-form-urlencoded' }
129
+ post(oauth_endpoint, endpoint_path, payload, headers)
130
+ end
131
+
132
+ # Revoke channel access token v2.1
133
+ #
134
+ # @param access_token [String]
135
+ #
136
+ # @return [Net::HTTPResponse]
137
+ def revoke_channel_access_token_jwt(access_token)
138
+ channel_id_required
139
+ channel_secret_required
140
+
141
+ endpoint_path = '/oauth2/v2.1/revoke'
142
+ payload = URI.encode_www_form(
143
+ client_id: channel_id,
144
+ client_secret: channel_secret,
145
+ access_token: access_token
146
+ )
147
+ headers = { 'Content-Type' => 'application/x-www-form-urlencoded' }
148
+ post(oauth_endpoint, endpoint_path, payload, headers)
149
+ end
150
+
151
+ # Get all valid channel access token key IDs v2.1
152
+ #
153
+ # @param jwt [String]
154
+ #
155
+ # @return [Net::HTTPResponse]
156
+ def get_channel_access_token_key_ids_jwt(jwt)
157
+ channel_id_required
158
+ channel_secret_required
159
+
160
+ payload = URI.encode_www_form(
161
+ client_assertion_type: 'urn:ietf:params:oauth:client-assertion-type:jwt-bearer',
162
+ client_assertion: jwt
163
+ )
164
+ endpoint_path = "/oauth2/v2.1/tokens/kid?#{payload}"
165
+
166
+ headers = { 'Content-Type' => 'application/x-www-form-urlencoded' }
167
+ get(oauth_endpoint, endpoint_path, headers)
168
+ end
169
+
109
170
  # Push messages to a user using user_id.
110
171
  #
111
172
  # @param user_id [String] User Id
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.20.0
4
+ version: 1.21.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-07-19 00:00:00.000000000 Z
11
+ date: 2021-08-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -121,7 +121,7 @@ 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.4
124
+ rubygems_version: 3.1.6
125
125
  signing_key:
126
126
  specification_version: 4
127
127
  summary: SDK of the LINE Messaging API