-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from Coinberry/add-extractions-endpoint
Add extraction endpoint
- Loading branch information
Showing
6 changed files
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
module Onfido | ||
class Extraction < Resource | ||
def create(document_id:) | ||
payload = { document_id: document_id } | ||
|
||
post(path: 'extractions', payload: payload) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
require 'tempfile' | ||
|
||
describe Onfido::Extraction do | ||
subject(:extraction) { described_class.new } | ||
|
||
describe '#create' do | ||
let(:params) do | ||
{ | ||
document_id: '7568415-123123-123123' | ||
} | ||
end | ||
|
||
it 'creates a new extraction' do | ||
response = extraction.create(params) | ||
|
||
expect(response['document_id']).to eq('7568415-123123-123123') | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"document_id": "7568415-123123-123123", | ||
"document_classification": { | ||
"issuing_country": "FRA", | ||
"document_type": "national_identity_card" | ||
}, | ||
"extracted_data": { | ||
"date_of_birth": "1965-09-08", | ||
"document_number": "400925733", | ||
"first_name": "MARIE", | ||
"gender": "Female", | ||
"last_name": "MAVARINE", | ||
"mrz_line1": "P<GBRDU<MARIE<<MAVARINE<<<<<<<<<<<<<<<<<<<<<", | ||
"mrz_line2": "4009257333GBR6509088F1307072<<<<<<<<<<<<<<06", | ||
"nationality": "BRITISH CITIZEN", | ||
"full_name": "MAVARINE DU MARIE", | ||
"date_of_expiry": "2013-07-07", | ||
"middle_name": "DU", | ||
"address_line_1": "52 RUE DES FLEURS", | ||
"address_line_2": "33500 BORDEAUX", | ||
"address_line_3": "FRANCE" | ||
} | ||
} |