Class: Line::Bot::V2::ChannelAccessToken::ApiClient
- Inherits:
-
Object
- Object
- Line::Bot::V2::ChannelAccessToken::ApiClient
- Defined in:
- lib/line/bot/v2/channel_access_token/api/channel_access_token_client.rb
Instance Method Summary collapse
-
#gets_all_valid_channel_access_token_key_ids(client_assertion_type:, client_assertion:) ⇒ Line::Bot::V2::ChannelAccessToken::ChannelAccessTokenKeyIdsResponse, ...
Gets all valid channel access token key IDs.
-
#gets_all_valid_channel_access_token_key_ids_with_http_info(client_assertion_type:, client_assertion:) ⇒ Array(Line::Bot::V2::ChannelAccessToken::ChannelAccessTokenKeyIdsResponse, Integer, Hash{String => String}), Array((String|nil), Integer, Hash{String => String})
Gets all valid channel access token key IDs.
-
#initialize(base_url: nil, http_options: {}) ⇒ ApiClient
constructor
Initializes a new ApiClient instance.
-
#issue_channel_token(grant_type:, client_id:, client_secret:) ⇒ Line::Bot::V2::ChannelAccessToken::IssueShortLivedChannelAccessTokenResponse, ...
Issue short-lived channel access token This requests to
POST https://api.line.me/v2/oauth/accessToken
When you want to get HTTP status code or response headers, use #issue_channel_token_with_http_info instead of this. -
#issue_channel_token_by_jwt(grant_type:, client_assertion_type:, client_assertion:) ⇒ Line::Bot::V2::ChannelAccessToken::IssueChannelAccessTokenResponse, ...
Issues a channel access token that allows you to specify a desired expiration date.
-
#issue_channel_token_by_jwt_with_http_info(grant_type:, client_assertion_type:, client_assertion:) ⇒ Array(Line::Bot::V2::ChannelAccessToken::IssueChannelAccessTokenResponse, Integer, Hash{String => String}), Array((String|nil), Integer, Hash{String => String})
Issues a channel access token that allows you to specify a desired expiration date.
-
#issue_channel_token_with_http_info(grant_type:, client_id:, client_secret:) ⇒ Array(Line::Bot::V2::ChannelAccessToken::IssueShortLivedChannelAccessTokenResponse, Integer, Hash{String => String}), ...
Issue short-lived channel access token This requests to
POST https://api.line.me/v2/oauth/accessToken
This returns an array containing response, HTTP status code, and header in order. -
#issue_stateless_channel_token(grant_type: nil, client_assertion_type: nil, client_assertion: nil, client_id: nil, client_secret: nil) ⇒ Line::Bot::V2::ChannelAccessToken::IssueStatelessChannelAccessTokenResponse, ...
Issues a new stateless channel access token, which doesn’t have max active token limit unlike the other token types.
-
#issue_stateless_channel_token_with_http_info(grant_type: nil, client_assertion_type: nil, client_assertion: nil, client_id: nil, client_secret: nil) ⇒ Array(Line::Bot::V2::ChannelAccessToken::IssueStatelessChannelAccessTokenResponse, Integer, Hash{String => String}), Array((String|nil), Integer, Hash{String => String})
Issues a new stateless channel access token, which doesn’t have max active token limit unlike the other token types.
-
#revoke_channel_token(access_token:) ⇒ String?
Revoke short-lived or long-lived channel access token This requests to
POST https://api.line.me/v2/oauth/revoke
When you want to get HTTP status code or response headers, use #revoke_channel_token_with_http_info instead of this. -
#revoke_channel_token_by_jwt(client_id:, client_secret:, access_token:) ⇒ String?
Revoke channel access token v2.1 This requests to
POST https://api.line.me/oauth2/v2.1/revoke
When you want to get HTTP status code or response headers, use #revoke_channel_token_by_jwt_with_http_info instead of this. -
#revoke_channel_token_by_jwt_with_http_info(client_id:, client_secret:, access_token:) ⇒ Array((String|nil), Integer, Hash{String => String})
Revoke channel access token v2.1 This requests to
POST https://api.line.me/oauth2/v2.1/revoke
This returns an array containing response, HTTP status code, and header in order. -
#revoke_channel_token_with_http_info(access_token:) ⇒ Array((String|nil), Integer, Hash{String => String})
Revoke short-lived or long-lived channel access token This requests to
POST https://api.line.me/v2/oauth/revoke
This returns an array containing response, HTTP status code, and header in order. -
#verify_channel_token(access_token:) ⇒ Line::Bot::V2::ChannelAccessToken::VerifyChannelAccessTokenResponse, ...
Verify the validity of short-lived and long-lived channel access tokens This requests to
POST https://api.line.me/v2/oauth/verify
When you want to get HTTP status code or response headers, use #verify_channel_token_with_http_info instead of this. -
#verify_channel_token_by_jwt(access_token:) ⇒ Line::Bot::V2::ChannelAccessToken::VerifyChannelAccessTokenResponse, ...
You can verify whether a Channel access token with a user-specified expiration (Channel Access Token v2.1) is valid.
-
#verify_channel_token_by_jwt_with_http_info(access_token:) ⇒ Array(Line::Bot::V2::ChannelAccessToken::VerifyChannelAccessTokenResponse, Integer, Hash{String => String}), Array((String|nil), Integer, Hash{String => String})
You can verify whether a Channel access token with a user-specified expiration (Channel Access Token v2.1) is valid.
-
#verify_channel_token_with_http_info(access_token:) ⇒ Array(Line::Bot::V2::ChannelAccessToken::VerifyChannelAccessTokenResponse, Integer, Hash{String => String}), Array((String|nil), Integer, Hash{String => String})
Verify the validity of short-lived and long-lived channel access tokens This requests to
POST https://api.line.me/v2/oauth/verify
This returns an array containing response, HTTP status code, and header in order.
Constructor Details
#initialize(base_url: nil, http_options: {}) ⇒ ApiClient
Initializes a new Line::Bot::V2::ChannelAccessToken::ApiClient instance.
36 37 38 39 40 41 |
# File 'lib/line/bot/v2/channel_access_token/api/channel_access_token_client.rb', line 36 def initialize(base_url: nil, http_options: {}) @http_client = HttpClient.new( base_url: base_url || 'https://api.line.me', http_options: ) end |
Instance Method Details
#gets_all_valid_channel_access_token_key_ids(client_assertion_type:, client_assertion:) ⇒ Line::Bot::V2::ChannelAccessToken::ChannelAccessTokenKeyIdsResponse, ...
Gets all valid channel access token key IDs. This requests to GET https://api.line.me/oauth2/v2.1/tokens/kid
When you want to get HTTP status code or response headers, use #gets_all_valid_channel_access_token_key_ids_with_http_info instead of this.
89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/line/bot/v2/channel_access_token/api/channel_access_token_client.rb', line 89 def gets_all_valid_channel_access_token_key_ids( client_assertion_type:, client_assertion: ) response_body, _status_code, _headers = gets_all_valid_channel_access_token_key_ids_with_http_info( client_assertion_type: client_assertion_type, client_assertion: client_assertion ) response_body end |
#gets_all_valid_channel_access_token_key_ids_with_http_info(client_assertion_type:, client_assertion:) ⇒ Array(Line::Bot::V2::ChannelAccessToken::ChannelAccessTokenKeyIdsResponse, Integer, Hash{String => String}), Array((String|nil), Integer, Hash{String => String})
Gets all valid channel access token key IDs. This requests to GET https://api.line.me/oauth2/v2.1/tokens/kid
This returns an array containing response, HTTP status code, and header in order. Please specify all header keys in lowercase.
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/line/bot/v2/channel_access_token/api/channel_access_token_client.rb', line 52 def gets_all_valid_channel_access_token_key_ids_with_http_info( # steep:ignore MethodBodyTypeMismatch client_assertion_type:, client_assertion: ) path = "/oauth2/v2.1/tokens/kid" query_params = { "client_assertion_type": client_assertion_type, "client_assertion": client_assertion }.compact response = @http_client.get( path: path, query_params: query_params, ) case response.code.to_i when 200 json = Line::Bot::V2::Utils.deep_underscore(JSON.parse(response.body)) json.transform_keys! do |key| Line::Bot::V2::RESERVED_WORDS.include?(key) ? "_#{key}".to_sym : key end response_body = Line::Bot::V2::ChannelAccessToken::ChannelAccessTokenKeyIdsResponse.create(json) # steep:ignore InsufficientKeywordArguments [response_body, 200, response.each_header.to_h] else [response.body, response.code.to_i, response.each_header.to_h] end end |
#issue_channel_token(grant_type:, client_id:, client_secret:) ⇒ Line::Bot::V2::ChannelAccessToken::IssueShortLivedChannelAccessTokenResponse, ...
Issue short-lived channel access token This requests to POST https://api.line.me/v2/oauth/accessToken
When you want to get HTTP status code or response headers, use #issue_channel_token_with_http_info instead of this.
161 162 163 164 165 166 167 168 169 170 171 172 173 |
# File 'lib/line/bot/v2/channel_access_token/api/channel_access_token_client.rb', line 161 def issue_channel_token( grant_type:, client_id:, client_secret: ) response_body, _status_code, _headers = issue_channel_token_with_http_info( grant_type: grant_type, client_id: client_id, client_secret: client_secret ) response_body end |
#issue_channel_token_by_jwt(grant_type:, client_assertion_type:, client_assertion:) ⇒ Line::Bot::V2::ChannelAccessToken::IssueChannelAccessTokenResponse, ...
Issues a channel access token that allows you to specify a desired expiration date. This method lets you use JWT assertion for authentication. This requests to POST https://api.line.me/oauth2/v2.1/token
When you want to get HTTP status code or response headers, use #issue_channel_token_by_jwt_with_http_info instead of this.
226 227 228 229 230 231 232 233 234 235 236 237 238 |
# File 'lib/line/bot/v2/channel_access_token/api/channel_access_token_client.rb', line 226 def issue_channel_token_by_jwt( grant_type:, client_assertion_type:, client_assertion: ) response_body, _status_code, _headers = issue_channel_token_by_jwt_with_http_info( grant_type: grant_type, client_assertion_type: client_assertion_type, client_assertion: client_assertion ) response_body end |
#issue_channel_token_by_jwt_with_http_info(grant_type:, client_assertion_type:, client_assertion:) ⇒ Array(Line::Bot::V2::ChannelAccessToken::IssueChannelAccessTokenResponse, Integer, Hash{String => String}), Array((String|nil), Integer, Hash{String => String})
Issues a channel access token that allows you to specify a desired expiration date. This method lets you use JWT assertion for authentication. This requests to POST https://api.line.me/oauth2/v2.1/token
This returns an array containing response, HTTP status code, and header in order. Please specify all header keys in lowercase.
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 |
# File 'lib/line/bot/v2/channel_access_token/api/channel_access_token_client.rb', line 185 def issue_channel_token_by_jwt_with_http_info( # steep:ignore MethodBodyTypeMismatch grant_type:, client_assertion_type:, client_assertion: ) path = "/oauth2/v2.1/token" form_params = { "grant_type": grant_type, "client_assertion_type": client_assertion_type, "client_assertion": client_assertion }.compact response = @http_client.post_form( path: path, form_params: form_params, ) case response.code.to_i when 200 json = Line::Bot::V2::Utils.deep_underscore(JSON.parse(response.body)) json.transform_keys! do |key| Line::Bot::V2::RESERVED_WORDS.include?(key) ? "_#{key}".to_sym : key end response_body = Line::Bot::V2::ChannelAccessToken::IssueChannelAccessTokenResponse.create(json) # steep:ignore InsufficientKeywordArguments [response_body, 200, response.each_header.to_h] else [response.body, response.code.to_i, response.each_header.to_h] end end |
#issue_channel_token_with_http_info(grant_type:, client_id:, client_secret:) ⇒ Array(Line::Bot::V2::ChannelAccessToken::IssueShortLivedChannelAccessTokenResponse, Integer, Hash{String => String}), ...
Issue short-lived channel access token This requests to POST https://api.line.me/v2/oauth/accessToken
This returns an array containing response, HTTP status code, and header in order. Please specify all header keys in lowercase.
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 |
# File 'lib/line/bot/v2/channel_access_token/api/channel_access_token_client.rb', line 112 def issue_channel_token_with_http_info( # steep:ignore MethodBodyTypeMismatch grant_type:, client_id:, client_secret: ) path = "/v2/oauth/accessToken" form_params = { "grant_type": grant_type, "client_id": client_id, "client_secret": client_secret }.compact response = @http_client.post_form( path: path, form_params: form_params, ) case response.code.to_i when 200 json = Line::Bot::V2::Utils.deep_underscore(JSON.parse(response.body)) json.transform_keys! do |key| Line::Bot::V2::RESERVED_WORDS.include?(key) ? "_#{key}".to_sym : key end response_body = Line::Bot::V2::ChannelAccessToken::IssueShortLivedChannelAccessTokenResponse.create(json) # steep:ignore InsufficientKeywordArguments [response_body, 200, response.each_header.to_h] when 400 json = Line::Bot::V2::Utils.deep_underscore(JSON.parse(response.body)) json.transform_keys! do |key| Line::Bot::V2::RESERVED_WORDS.include?(key) ? "_#{key}".to_sym : key end response_body = Line::Bot::V2::ChannelAccessToken::ErrorResponse.create(json) # steep:ignore InsufficientKeywordArguments [response_body, 400, response.each_header.to_h] else [response.body, response.code.to_i, response.each_header.to_h] end end |
#issue_stateless_channel_token(grant_type: nil, client_assertion_type: nil, client_assertion: nil, client_id: nil, client_secret: nil) ⇒ Line::Bot::V2::ChannelAccessToken::IssueStatelessChannelAccessTokenResponse, ...
Issues a new stateless channel access token, which doesn’t have max active token limit unlike the other token types. The newly issued token is only valid for 15 minutes but can not be revoked until it naturally expires. This requests to POST https://api.line.me/oauth2/v3/token
When you want to get HTTP status code or response headers, use #issue_stateless_channel_token_with_http_info instead of this.
299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 |
# File 'lib/line/bot/v2/channel_access_token/api/channel_access_token_client.rb', line 299 def issue_stateless_channel_token( grant_type: nil, client_assertion_type: nil, client_assertion: nil, client_id: nil, client_secret: nil ) response_body, _status_code, _headers = issue_stateless_channel_token_with_http_info( grant_type: grant_type, client_assertion_type: client_assertion_type, client_assertion: client_assertion, client_id: client_id, client_secret: client_secret ) response_body end |
#issue_stateless_channel_token_with_http_info(grant_type: nil, client_assertion_type: nil, client_assertion: nil, client_id: nil, client_secret: nil) ⇒ Array(Line::Bot::V2::ChannelAccessToken::IssueStatelessChannelAccessTokenResponse, Integer, Hash{String => String}), Array((String|nil), Integer, Hash{String => String})
Issues a new stateless channel access token, which doesn’t have max active token limit unlike the other token types. The newly issued token is only valid for 15 minutes but can not be revoked until it naturally expires. This requests to POST https://api.line.me/oauth2/v3/token
This returns an array containing response, HTTP status code, and header in order. Please specify all header keys in lowercase.
252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 |
# File 'lib/line/bot/v2/channel_access_token/api/channel_access_token_client.rb', line 252 def issue_stateless_channel_token_with_http_info( # steep:ignore MethodBodyTypeMismatch grant_type: nil, client_assertion_type: nil, client_assertion: nil, client_id: nil, client_secret: nil ) path = "/oauth2/v3/token" form_params = { "grant_type": grant_type, "client_assertion_type": client_assertion_type, "client_assertion": client_assertion, "client_id": client_id, "client_secret": client_secret }.compact response = @http_client.post_form( path: path, form_params: form_params, ) case response.code.to_i when 200 json = Line::Bot::V2::Utils.deep_underscore(JSON.parse(response.body)) json.transform_keys! do |key| Line::Bot::V2::RESERVED_WORDS.include?(key) ? "_#{key}".to_sym : key end response_body = Line::Bot::V2::ChannelAccessToken::IssueStatelessChannelAccessTokenResponse.create(json) # steep:ignore InsufficientKeywordArguments [response_body, 200, response.each_header.to_h] else [response.body, response.code.to_i, response.each_header.to_h] end end |
#revoke_channel_token(access_token:) ⇒ String?
Revoke short-lived or long-lived channel access token This requests to POST https://api.line.me/v2/oauth/revoke
When you want to get HTTP status code or response headers, use #revoke_channel_token_with_http_info instead of this.
355 356 357 358 359 360 361 362 363 |
# File 'lib/line/bot/v2/channel_access_token/api/channel_access_token_client.rb', line 355 def revoke_channel_token( access_token: ) response_body, _status_code, _headers = revoke_channel_token_with_http_info( access_token: access_token ) response_body end |
#revoke_channel_token_by_jwt(client_id:, client_secret:, access_token:) ⇒ String?
Revoke channel access token v2.1 This requests to POST https://api.line.me/oauth2/v2.1/revoke
When you want to get HTTP status code or response headers, use #revoke_channel_token_by_jwt_with_http_info instead of this.
411 412 413 414 415 416 417 418 419 420 421 422 423 |
# File 'lib/line/bot/v2/channel_access_token/api/channel_access_token_client.rb', line 411 def revoke_channel_token_by_jwt( client_id:, client_secret:, access_token: ) response_body, _status_code, _headers = revoke_channel_token_by_jwt_with_http_info( client_id: client_id, client_secret: client_secret, access_token: access_token ) response_body end |
#revoke_channel_token_by_jwt_with_http_info(client_id:, client_secret:, access_token:) ⇒ Array((String|nil), Integer, Hash{String => String})
Revoke channel access token v2.1 This requests to POST https://api.line.me/oauth2/v2.1/revoke
This returns an array containing response, HTTP status code, and header in order. Please specify all header keys in lowercase.
375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 |
# File 'lib/line/bot/v2/channel_access_token/api/channel_access_token_client.rb', line 375 def revoke_channel_token_by_jwt_with_http_info( # steep:ignore MethodBodyTypeMismatch client_id:, client_secret:, access_token: ) path = "/oauth2/v2.1/revoke" form_params = { "client_id": client_id, "client_secret": client_secret, "access_token": access_token }.compact response = @http_client.post_form( path: path, form_params: form_params, ) case response.code.to_i when 200 [response.body, 200, response.each_header.to_h] else [response.body, response.code.to_i, response.each_header.to_h] end end |
#revoke_channel_token_with_http_info(access_token:) ⇒ Array((String|nil), Integer, Hash{String => String})
Revoke short-lived or long-lived channel access token This requests to POST https://api.line.me/v2/oauth/revoke
This returns an array containing response, HTTP status code, and header in order. Please specify all header keys in lowercase.
325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 |
# File 'lib/line/bot/v2/channel_access_token/api/channel_access_token_client.rb', line 325 def revoke_channel_token_with_http_info( # steep:ignore MethodBodyTypeMismatch access_token: ) path = "/v2/oauth/revoke" form_params = { "access_token": access_token }.compact response = @http_client.post_form( path: path, form_params: form_params, ) case response.code.to_i when 200 [response.body, 200, response.each_header.to_h] else [response.body, response.code.to_i, response.each_header.to_h] end end |
#verify_channel_token(access_token:) ⇒ Line::Bot::V2::ChannelAccessToken::VerifyChannelAccessTokenResponse, ...
Verify the validity of short-lived and long-lived channel access tokens This requests to POST https://api.line.me/v2/oauth/verify
When you want to get HTTP status code or response headers, use #verify_channel_token_with_http_info instead of this.
468 469 470 471 472 473 474 475 476 |
# File 'lib/line/bot/v2/channel_access_token/api/channel_access_token_client.rb', line 468 def verify_channel_token( access_token: ) response_body, _status_code, _headers = verify_channel_token_with_http_info( access_token: access_token ) response_body end |
#verify_channel_token_by_jwt(access_token:) ⇒ Line::Bot::V2::ChannelAccessToken::VerifyChannelAccessTokenResponse, ...
You can verify whether a Channel access token with a user-specified expiration (Channel Access Token v2.1) is valid. This requests to GET https://api.line.me/oauth2/v2.1/verify
When you want to get HTTP status code or response headers, use #verify_channel_token_by_jwt_with_http_info instead of this.
520 521 522 523 524 525 526 527 528 |
# File 'lib/line/bot/v2/channel_access_token/api/channel_access_token_client.rb', line 520 def verify_channel_token_by_jwt( access_token: ) response_body, _status_code, _headers = verify_channel_token_by_jwt_with_http_info( access_token: access_token ) response_body end |
#verify_channel_token_by_jwt_with_http_info(access_token:) ⇒ Array(Line::Bot::V2::ChannelAccessToken::VerifyChannelAccessTokenResponse, Integer, Hash{String => String}), Array((String|nil), Integer, Hash{String => String})
You can verify whether a Channel access token with a user-specified expiration (Channel Access Token v2.1) is valid. This requests to GET https://api.line.me/oauth2/v2.1/verify
This returns an array containing response, HTTP status code, and header in order. Please specify all header keys in lowercase.
486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 |
# File 'lib/line/bot/v2/channel_access_token/api/channel_access_token_client.rb', line 486 def verify_channel_token_by_jwt_with_http_info( # steep:ignore MethodBodyTypeMismatch access_token: ) path = "/oauth2/v2.1/verify" query_params = { "access_token": access_token }.compact response = @http_client.get( path: path, query_params: query_params, ) case response.code.to_i when 200 json = Line::Bot::V2::Utils.deep_underscore(JSON.parse(response.body)) json.transform_keys! do |key| Line::Bot::V2::RESERVED_WORDS.include?(key) ? "_#{key}".to_sym : key end response_body = Line::Bot::V2::ChannelAccessToken::VerifyChannelAccessTokenResponse.create(json) # steep:ignore InsufficientKeywordArguments [response_body, 200, response.each_header.to_h] else [response.body, response.code.to_i, response.each_header.to_h] end end |
#verify_channel_token_with_http_info(access_token:) ⇒ Array(Line::Bot::V2::ChannelAccessToken::VerifyChannelAccessTokenResponse, Integer, Hash{String => String}), Array((String|nil), Integer, Hash{String => String})
Verify the validity of short-lived and long-lived channel access tokens This requests to POST https://api.line.me/v2/oauth/verify
This returns an array containing response, HTTP status code, and header in order. Please specify all header keys in lowercase.
433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 |
# File 'lib/line/bot/v2/channel_access_token/api/channel_access_token_client.rb', line 433 def verify_channel_token_with_http_info( # steep:ignore MethodBodyTypeMismatch access_token: ) path = "/v2/oauth/verify" form_params = { "access_token": access_token }.compact response = @http_client.post_form( path: path, form_params: form_params, ) case response.code.to_i when 200 json = Line::Bot::V2::Utils.deep_underscore(JSON.parse(response.body)) json.transform_keys! do |key| Line::Bot::V2::RESERVED_WORDS.include?(key) ? "_#{key}".to_sym : key end response_body = Line::Bot::V2::ChannelAccessToken::VerifyChannelAccessTokenResponse.create(json) # steep:ignore InsufficientKeywordArguments [response_body, 200, response.each_header.to_h] else [response.body, response.code.to_i, response.each_header.to_h] end end |