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
631
631
get ( endpoint , endpoint_path , credentials )
632
632
end
633
633
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
+
634
644
# Fetch data, get content of specified URL.
635
645
#
636
646
# @param endpoint_base [String]
Original file line number Diff line number Diff line change 189
189
}
190
190
EOS
191
191
192
+ BOT_INFO_CONTENT = <<"EOS"
193
+ {
194
+ "userId": "Ufr47556f2e40dba2456887320ba7c76d",
195
+ "basicId": "@abcdefghijklmn",
196
+ "displayName": "Example",
197
+ "pictureUrl": "https://example.com/hogehoge",
198
+ "chatMode": "chat",
199
+ "markAsReadMode": "manual"
200
+ }
201
+ EOS
202
+
192
203
WebMock . allow_net_connect!
193
204
194
205
describe Line ::Bot ::Client do
@@ -453,4 +464,22 @@ def generate_client
453
464
]
454
465
)
455
466
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://example.com/hogehoge' ,
481
+ chatMode : 'chat' ,
482
+ markAsReadMode : 'manual'
483
+ )
484
+ end
456
485
end
You can’t perform that action at this time.
0 commit comments