spec/support/fake_onfido_api.rb in onfido-0.7.1 vs spec/support/fake_onfido_api.rb in onfido-0.8.1

- old
+ new

@@ -7,23 +7,45 @@ post '/v2/applicants' do json_response(201, 'applicant.json') end + put '/v2/applicants/:id' do + json_response(200, 'applicant.json') + end + get '/v2/applicants/:id' do json_response(200, 'applicant.json') end get '/v2/applicants' do response = json_response(200, 'applicants.json') { applicants: JSON.parse(response)['applicants'][pagination_range] }.to_json end + delete '/v2/applicants/:id' do + status 204 + end + post '/v2/applicants/:id/documents' do json_response(201, 'document.json') end + get '/v2/applicants/:id/documents/:id' do + json_response(200, 'document.json') + end + + get '/v2/applicants/:id/documents' do + json_response(200, 'documents.json') + end + + get '/v2/applicants/:id/documents/:id/download' do + status 200 + content_type 'application/octet-stream' + "\x01\x02\x03" # acts as binary file data + end + post '/v2/live_photos' do json_response(201, 'live_photo.json') end post '/v2/applicants/:id/checks' do @@ -46,18 +68,38 @@ end { checks: JSON.parse(response)['checks'][pagination_range] }.to_json end + post '/v2/checks/:id/resume' do + status 204 # no_content + end + get '/v2/checks/:id/reports' do json_response(200, 'reports.json') end get '/v2/checks/:id/reports/:id' do json_response(200, 'report.json') end + post '/v2/checks/:id/reports/:id/resume' do + status 204 + end + + post '/v2/checks/:id/reports/:id/cancel' do + status 204 + end + + get '/v2/report_type_groups/:id' do + json_response(200, 'report_type_group.json') + end + + get '/v2/report_type_groups' do + json_response(200, 'report_type_groups.json') + end + post '/v2/webhooks' do json_response(201, 'webhook.json') end get '/v2/webhooks/:id' do @@ -83,10 +125,10 @@ end private def json_response(response_code, file_name) - content_type :json + content_type "application/json; charset=utf-8" status response_code File.open(File.dirname(__FILE__) + '/fixtures/' + file_name, 'rb').read end def pagination_range