File tree Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -645,6 +645,16 @@ def get_bot_info
645
645
get ( endpoint , endpoint_path , credentials )
646
646
end
647
647
648
+ # Gets information on a webhook endpoint.
649
+ #
650
+ # @return [Net::HTTPResponse]
651
+ def get_webhook_endpoint
652
+ channel_token_required
653
+
654
+ endpoint_path = '/bot/channel/webhook/endpoint'
655
+ get ( endpoint , endpoint_path , credentials )
656
+ end
657
+
648
658
def get_liff_apps
649
659
channel_token_required
650
660
Original file line number Diff line number Diff line change 200
200
}
201
201
EOS
202
202
203
+ WEBHOOK_ENDPOINT_CONTENT = <<"EOS"
204
+ {
205
+ "endpoint": "https://example.com/test",
206
+ "active": true
207
+ }
208
+ EOS
209
+
203
210
describe Line ::Bot ::Client do
204
211
before do
205
212
end
@@ -480,4 +487,18 @@ def generate_client
480
487
markAsReadMode : 'manual'
481
488
)
482
489
end
490
+
491
+ it 'get webhook endpoint' do
492
+ uri_template = Addressable ::Template . new Line ::Bot ::API ::DEFAULT_ENDPOINT + '/bot/channel/webhook/endpoint'
493
+ stub_request ( :get , uri_template ) . to_return ( body : WEBHOOK_ENDPOINT_CONTENT , status : 200 )
494
+
495
+ client = generate_client
496
+ response = client . get_webhook_endpoint
497
+
498
+ json = JSON . parse ( response . body , symbolize_names : true )
499
+ expect ( json ) . to eq (
500
+ endpoint : 'https://example.com/test' ,
501
+ active : true
502
+ )
503
+ end
483
504
end
You can’t perform that action at this time.
0 commit comments