@@ -169,7 +169,7 @@ def fully_qualified_api_endpoint
169
169
it "Successfuly handles an event and returns OK" do
170
170
response_json = { :status => 0 , :error_message => "OK" }
171
171
172
- stub_request ( :post , "https://api.siftscience.com/v204 /events" ) .
172
+ stub_request ( :post , "https://api.siftscience.com/v205 /events" ) .
173
173
with { |request |
174
174
parsed_body = JSON . parse ( request . body )
175
175
expect ( parsed_body ) . to include ( "$buyer_user_id" => "123456" )
@@ -190,7 +190,7 @@ def fully_qualified_api_endpoint
190
190
191
191
it "Successfully submits event with overridden key" do
192
192
response_json = { :status => 0 , :error_message => "OK" }
193
- stub_request ( :post , "https://api.siftscience.com/v204 /events" ) .
193
+ stub_request ( :post , "https://api.siftscience.com/v205 /events" ) .
194
194
with { | request |
195
195
parsed_body = JSON . parse ( request . body )
196
196
expect ( parsed_body ) . to include ( "$buyer_user_id" => "123456" )
@@ -212,7 +212,7 @@ def fully_qualified_api_endpoint
212
212
it "Successfully scrubs nils" do
213
213
response_json = { :status => 0 , :error_message => "OK" }
214
214
215
- stub_request ( :post , "https://api.siftscience.com/v204 /events" )
215
+ stub_request ( :post , "https://api.siftscience.com/v205 /events" )
216
216
. with { |request |
217
217
parsed_body = JSON . parse ( request . body )
218
218
expect ( parsed_body ) . not_to include ( "fake_property" )
@@ -241,7 +241,7 @@ def fully_qualified_api_endpoint
241
241
api_key = "foobar"
242
242
response_json = score_response_json
243
243
244
- stub_request ( :get , "https://api.siftscience.com/v204 /score/247019/?api_key=foobar" )
244
+ stub_request ( :get , "https://api.siftscience.com/v205 /score/247019/?api_key=foobar" )
245
245
. to_return ( :status => 200 , :body => MultiJson . dump ( response_json ) ,
246
246
:headers => { "content-type" => "application/json; charset=UTF-8" ,
247
247
"content-length" => "74" } )
@@ -259,7 +259,7 @@ def fully_qualified_api_endpoint
259
259
api_key = "foobar"
260
260
response_json = score_response_json
261
261
262
- stub_request ( :get , "https://api.siftscience.com/v204 /score/247019/?api_key=overridden" )
262
+ stub_request ( :get , "https://api.siftscience.com/v205 /score/247019/?api_key=overridden" )
263
263
. to_return ( :status => 200 , :body => MultiJson . dump ( response_json ) , :headers => { } )
264
264
265
265
response = Sift ::Client . new ( :api_key => api_key )
@@ -280,7 +280,7 @@ def fully_qualified_api_endpoint
280
280
:score_response => score_response_json
281
281
}
282
282
283
- stub_request ( :post , "https://api.siftscience.com/v204 /events?return_score=true" )
283
+ stub_request ( :post , "https://api.siftscience.com/v205 /events?return_score=true" )
284
284
. to_return ( :status => 200 , :body => MultiJson . dump ( response_json ) ,
285
285
:headers => { "content-type" => "application/json; charset=UTF-8" ,
286
286
"content-length" => "74" } )
@@ -304,7 +304,7 @@ def fully_qualified_api_endpoint
304
304
:score_response => action_response_json
305
305
}
306
306
307
- stub_request ( :post , "https://api.siftscience.com/v204 /events?return_action=true" )
307
+ stub_request ( :post , "https://api.siftscience.com/v205 /events?return_action=true" )
308
308
. to_return ( :status => 200 , :body => MultiJson . dump ( response_json ) ,
309
309
:headers => { "content-type" => "application/json; charset=UTF-8" ,
310
310
"content-length" => "74" } )
@@ -332,7 +332,7 @@ def fully_qualified_api_endpoint
332
332
}
333
333
334
334
stub_request ( :post ,
335
- "https://api.siftscience.com/v204 /events?return_workflow_status=true&abuse_types=legacy,payment_abuse" )
335
+ "https://api.siftscience.com/v205 /events?return_workflow_status=true&abuse_types=legacy,payment_abuse" )
336
336
. to_return ( :status => 200 , :body => MultiJson . dump ( response_json ) ,
337
337
:headers => { "content-type" => "application/json; charset=UTF-8" ,
338
338
"content-length" => "74" } )
@@ -390,4 +390,18 @@ def fully_qualified_api_endpoint
390
390
expect ( response . body [ "decisions" ] [ "payment_abuse" ] [ "decision" ] [ "id" ] ) . to eq ( "decision7" )
391
391
end
392
392
393
+
394
+ it "Successfully make an content decisions request" do
395
+ response_text = '{"decisions":{"content_abuse":{"decision":{"id":"decision7"},"time":1468599638005,"webhook_succeeded":false}}}'
396
+
397
+ stub_request ( :get , "https://foobar:@api3.siftscience.com/v3/accounts/ACCT/users/USER/content/example_content/decisions" )
398
+ . to_return ( :status => 200 , :body => response_text , :headers => { } )
399
+
400
+ client = Sift ::Client . new ( :api_key => "foobar" , :account_id => "ACCT" )
401
+ response = client . get_content_decisions ( "USER" , "example_content" , :timeout => 3 )
402
+
403
+ expect ( response . ok? ) . to eq ( true )
404
+ expect ( response . body [ "decisions" ] [ "content_abuse" ] [ "decision" ] [ "id" ] ) . to eq ( "decision7" )
405
+ end
406
+
393
407
end
0 commit comments