File tree Expand file tree Collapse file tree 2 files changed +41
-0
lines changed Expand file tree Collapse file tree 2 files changed +41
-0
lines changed Original file line number Diff line number Diff line change @@ -1162,6 +1162,18 @@ def get_aggregation_list(limit: nil, start: nil)
1162
1162
get ( endpoint , endpoint_path , credentials )
1163
1163
end
1164
1164
1165
+ # Gets the status of a narrowcast message.
1166
+ #
1167
+ # @param request_id [String] The narrowcast message's request ID. Each Messaging API request has a request ID. Find it in the response headers.
1168
+ #
1169
+ # @return [Net::HTTPResponse]
1170
+ def get_narrowcast_message_status ( request_id )
1171
+ channel_token_required
1172
+
1173
+ endpoint_path = "/bot/message/progress/narrowcast?requestId=#{ request_id } "
1174
+ get ( endpoint , endpoint_path , credentials )
1175
+ end
1176
+
1165
1177
# Fetch data, get content of specified URL.
1166
1178
#
1167
1179
# @param endpoint_base [String]
Original file line number Diff line number Diff line change 200
200
}
201
201
EOS
202
202
203
+ NARROWCAST_MESSAGE_STATUS_CONTENT = <<"EOS"
204
+ {
205
+ "phase": "succeeded",
206
+ "successCount": 65535,
207
+ "failureCount": 128,
208
+ "targetCount": 65663,
209
+ "acceptedTime": "2020-12-03T10:15:30.121Z",
210
+ "completedTime": "2020-12-03T10:15:30.121Z"
211
+ }
212
+ EOS
213
+
203
214
describe Line ::Bot ::Client do
204
215
def dummy_config
205
216
{
@@ -477,4 +488,22 @@ def generate_client
477
488
markAsReadMode : 'manual'
478
489
)
479
490
end
491
+
492
+ it 'get narrowcast message status' do
493
+ uri_template = Addressable ::Template . new Line ::Bot ::API ::DEFAULT_ENDPOINT + '/bot/message/progress/narrowcast?requestId=request_id'
494
+ stub_request ( :get , uri_template ) . to_return ( body : NARROWCAST_MESSAGE_STATUS_CONTENT , status : 200 )
495
+
496
+ client = generate_client
497
+ response = client . get_narrowcast_message_status ( 'request_id' )
498
+
499
+ json = JSON . parse ( response . body , symbolize_names : true )
500
+ expect ( json ) . to eq (
501
+ phase : "succeeded" ,
502
+ successCount : 65535 ,
503
+ failureCount : 128 ,
504
+ targetCount : 65663 ,
505
+ acceptedTime : "2020-12-03T10:15:30.121Z" ,
506
+ completedTime : "2020-12-03T10:15:30.121Z"
507
+ )
508
+ end
480
509
end
You can’t perform that action at this time.
0 commit comments