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
645645 get ( endpoint , endpoint_path , credentials )
646646 end
647647
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+
648658 def get_liff_apps
649659 channel_token_required
650660
Original file line number Diff line number Diff line change 200200}
201201EOS
202202
203+ WEBHOOK_ENDPOINT_CONTENT = <<"EOS"
204+ {
205+ "endpoint": "https://example.com/test",
206+ "active": true
207+ }
208+ EOS
209+
203210describe Line ::Bot ::Client do
204211 before do
205212 end
@@ -480,4 +487,18 @@ def generate_client
480487 markAsReadMode : 'manual'
481488 )
482489 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
483504end
You can’t perform that action at this time.
0 commit comments