File tree Expand file tree Collapse file tree 2 files changed +39
-0
lines changed Expand file tree Collapse file tree 2 files changed +39
-0
lines changed Original file line number Diff line number Diff line change @@ -631,6 +631,16 @@ def get_friend_demographics
631631 get ( endpoint , endpoint_path , credentials )
632632 end
633633
634+ # Gets a bot's basic information.
635+ #
636+ # @return [Net::HTTPResponse]
637+ def get_bot_info
638+ channel_token_required
639+
640+ endpoint_path = '/bot/info'
641+ get ( endpoint , endpoint_path , credentials )
642+ end
643+
634644 # Fetch data, get content of specified URL.
635645 #
636646 # @param endpoint_base [String]
Original file line number Diff line number Diff line change 189189}
190190EOS
191191
192+ BOT_INFO_CONTENT = <<"EOS"
193+ {
194+ "userId": "Ufr47556f2e40dba2456887320ba7c76d",
195+ "basicId": "@abcdefghijklmn",
196+ "displayName": "Example",
197+ "pictureUrl": "https://obs.line-apps.com/abcdefghijklmn",
198+ "chatMode": "chat",
199+ "markAsReadMode": "manual"
200+ }
201+ EOS
202+
192203WebMock . allow_net_connect!
193204
194205describe Line ::Bot ::Client do
@@ -453,4 +464,22 @@ def generate_client
453464 ]
454465 )
455466 end
467+
468+ it 'get bot info' do
469+ uri_template = Addressable ::Template . new Line ::Bot ::API ::DEFAULT_ENDPOINT + '/bot/info'
470+ stub_request ( :get , uri_template ) . to_return ( body : BOT_INFO_CONTENT , status : 200 )
471+
472+ client = generate_client
473+ response = client . get_bot_info
474+
475+ json = JSON . parse ( response . body , symbolize_names : true )
476+ expect ( json ) . to eq (
477+ userId : 'Ufr47556f2e40dba2456887320ba7c76d' ,
478+ basicId : '@abcdefghijklmn' ,
479+ displayName : 'Example' ,
480+ pictureUrl : 'https://obs.line-apps.com/abcdefghijklmn' ,
481+ chatMode : 'chat' ,
482+ markAsReadMode : 'manual'
483+ )
484+ end
456485end
You can’t perform that action at this time.
0 commit comments