onfido 2.0.0 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/gem-push.yml +31 -0
- data/.github/workflows/ruby.yml +25 -0
- data/CHANGELOG.md +18 -0
- data/README.md +4 -4
- data/lib/onfido/options.rb +1 -1
- data/lib/onfido/resource.rb +12 -5
- data/lib/onfido/resources/document.rb +1 -1
- data/lib/onfido/resources/live_photo.rb +1 -1
- data/lib/onfido/version.rb +1 -1
- data/lib/onfido.rb +0 -1
- data/spec/integrations/applicant_spec.rb +1 -1
- data/spec/integrations/resource_spec.rb +13 -0
- data/spec/onfido/options_spec.rb +1 -1
- data/spec/support/fake_onfido_api.rb +46 -37
- data/spec/support/fixtures/applicant.json +1 -1
- data/spec/support/fixtures/check.json +1 -1
- data/spec/support/fixtures/checks.json +1 -1
- data/spec/support/fixtures/document.json +1 -1
- data/spec/support/fixtures/documents.json +2 -2
- data/spec/support/fixtures/live_photo.json +2 -2
- data/spec/support/fixtures/live_photos.json +4 -4
- data/spec/support/fixtures/live_video.json +2 -2
- data/spec/support/fixtures/live_videos.json +2 -2
- data/spec/support/fixtures/report.json +1 -1
- data/spec/support/fixtures/reports.json +2 -2
- data/spec/support/fixtures/webhook.json +1 -1
- data/spec/support/fixtures/webhooks.json +2 -2
- metadata +8 -7
- data/.travis.yml +0 -13
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 601240f564ef7c2e14fa481011fd428d3ee46234e877387f5dee8e369181bde7
         | 
| 4 | 
            +
              data.tar.gz: 4d6808f5c9ed80267b73f54907619cc548924d8e62cc36909b8eb6acb1e71226
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 458f2220666b891e81034ac34cd49781d950454dbe2ed1e528c5f6a000fa327903cb6b3d49959f0e0c788dfd272770d20a995396b6457c697c04b3f49667f762
         | 
| 7 | 
            +
              data.tar.gz: 16c4524637abf578ce72cc66a4e94903d945599d5ccfb8bf2aa057a59763c5ad0f2550dc708cdba85092a3b25117dd3107fb7257148f2665590733f9f161d9cc
         | 
| @@ -0,0 +1,31 @@ | |
| 1 | 
            +
            name: Ruby Gem
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            on:
         | 
| 4 | 
            +
              release:
         | 
| 5 | 
            +
                types: [published]
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            jobs:
         | 
| 8 | 
            +
              build:
         | 
| 9 | 
            +
                name: Build + Publish
         | 
| 10 | 
            +
                runs-on: ubuntu-latest
         | 
| 11 | 
            +
                permissions:
         | 
| 12 | 
            +
                  contents: read
         | 
| 13 | 
            +
                  packages: write
         | 
| 14 | 
            +
             | 
| 15 | 
            +
                steps:
         | 
| 16 | 
            +
                - uses: actions/checkout@v2
         | 
| 17 | 
            +
                - name: Set up Ruby 2.6
         | 
| 18 | 
            +
                  uses: actions/setup-ruby@v1
         | 
| 19 | 
            +
                  with:
         | 
| 20 | 
            +
                    ruby-version: 2.6.x
         | 
| 21 | 
            +
             | 
| 22 | 
            +
                - name: Publish to RubyGems
         | 
| 23 | 
            +
                  run: |
         | 
| 24 | 
            +
                    mkdir -p $HOME/.gem
         | 
| 25 | 
            +
                    touch $HOME/.gem/credentials
         | 
| 26 | 
            +
                    chmod 0600 $HOME/.gem/credentials
         | 
| 27 | 
            +
                    printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
         | 
| 28 | 
            +
                    gem build *.gemspec
         | 
| 29 | 
            +
                    gem push *.gem
         | 
| 30 | 
            +
                  env:
         | 
| 31 | 
            +
                    GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
         | 
| @@ -0,0 +1,25 @@ | |
| 1 | 
            +
            name: Ruby
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            on:
         | 
| 4 | 
            +
              push:
         | 
| 5 | 
            +
                branches: [ master ]
         | 
| 6 | 
            +
              pull_request:
         | 
| 7 | 
            +
                branches: [ master ]
         | 
| 8 | 
            +
             | 
| 9 | 
            +
            jobs:
         | 
| 10 | 
            +
              test:
         | 
| 11 | 
            +
             | 
| 12 | 
            +
                runs-on: ubuntu-latest
         | 
| 13 | 
            +
                strategy:
         | 
| 14 | 
            +
                  matrix:
         | 
| 15 | 
            +
                    ruby-version: ['2.4', '2.5', '2.6', '2.7', '3.0']
         | 
| 16 | 
            +
             | 
| 17 | 
            +
                steps:
         | 
| 18 | 
            +
                - uses: actions/checkout@v2
         | 
| 19 | 
            +
                - name: Set up Ruby
         | 
| 20 | 
            +
                  uses: ruby/setup-ruby@v1
         | 
| 21 | 
            +
                  with:
         | 
| 22 | 
            +
                    ruby-version: ${{ matrix.ruby-version }}
         | 
| 23 | 
            +
                    bundler-cache: true
         | 
| 24 | 
            +
                - name: Run tests
         | 
| 25 | 
            +
                  run: bundle exec rspec spec
         | 
    
        data/CHANGELOG.md
    CHANGED
    
    | @@ -1,3 +1,21 @@ | |
| 1 | 
            +
            ## v2.1.1, 01 February 2022
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            - Send params as json
         | 
| 4 | 
            +
            - Remove .travis.yml
         | 
| 5 | 
            +
            - Update README.md link
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            ## v2.1.0, 23 June 2021
         | 
| 8 | 
            +
             | 
| 9 | 
            +
            - Support Onfido API version 3.2
         | 
| 10 | 
            +
             | 
| 11 | 
            +
            ## v2.0.2, 10 June 2021
         | 
| 12 | 
            +
             | 
| 13 | 
            +
            - Add error coverage for errors RestClient:BadGateway
         | 
| 14 | 
            +
             | 
| 15 | 
            +
            ## v2.0.1, 27 May 2021
         | 
| 16 | 
            +
             | 
| 17 | 
            +
            - Remove onfido/null_logger
         | 
| 18 | 
            +
             | 
| 1 19 | 
             
            ## v2.0.0, 5 May 2021
         | 
| 2 20 |  | 
| 3 21 | 
             
            - Remove global configuration, all configuration is now per `Onfido::API` instance
         | 
    
        data/README.md
    CHANGED
    
    | @@ -7,14 +7,14 @@ The official Ruby library for integrating with the Onfido API. | |
| 7 7 |  | 
| 8 8 | 
             
            Documentation can be found at https://documentation.onfido.com
         | 
| 9 9 |  | 
| 10 | 
            -
            This version uses Onfido API v3. | 
| 10 | 
            +
            This version uses Onfido API v3.2 and is compatible with Ruby 2.4 onwards. Refer to our [API versioning guide](https://developers.onfido.com/guide/api-versioning-policy#client-libraries) for details of which client library versions use which versions of the API.
         | 
| 11 11 |  | 
| 12 12 | 
             
            ## Installation
         | 
| 13 13 |  | 
| 14 14 | 
             
            Add this line to your application's Gemfile:
         | 
| 15 15 |  | 
| 16 16 | 
             
            ```ruby
         | 
| 17 | 
            -
            gem 'onfido', '~> 2.0. | 
| 17 | 
            +
            gem 'onfido', '~> 2.0.1'
         | 
| 18 18 | 
             
            ```
         | 
| 19 19 |  | 
| 20 20 | 
             
            ## Getting started
         | 
| @@ -76,7 +76,7 @@ onfido = Onfido::API.new( | |
| 76 76 |  | 
| 77 77 | 
             
            ## Verifying webhooks
         | 
| 78 78 |  | 
| 79 | 
            -
            Each webhook endpoint has a secret token, generated automatically and [exposed](https://onfido.com | 
| 79 | 
            +
            Each webhook endpoint has a secret token, generated automatically and [exposed](https://documentation.onfido.com/#register-webhook) in the API. When sending a request, Onfido includes a signature computed using the request body and this token in the `X-SHA2-Signature` header.
         | 
| 80 80 |  | 
| 81 81 | 
             
            You should compare this provided signature to one you generate yourself with the token to verify that a webhook is a genuine request from Onfido.
         | 
| 82 82 |  | 
| @@ -90,7 +90,7 @@ else | |
| 90 90 | 
             
            end
         | 
| 91 91 | 
             
            ```
         | 
| 92 92 |  | 
| 93 | 
            -
            Read more at https://onfido.com/ | 
| 93 | 
            +
            Read more at https://developers.onfido.com/guide/manual-webhook-signature-verification#webhook-security
         | 
| 94 94 |  | 
| 95 95 | 
             
            ## Contributing
         | 
| 96 96 |  | 
    
        data/lib/onfido/options.rb
    CHANGED
    
    
    
        data/lib/onfido/resource.rb
    CHANGED
    
    | @@ -4,6 +4,7 @@ module Onfido | |
| 4 4 | 
             
              class Resource # rubocop:todo Metrics/ClassLength
         | 
| 5 5 | 
             
                VALID_HTTP_METHODS = %i[get post put delete].freeze
         | 
| 6 6 | 
             
                REQUEST_TIMEOUT_HTTP_CODE = 408
         | 
| 7 | 
            +
                ADDITIONAL_HEADERS = { 'Content-Type' => 'application/json; charset=utf-8' }.freeze
         | 
| 7 8 |  | 
| 8 9 | 
             
                def initialize(options)
         | 
| 9 10 | 
             
                  @rest_client = options.rest_client
         | 
| @@ -14,19 +15,22 @@ module Onfido | |
| 14 15 | 
             
                attr_reader :rest_client
         | 
| 15 16 |  | 
| 16 17 | 
             
                def get(path:)
         | 
| 17 | 
            -
                  handle_request { rest_client[path].get }
         | 
| 18 | 
            +
                  handle_request { rest_client[path].get(ADDITIONAL_HEADERS) }
         | 
| 18 19 | 
             
                end
         | 
| 19 20 |  | 
| 20 | 
            -
                def post(path:, payload: nil)
         | 
| 21 | 
            -
                   | 
| 21 | 
            +
                def post(path:, payload: nil, send_json: true)
         | 
| 22 | 
            +
                  parsed_payload = send_json ? payload.to_json : payload
         | 
| 23 | 
            +
                  additional_headers = send_json ? ADDITIONAL_HEADERS : {}
         | 
| 24 | 
            +
             | 
| 25 | 
            +
                  handle_request { rest_client[path].post(parsed_payload, additional_headers) }
         | 
| 22 26 | 
             
                end
         | 
| 23 27 |  | 
| 24 28 | 
             
                def put(path:, payload: nil)
         | 
| 25 | 
            -
                  handle_request { rest_client[path].put(payload) }
         | 
| 29 | 
            +
                  handle_request { rest_client[path].put(payload.to_json, ADDITIONAL_HEADERS) }
         | 
| 26 30 | 
             
                end
         | 
| 27 31 |  | 
| 28 32 | 
             
                def delete(path:)
         | 
| 29 | 
            -
                  handle_request { rest_client[path].delete }
         | 
| 33 | 
            +
                  handle_request { rest_client[path].delete(ADDITIONAL_HEADERS) }
         | 
| 30 34 | 
             
                end
         | 
| 31 35 |  | 
| 32 36 | 
             
                def handle_request
         | 
| @@ -113,6 +117,9 @@ module Onfido | |
| 113 117 | 
             
                      "Could not verify Onfido's SSL certificate. Please make sure " \
         | 
| 114 118 | 
             
                      'that your network is not intercepting certificates. '
         | 
| 115 119 |  | 
| 120 | 
            +
                    when RestClient::BadGateway
         | 
| 121 | 
            +
                      "Could not connect to Onfido. Server may be overloaded." \
         | 
| 122 | 
            +
             | 
| 116 123 | 
             
                    when SocketError
         | 
| 117 124 | 
             
                      'Unexpected error when trying to connect to Onfido. ' \
         | 
| 118 125 | 
             
                      'You may be seeing this message because your DNS is not working. ' \
         | 
    
        data/lib/onfido/version.rb
    CHANGED
    
    
    
        data/lib/onfido.rb
    CHANGED
    
    | @@ -10,7 +10,6 @@ require 'onfido/errors/onfido_error' | |
| 10 10 | 
             
            require 'onfido/errors/request_error'
         | 
| 11 11 | 
             
            require 'onfido/errors/server_error'
         | 
| 12 12 | 
             
            require 'onfido/errors/connection_error'
         | 
| 13 | 
            -
            require 'onfido/null_logger'
         | 
| 14 13 | 
             
            require 'onfido/api'
         | 
| 15 14 | 
             
            require 'onfido/options'
         | 
| 16 15 | 
             
            require 'onfido/resource'
         | 
| @@ -34,7 +34,7 @@ describe Onfido::Applicant do | |
| 34 34 |  | 
| 35 35 | 
             
                it 'serializes the payload correctly' do
         | 
| 36 36 | 
             
                  WebMock.after_request do |request_signature, _response|
         | 
| 37 | 
            -
                    if request_signature.uri.path == 'v3. | 
| 37 | 
            +
                    if request_signature.uri.path == 'v3.2/applicants'
         | 
| 38 38 | 
             
                      expect(Rack::Utils.parse_nested_query(request_signature.body))
         | 
| 39 39 | 
             
                        .to eq(params)
         | 
| 40 40 | 
             
                    end
         | 
| @@ -51,6 +51,19 @@ describe Onfido::Resource do | |
| 51 51 | 
             
                end
         | 
| 52 52 | 
             
              end
         | 
| 53 53 |  | 
| 54 | 
            +
              context 'RestClient : BadGateway' do
         | 
| 55 | 
            +
                before do
         | 
| 56 | 
            +
                  allow(RestClient::Request)
         | 
| 57 | 
            +
                    .to receive(:execute)
         | 
| 58 | 
            +
                    .and_raise(RestClient::BadGateway)
         | 
| 59 | 
            +
                end
         | 
| 60 | 
            +
             | 
| 61 | 
            +
                it 'raises a ConnectionError' do
         | 
| 62 | 
            +
                  expect { resource.get(path: '') }
         | 
| 63 | 
            +
                    .to raise_error(Onfido::ConnectionError, /Could not connect/)
         | 
| 64 | 
            +
                end
         | 
| 65 | 
            +
              end
         | 
| 66 | 
            +
             | 
| 54 67 | 
             
              context 'broken connection' do
         | 
| 55 68 | 
             
                before do
         | 
| 56 69 | 
             
                  allow(RestClient::Request)
         | 
    
        data/spec/onfido/options_spec.rb
    CHANGED
    
    
| @@ -9,32 +9,42 @@ RSpec.shared_context 'fake onfido api' do | |
| 9 9 | 
             
            end
         | 
| 10 10 |  | 
| 11 11 | 
             
            class FakeOnfidoAPI < Sinatra::Base # rubocop:disable Metrics/ClassLength
         | 
| 12 | 
            -
               | 
| 12 | 
            +
              before do
         | 
| 13 | 
            +
                begin
         | 
| 14 | 
            +
                  if request.content_type == "application/json; charset=utf-8"
         | 
| 15 | 
            +
                    body_parameters = JSON.parse(request.body.read)
         | 
| 16 | 
            +
                    params.merge!(body_parameters) if body_parameters
         | 
| 17 | 
            +
                  end
         | 
| 18 | 
            +
                rescue JSON::ParserError
         | 
| 19 | 
            +
                end
         | 
| 20 | 
            +
              end
         | 
| 21 | 
            +
             | 
| 22 | 
            +
              get '/v3.2/addresses/pick' do
         | 
| 13 23 | 
             
                json_response(200, 'addresses.json')
         | 
| 14 24 | 
             
              end
         | 
| 15 25 |  | 
| 16 | 
            -
              post '/v3. | 
| 26 | 
            +
              post '/v3.2/applicants' do
         | 
| 17 27 | 
             
                json_response(201, 'applicant.json')
         | 
| 18 28 | 
             
              end
         | 
| 19 29 |  | 
| 20 | 
            -
              put '/v3. | 
| 30 | 
            +
              put '/v3.2/applicants/:id' do
         | 
| 21 31 | 
             
                json_response(200, 'applicant.json')
         | 
| 22 32 | 
             
              end
         | 
| 23 33 |  | 
| 24 | 
            -
              get '/v3. | 
| 34 | 
            +
              get '/v3.2/applicants/:id' do
         | 
| 25 35 | 
             
                json_response(200, 'applicant.json')
         | 
| 26 36 | 
             
              end
         | 
| 27 37 |  | 
| 28 | 
            -
              get '/v3. | 
| 38 | 
            +
              get '/v3.2/applicants' do
         | 
| 29 39 | 
             
                response = json_response(200, 'applicants.json')
         | 
| 30 40 | 
             
                { applicants: JSON.parse(response)['applicants'][pagination_range] }.to_json
         | 
| 31 41 | 
             
              end
         | 
| 32 42 |  | 
| 33 | 
            -
              delete '/v3. | 
| 43 | 
            +
              delete '/v3.2/applicants/:id' do
         | 
| 34 44 | 
             
                status 204
         | 
| 35 45 | 
             
              end
         | 
| 36 46 |  | 
| 37 | 
            -
              post '/v3. | 
| 47 | 
            +
              post '/v3.2/applicants/:id/restore' do
         | 
| 38 48 | 
             
                if params['id'] == 'a2fb9c62-ab10-4898-a8ec-342c4b552ad5'
         | 
| 39 49 | 
             
                  json_response(422, 'not_scheduled_for_deletion_error.json')
         | 
| 40 50 | 
             
                else
         | 
| @@ -42,37 +52,37 @@ class FakeOnfidoAPI < Sinatra::Base # rubocop:disable Metrics/ClassLength | |
| 42 52 | 
             
                end
         | 
| 43 53 | 
             
              end
         | 
| 44 54 |  | 
| 45 | 
            -
              post '/v3. | 
| 55 | 
            +
              post '/v3.2/documents' do
         | 
| 46 56 | 
             
                json_response(201, 'document.json')
         | 
| 47 57 | 
             
              end
         | 
| 48 58 |  | 
| 49 | 
            -
              post '/v3. | 
| 59 | 
            +
              post '/v3.2/extractions' do
         | 
| 50 60 | 
             
                json_response(201, 'extraction.json')
         | 
| 51 61 | 
             
              end
         | 
| 52 62 |  | 
| 53 | 
            -
              get '/v3. | 
| 63 | 
            +
              get '/v3.2/documents/:id' do
         | 
| 54 64 | 
             
                json_response(200, 'document.json')
         | 
| 55 65 | 
             
              end
         | 
| 56 66 |  | 
| 57 | 
            -
              get '/v3. | 
| 67 | 
            +
              get '/v3.2/documents' do
         | 
| 58 68 | 
             
                json_response(200, 'documents.json')
         | 
| 59 69 | 
             
              end
         | 
| 60 70 |  | 
| 61 | 
            -
              get '/v3. | 
| 71 | 
            +
              get '/v3.2/documents/:id/download' do
         | 
| 62 72 | 
             
                status 200
         | 
| 63 73 | 
             
                content_type 'application/octet-stream'
         | 
| 64 74 | 
             
                "\x01\x02\x03" # acts as binary file data
         | 
| 65 75 | 
             
              end
         | 
| 66 76 |  | 
| 67 | 
            -
              post '/v3. | 
| 77 | 
            +
              post '/v3.2/live_photos' do
         | 
| 68 78 | 
             
                json_response(201, 'live_photo.json')
         | 
| 69 79 | 
             
              end
         | 
| 70 80 |  | 
| 71 | 
            -
              get '/v3. | 
| 81 | 
            +
              get '/v3.2/live_photos/:id' do
         | 
| 72 82 | 
             
                json_response(200, 'live_photo.json')
         | 
| 73 83 | 
             
              end
         | 
| 74 84 |  | 
| 75 | 
            -
              get '/v3. | 
| 85 | 
            +
              get '/v3.2/live_photos' do
         | 
| 76 86 | 
             
                if params['applicant_id'] == '1030303-123123-123123'
         | 
| 77 87 | 
             
                  json_response(200, 'live_photos.json')
         | 
| 78 88 | 
             
                else
         | 
| @@ -80,17 +90,17 @@ class FakeOnfidoAPI < Sinatra::Base # rubocop:disable Metrics/ClassLength | |
| 80 90 | 
             
                end
         | 
| 81 91 | 
             
              end
         | 
| 82 92 |  | 
| 83 | 
            -
              get '/v3. | 
| 93 | 
            +
              get '/v3.2/live_photos/:id/download' do
         | 
| 84 94 | 
             
                status 200
         | 
| 85 95 | 
             
                content_type 'image/jpeg'
         | 
| 86 96 | 
             
                "\x01\x02\x03" # acts as binary file data
         | 
| 87 97 | 
             
              end
         | 
| 88 98 |  | 
| 89 | 
            -
              get '/v3. | 
| 99 | 
            +
              get '/v3.2/live_videos/:id' do
         | 
| 90 100 | 
             
                json_response(200, 'live_video.json')
         | 
| 91 101 | 
             
              end
         | 
| 92 102 |  | 
| 93 | 
            -
              get '/v3. | 
| 103 | 
            +
              get '/v3.2/live_videos' do
         | 
| 94 104 | 
             
                if params['applicant_id'] == '1030303-123123-123123'
         | 
| 95 105 | 
             
                  json_response(200, 'live_videos.json')
         | 
| 96 106 | 
             
                else
         | 
| @@ -98,80 +108,79 @@ class FakeOnfidoAPI < Sinatra::Base # rubocop:disable Metrics/ClassLength | |
| 98 108 | 
             
                end
         | 
| 99 109 | 
             
              end
         | 
| 100 110 |  | 
| 101 | 
            -
              get '/v3. | 
| 111 | 
            +
              get '/v3.2/live_videos/:id/download' do
         | 
| 102 112 | 
             
                status 200
         | 
| 103 113 | 
             
                content_type 'video/quicktime'
         | 
| 104 114 | 
             
                "\x01\x02\x03" # acts as binary file data
         | 
| 105 115 | 
             
              end
         | 
| 106 116 |  | 
| 107 | 
            -
              post '/v3. | 
| 117 | 
            +
              post '/v3.2/checks' do
         | 
| 108 118 | 
             
                params['applicant_id'].nil? ? status(422) : json_response(201, 'check.json')
         | 
| 109 119 | 
             
              end
         | 
| 110 120 |  | 
| 111 | 
            -
              get '/v3. | 
| 121 | 
            +
              get '/v3.2/checks/:id' do
         | 
| 112 122 | 
             
                json_response(200, 'check.json')
         | 
| 113 123 | 
             
              end
         | 
| 114 124 |  | 
| 115 | 
            -
              get '/v3. | 
| 125 | 
            +
              get '/v3.2/checks' do
         | 
| 116 126 | 
             
                json_response(200, 'checks.json')
         | 
| 117 127 | 
             
              end
         | 
| 118 128 |  | 
| 119 | 
            -
              post '/v3. | 
| 129 | 
            +
              post '/v3.2/checks/:id/resume' do
         | 
| 120 130 | 
             
                status 204 # no_content
         | 
| 121 131 | 
             
              end
         | 
| 122 132 |  | 
| 123 | 
            -
              get '/v3. | 
| 133 | 
            +
              get '/v3.2/checks/:id/download' do
         | 
| 124 134 | 
             
                status 200
         | 
| 125 135 | 
             
                content_type 'application/pdf'
         | 
| 126 136 | 
             
                "\x01\x02\x03" # acts as binary file data
         | 
| 127 137 | 
             
              end
         | 
| 128 138 |  | 
| 129 | 
            -
              get '/v3. | 
| 139 | 
            +
              get '/v3.2/reports' do
         | 
| 130 140 | 
             
                json_response(200, 'reports.json')
         | 
| 131 141 | 
             
              end
         | 
| 132 142 |  | 
| 133 | 
            -
              get '/v3. | 
| 143 | 
            +
              get '/v3.2/reports/:id' do
         | 
| 134 144 | 
             
                json_response(200, 'report.json')
         | 
| 135 145 | 
             
              end
         | 
| 136 146 |  | 
| 137 | 
            -
              post '/v3. | 
| 147 | 
            +
              post '/v3.2/reports/:id/resume' do
         | 
| 138 148 | 
             
                status 204
         | 
| 139 149 | 
             
              end
         | 
| 140 150 |  | 
| 141 | 
            -
              post '/v3. | 
| 151 | 
            +
              post '/v3.2/reports/:id/cancel' do
         | 
| 142 152 | 
             
                status 204
         | 
| 143 153 | 
             
              end
         | 
| 144 154 |  | 
| 145 | 
            -
              post '/v3. | 
| 155 | 
            +
              post '/v3.2/sdk_token' do
         | 
| 146 156 | 
             
                json_response(201, 'sdk_token.json')
         | 
| 147 157 | 
             
              end
         | 
| 148 158 |  | 
| 149 | 
            -
              post '/v3. | 
| 159 | 
            +
              post '/v3.2/webhooks' do
         | 
| 150 160 | 
             
                json_response(201, 'webhook.json')
         | 
| 151 161 | 
             
              end
         | 
| 152 162 |  | 
| 153 | 
            -
              get '/v3. | 
| 163 | 
            +
              get '/v3.2/webhooks/:id' do
         | 
| 154 164 | 
             
                json_response(200, 'webhook.json')
         | 
| 155 165 | 
             
              end
         | 
| 156 166 |  | 
| 157 | 
            -
              delete '/v3. | 
| 158 | 
            -
                content_type 'application/json; charset=utf-8'
         | 
| 167 | 
            +
              delete '/v3.2/webhooks/:id' do
         | 
| 159 168 | 
             
                status 204
         | 
| 160 169 | 
             
              end
         | 
| 161 170 |  | 
| 162 | 
            -
              get '/v3. | 
| 171 | 
            +
              get '/v3.2/webhooks' do
         | 
| 163 172 | 
             
                json_response(200, 'webhooks.json')
         | 
| 164 173 | 
             
              end
         | 
| 165 174 |  | 
| 166 | 
            -
              get '/v3. | 
| 175 | 
            +
              get '/v3.2/4xx_response' do
         | 
| 167 176 | 
             
                json_response(422, '4xx_response.json')
         | 
| 168 177 | 
             
              end
         | 
| 169 178 |  | 
| 170 | 
            -
              get '/v3. | 
| 179 | 
            +
              get '/v3.2/unexpected_error_format' do
         | 
| 171 180 | 
             
                json_response(400, 'unexpected_error_format.json')
         | 
| 172 181 | 
             
              end
         | 
| 173 182 |  | 
| 174 | 
            -
              get '/v3. | 
| 183 | 
            +
              get '/v3.2/unparseable_response' do
         | 
| 175 184 | 
             
                content_type :json
         | 
| 176 185 | 
             
                status 504
         | 
| 177 186 | 
             
                ''
         | 
| @@ -7,7 +7,7 @@ | |
| 7 7 | 
             
              "last_name":"Bing",
         | 
| 8 8 | 
             
              "email":"chandler_bing_6@friends.com",
         | 
| 9 9 | 
             
              "dob":"1968-04-08",
         | 
| 10 | 
            -
              "href":"/v3. | 
| 10 | 
            +
              "href":"/v3.2/applicants/61f659cb-c90b-4067-808a-6136b5c01351",
         | 
| 11 11 | 
             
              "id_numbers":[],
         | 
| 12 12 | 
             
              "address": {
         | 
| 13 13 | 
             
                "flat_number":"4",
         | 
| @@ -3,7 +3,7 @@ | |
| 3 3 | 
             
                {
         | 
| 4 4 | 
             
                  "id": "7568415-123123-123123",
         | 
| 5 5 | 
             
                  "created_at": "2019-11-23 13:50:33Z",
         | 
| 6 | 
            -
                  "href": "/v3. | 
| 6 | 
            +
                  "href": "/v3.2/documents/7568415-123123-123123",
         | 
| 7 7 | 
             
                  "file_name": "passport.jpg",
         | 
| 8 8 | 
             
                  "file_type": "png",
         | 
| 9 9 | 
             
                  "file_size": 282870,
         | 
| @@ -12,7 +12,7 @@ | |
| 12 12 | 
             
                {
         | 
| 13 13 | 
             
                  "id": "121122-123123-123123",
         | 
| 14 14 | 
             
                  "created_at": "2019-11-23 13:50:40Z",
         | 
| 15 | 
            -
                  "href": "/v3. | 
| 15 | 
            +
                  "href": "/v3.2/documents/7568415-123123-123123",
         | 
| 16 16 | 
             
                  "file_name": "driving_licence.png",
         | 
| 17 17 | 
             
                  "file_type": "png",
         | 
| 18 18 | 
             
                  "file_size": 282870,
         | 
| @@ -4,6 +4,6 @@ | |
| 4 4 | 
             
              "file_name": "onfido_captured_image.jpg",
         | 
| 5 5 | 
             
              "file_type": "image/jpeg",
         | 
| 6 6 | 
             
              "file_size": 47544,
         | 
| 7 | 
            -
              "href": "/v3. | 
| 8 | 
            -
              "download_href": "/v3. | 
| 7 | 
            +
              "href": "/v3.2/live_photos/3538c8f6-fdce-4745-9d34-fc246bc05aa1",
         | 
| 8 | 
            +
              "download_href": "/v3.2/live_photos/3538c8f6-fdce-4745-9d34-fc246bc05aa1/download"
         | 
| 9 9 | 
             
            }
         | 
| @@ -6,8 +6,8 @@ | |
| 6 6 | 
             
                  "file_name": "onfido_captured_image.jpg",
         | 
| 7 7 | 
             
                  "file_type": "image/jpeg",
         | 
| 8 8 | 
             
                  "file_size": 47544,
         | 
| 9 | 
            -
                  "href": "/v3. | 
| 10 | 
            -
                  "download_href": "/v3. | 
| 9 | 
            +
                  "href": "/v3.2/live_photos/3538c8f6-fdce-4745-9d34-fc246bc05aa1",
         | 
| 10 | 
            +
                  "download_href": "/v3.2/live_photos/3538c8f6-fdce-4745-9d34-fc246bc05aa1/download"
         | 
| 11 11 | 
             
                },
         | 
| 12 12 | 
             
                {
         | 
| 13 13 | 
             
                    "id": "5134c12a-555a-1234-5e12-9d34fcbc11ba",
         | 
| @@ -15,8 +15,8 @@ | |
| 15 15 | 
             
                    "file_name": "onfido_captured_image.jpg",
         | 
| 16 16 | 
             
                    "file_type": "image/jpeg",
         | 
| 17 17 | 
             
                    "file_size": 47544,
         | 
| 18 | 
            -
                    "href": "/v3. | 
| 19 | 
            -
                    "download_href": "/v3. | 
| 18 | 
            +
                    "href": "/v3.2/live_photos/5134c12a-555a-1234-5e12-9d34fcbc11ba",
         | 
| 19 | 
            +
                    "download_href": "/v3.2/live_photos/5134c12a-555a-1234-5e12-9d34fcbc11ba/download"
         | 
| 20 20 | 
             
                  }
         | 
| 21 21 | 
             
              ]
         | 
| 22 22 | 
             
            }
         | 
| @@ -18,6 +18,6 @@ | |
| 18 18 | 
             
              "file_name" : "output-29-05-2018_11_00_24.mov",
         | 
| 19 19 | 
             
              "file_type" : "video/quicktime",
         | 
| 20 20 | 
             
              "file_size" : 3348421,
         | 
| 21 | 
            -
              "href" : "/v3. | 
| 22 | 
            -
              "download_href" : "/v3. | 
| 21 | 
            +
              "href" : "/v3.2/live_videos/c9701e9b-83aa-442f-995b-20320ee8fb01",
         | 
| 22 | 
            +
              "download_href" : "/v3.2/live_videos/c9701e9b-83aa-442f-995b-20320ee8fb01/download"
         | 
| 23 23 | 
             
            }
         | 
| @@ -16,11 +16,11 @@ | |
| 16 16 | 
             
                    }
         | 
| 17 17 | 
             
                  ],
         | 
| 18 18 | 
             
                  "created_at": "2019-11-29T09:00:39Z",
         | 
| 19 | 
            -
                  "download_href": "/v3. | 
| 19 | 
            +
                  "download_href": "/v3.2/live_videos/c9701e9b-83aa-442f-995b-20320ee8fb01/download",
         | 
| 20 20 | 
             
                  "file_name": "output-29-11-2019_11_00_24.mov",
         | 
| 21 21 | 
             
                  "file_size": 3348421,
         | 
| 22 22 | 
             
                  "file_type": "video/quicktime",
         | 
| 23 | 
            -
                  "href": "/v3. | 
| 23 | 
            +
                  "href": "/v3.2/live_videos/c9701e9b-83aa-442f-995b-20320ee8fb01",
         | 
| 24 24 | 
             
                  "id": "c9701e9b-83aa-442f-995b-20320ee8fb01"
         | 
| 25 25 | 
             
                }
         | 
| 26 26 | 
             
              ]
         | 
| @@ -6,7 +6,7 @@ | |
| 6 6 | 
             
                  "created_at": "2019-11-23T13:50:45Z",
         | 
| 7 7 | 
             
                  "status": "in_progress",
         | 
| 8 8 | 
             
                  "result": "pending",
         | 
| 9 | 
            -
                  "href": "/v3. | 
| 9 | 
            +
                  "href": "/v3.2/reports/6951786-123123-422221",
         | 
| 10 10 | 
             
                  "breakdown": {},
         | 
| 11 11 | 
             
                  "properties": {}
         | 
| 12 12 | 
             
                },
         | 
| @@ -16,7 +16,7 @@ | |
| 16 16 | 
             
                  "created_at": "2019-11-23T13:50:45Z",
         | 
| 17 17 | 
             
                  "status": "in_progress",
         | 
| 18 18 | 
             
                  "result": "pending",
         | 
| 19 | 
            -
                  "href": "/v3. | 
| 19 | 
            +
                  "href": "/v3.2/reports/6951786-123123-316712",
         | 
| 20 20 | 
             
                  "breakdown": {},
         | 
| 21 21 | 
             
                  "properties": {}
         | 
| 22 22 | 
             
                }
         | 
| @@ -4,7 +4,7 @@ | |
| 4 4 | 
             
                  "id": "dd0a89e4-d44e-417a-aec4-01137d01ae59",
         | 
| 5 5 | 
             
                  "url": "https://demo.com",
         | 
| 6 6 | 
             
                  "enabled":false,
         | 
| 7 | 
            -
                  "href": "/v3. | 
| 7 | 
            +
                  "href": "/v3.2/webhooks/dd0a89e4-d44e-417a-aec4-01137d01ae59",
         | 
| 8 8 | 
             
                  "environments": [
         | 
| 9 9 | 
             
                    "live"
         | 
| 10 10 | 
             
                  ],
         | 
| @@ -18,7 +18,7 @@ | |
| 18 18 | 
             
                  "id": "bfc727a8-f7bf-4073-b123-ed70a70f58e5",
         | 
| 19 19 | 
             
                  "url": "https://demo2.com",
         | 
| 20 20 | 
             
                  "enabled": true,
         | 
| 21 | 
            -
                  "href": "/v3. | 
| 21 | 
            +
                  "href": "/v3.2/webhooks/bfc727a8-f7bf-4073-b123-ed70a70f58e5",
         | 
| 22 22 | 
             
                  "environments": [
         | 
| 23 23 | 
             
                    "live"
         | 
| 24 24 | 
             
                  ],
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: onfido
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 2. | 
| 4 | 
            +
              version: 2.1.1
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Onfido
         | 
| 8 | 
            -
            autorequire:
         | 
| 8 | 
            +
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date:  | 
| 11 | 
            +
            date: 2022-02-04 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: rspec
         | 
| @@ -117,10 +117,11 @@ executables: [] | |
| 117 117 | 
             
            extensions: []
         | 
| 118 118 | 
             
            extra_rdoc_files: []
         | 
| 119 119 | 
             
            files:
         | 
| 120 | 
            +
            - ".github/workflows/gem-push.yml"
         | 
| 121 | 
            +
            - ".github/workflows/ruby.yml"
         | 
| 120 122 | 
             
            - ".gitignore"
         | 
| 121 123 | 
             
            - ".rspec"
         | 
| 122 124 | 
             
            - ".rubocop.yml"
         | 
| 123 | 
            -
            - ".travis.yml"
         | 
| 124 125 | 
             
            - CHANGELOG.md
         | 
| 125 126 | 
             
            - Gemfile
         | 
| 126 127 | 
             
            - LICENSE
         | 
| @@ -186,7 +187,7 @@ homepage: http://github.com/onfido/onfido-ruby | |
| 186 187 | 
             
            licenses:
         | 
| 187 188 | 
             
            - MIT
         | 
| 188 189 | 
             
            metadata: {}
         | 
| 189 | 
            -
            post_install_message:
         | 
| 190 | 
            +
            post_install_message: 
         | 
| 190 191 | 
             
            rdoc_options: []
         | 
| 191 192 | 
             
            require_paths:
         | 
| 192 193 | 
             
            - lib
         | 
| @@ -201,8 +202,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 201 202 | 
             
                - !ruby/object:Gem::Version
         | 
| 202 203 | 
             
                  version: '0'
         | 
| 203 204 | 
             
            requirements: []
         | 
| 204 | 
            -
            rubygems_version: 3.1 | 
| 205 | 
            -
            signing_key:
         | 
| 205 | 
            +
            rubygems_version: 3.0.3.1
         | 
| 206 | 
            +
            signing_key: 
         | 
| 206 207 | 
             
            specification_version: 4
         | 
| 207 208 | 
             
            summary: A wrapper for Onfido API
         | 
| 208 209 | 
             
            test_files:
         |