Sha256: 424b7eb1586c98add042659b7305c8b3db58c470660a9a2bdee1a43a73af0210

Contents?: true

Size: 1.11 KB

Versions: 2

Compression:

Stored size: 1.11 KB

Contents

require 'sinatra/base'

class FakeOnfidoAPI < Sinatra::Base
  get '/v1/addresses/pick' do
    json_response(200, 'addresses.json')
  end

  post '/v1/applicants' do
    json_response(201, 'applicant.json')
  end

  get '/v1/applicants/:id' do
    json_response(200, 'applicant.json')
  end

  get '/v1/applicants' do
    json_response(200, 'applicants.json')
  end

  post '/v1/applicants/:id/documents' do
    json_response(201, 'document.json')
  end

  post '/v1/applicants/:id/checks' do
    json_response(201, 'check.json')
  end

  get '/v1/applicants/:id/checks/:id' do
    json_response(200, 'check.json')
  end

  get '/v1/applicants/:id/checks' do
    json_response(200, 'checks.json')
  end

  get '/v1/checks/:id/reports' do
    json_response(200, 'reports.json')
  end

  get '/v1/checks/:id/reports/:id' do
    json_response(200, 'report.json')
  end

  get '/v1/4xx_response' do
    json_response(422, '4xx_response.json')
  end

  private

  def json_response(response_code, file_name)
    content_type :json
    status response_code
    File.open(File.dirname(__FILE__) + '/fixtures/' + file_name, 'rb').read
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
onfido-0.0.2 spec/support/fake_onfido_api.rb
onfido-0.0.1 spec/support/fake_onfido_api.rb