@@ -323,6 +323,28 @@ def fully_qualified_api_endpoint
323
323
end
324
324
325
325
326
+ it "Successfully executes client.get_user_score() with abuse types specified" do
327
+ api_key = "foobar"
328
+ response_json = user_score_response_json
329
+
330
+ stub_request ( :get , "https://api.siftscience.com/v205/users/247019/score" +
331
+ "?api_key=foobar&abuse_types=content_abuse,payment_abuse" )
332
+ . to_return ( :status => 200 , :body => MultiJson . dump ( response_json ) ,
333
+ :headers => { "content-type" => "application/json; charset=UTF-8" ,
334
+ "content-length" => "74" } )
335
+
336
+ response = Sift ::Client . new ( :api_key => api_key ) . get_user_score ( user_score_response_json [ :entity_id ] ,
337
+ :abuse_types => [ "content_abuse" ,
338
+ "payment_abuse" ] )
339
+ expect ( response . ok? ) . to eq ( true )
340
+ expect ( response . api_status ) . to eq ( 0 )
341
+ expect ( response . api_error_message ) . to eq ( "OK" )
342
+
343
+ expect ( response . body [ "entity_id" ] ) . to eq ( "247019" )
344
+ expect ( response . body [ "scores" ] [ "payment_abuse" ] [ "score" ] ) . to eq ( 0.78 )
345
+ end
346
+
347
+
326
348
it "Successfully executes client.rescore_user()" do
327
349
api_key = "foobar"
328
350
response_json = user_score_response_json
@@ -342,6 +364,28 @@ def fully_qualified_api_endpoint
342
364
end
343
365
344
366
367
+ it "Successfully executes client.rescore_user() with abuse types specified" do
368
+ api_key = "foobar"
369
+ response_json = user_score_response_json
370
+
371
+ stub_request ( :post , "https://api.siftscience.com/v205/users/247019/score" +
372
+ "?api_key=foobar&abuse_types=content_abuse,payment_abuse" )
373
+ . to_return ( :status => 200 , :body => MultiJson . dump ( response_json ) ,
374
+ :headers => { "content-type" => "application/json; charset=UTF-8" ,
375
+ "content-length" => "74" } )
376
+
377
+ response = Sift ::Client . new ( :api_key => api_key ) . rescore_user ( user_score_response_json [ :entity_id ] ,
378
+ :abuse_types => [ "content_abuse" ,
379
+ "payment_abuse" ] )
380
+ expect ( response . ok? ) . to eq ( true )
381
+ expect ( response . api_status ) . to eq ( 0 )
382
+ expect ( response . api_error_message ) . to eq ( "OK" )
383
+
384
+ expect ( response . body [ "entity_id" ] ) . to eq ( "247019" )
385
+ expect ( response . body [ "scores" ] [ "payment_abuse" ] [ "score" ] ) . to eq ( 0.78 )
386
+ end
387
+
388
+
345
389
it "Successfully make a sync score request" do
346
390
api_key = "foobar"
347
391
response_json = {
0 commit comments