idnow 2.1.1 → 2.4.0
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 +5 -5
- data/.github/workflows/build-release.yml +93 -0
- data/.github/workflows/lint-test-build.yml +39 -0
- data/.gitignore +1 -0
- data/.rubocop.yml +5 -9
- data/Dockerfile +2 -6
- data/LICENSE.txt +1 -1
- data/Makefile +6 -0
- data/README.md +24 -4
- data/examples/idnow_automated_testing.rb +2 -2
- data/{idnow-client.gemspec → idnow.gemspec} +11 -12
- data/lib/idnow/API/automated_testing.rb +2 -2
- data/lib/idnow/API/document_definitions.rb +4 -3
- data/lib/idnow/API/download_documents.rb +1 -1
- data/lib/idnow/API/request_identifications.rb +1 -1
- data/lib/idnow/API/retrieve_identifications.rb +11 -2
- data/lib/idnow/API/upload_documents.rb +2 -1
- data/lib/idnow/client.rb +4 -4
- data/lib/idnow/configuration.rb +1 -6
- data/lib/idnow/helpers.rb +1 -1
- data/lib/idnow/json_response.rb +1 -1
- data/lib/idnow/models/identification_data.rb +4 -2
- data/lib/idnow/models/login_data.rb +1 -1
- data/lib/idnow/modules/jsonable.rb +2 -1
- data/lib/idnow/raw_response.rb +1 -1
- data/lib/idnow/sftp_client.rb +4 -4
- data/lib/idnow.rb +8 -2
- metadata +35 -35
- data/.travis.yml +0 -6
- data/circle.yml +0 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 6de30eb89edb8583c59fc39909c4f8e2d85038a43a52586892f7b84b13c692a9
|
|
4
|
+
data.tar.gz: 4dd0371f8e80b4a41ff3f9bda3a1132a00cd08a384c17ee92ee3b908d95a91c3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1c50ec5fb86201da528a5ac186519dac8dbba252b2c15672ce4293d26cb240b16a415e4e0053c5b19dcedaf7507cc89a41a78eef94bc97fa553e0d7a0065e754
|
|
7
|
+
data.tar.gz: 472f48eb394d6ba897f7cd27bdb5466a722d7e3704a8eafe82079586220ec805fd3514cec6512a6e1065e713e85a80332d6f8869a00467b7ddd620f8c47e2498
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
name: Build and release gem
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types:
|
|
6
|
+
- published
|
|
7
|
+
|
|
8
|
+
env:
|
|
9
|
+
GEM_NAME: idnow
|
|
10
|
+
RUBY_VERSION: 3.1.2
|
|
11
|
+
VERSION: ${{github.event.release.tag_name}}
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
validate_tag:
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
steps:
|
|
17
|
+
- name: 'Validate tag pattern: ${{ env.VERSION }}'
|
|
18
|
+
run: |
|
|
19
|
+
if [[ $VERSION =~ v[0-9]+\.[0-9]+\.[0-9]+ ]]; then
|
|
20
|
+
echo "Valid tagname, continue release"
|
|
21
|
+
else
|
|
22
|
+
echo "Invalid tagname, needs doesn't follow pattern: v<Semver>"
|
|
23
|
+
exit 1
|
|
24
|
+
fi
|
|
25
|
+
env:
|
|
26
|
+
VERSION: ${{env.VERSION}}
|
|
27
|
+
|
|
28
|
+
build:
|
|
29
|
+
name: Build gem
|
|
30
|
+
needs: validate_tag
|
|
31
|
+
runs-on: ubuntu-latest
|
|
32
|
+
permissions:
|
|
33
|
+
contents: read
|
|
34
|
+
steps:
|
|
35
|
+
- uses: actions/checkout@v2
|
|
36
|
+
|
|
37
|
+
- uses: ruby/setup-ruby@v1
|
|
38
|
+
with:
|
|
39
|
+
ruby-version: ${{env.RUBY_VERSION}}
|
|
40
|
+
|
|
41
|
+
- name: Build ${{env.VERSION}}
|
|
42
|
+
run: |
|
|
43
|
+
gem build $GEM_NAME.gemspec
|
|
44
|
+
|
|
45
|
+
- uses: actions/upload-artifact@v3
|
|
46
|
+
with:
|
|
47
|
+
name: ${{env.GEM_NAME}}-${{env.VERSION}}
|
|
48
|
+
path: '*.gem'
|
|
49
|
+
|
|
50
|
+
publish:
|
|
51
|
+
name: Publish to RubyGems.org
|
|
52
|
+
needs: build
|
|
53
|
+
runs-on: ubuntu-latest
|
|
54
|
+
steps:
|
|
55
|
+
- uses: actions/download-artifact@v3
|
|
56
|
+
with:
|
|
57
|
+
name: ${{env.GEM_NAME}}-${{env.VERSION}}
|
|
58
|
+
|
|
59
|
+
- uses: ruby/setup-ruby@v1
|
|
60
|
+
with:
|
|
61
|
+
ruby-version: ${{env.RUBY_VERSION}}
|
|
62
|
+
|
|
63
|
+
- name: Publish ${{env.VERSION}}
|
|
64
|
+
run: |
|
|
65
|
+
gem push $GEM_NAME-${VERSION:1}.gem
|
|
66
|
+
env:
|
|
67
|
+
GEM_HOST_API_KEY: ${{secrets.RUBYGEMS_AUTH_TOKEN}}
|
|
68
|
+
GEM_NAME: ${{env.GEM_NAME}}
|
|
69
|
+
VERSION: ${{env.VERSION}}
|
|
70
|
+
|
|
71
|
+
publish_gpr:
|
|
72
|
+
name: Publish to GitHub Packages
|
|
73
|
+
needs: publish
|
|
74
|
+
runs-on: ubuntu-latest
|
|
75
|
+
permissions:
|
|
76
|
+
packages: write
|
|
77
|
+
steps:
|
|
78
|
+
- uses: actions/download-artifact@v3
|
|
79
|
+
with:
|
|
80
|
+
name: ${{env.GEM_NAME}}-${{env.VERSION}}
|
|
81
|
+
|
|
82
|
+
- uses: ruby/setup-ruby@v1
|
|
83
|
+
with:
|
|
84
|
+
ruby-version: ${{env.RUBY_VERSION}}
|
|
85
|
+
|
|
86
|
+
- name: Publish ${{env.VERSION}}
|
|
87
|
+
run: |
|
|
88
|
+
gem push $GEM_NAME-${VERSION:1}.gem
|
|
89
|
+
env:
|
|
90
|
+
GEM_HOST_API_KEY: Bearer ${{secrets.GITHUB_TOKEN}}
|
|
91
|
+
RUBYGEMS_HOST: https://rubygems.pkg.github.com/${{github.repository_owner}}
|
|
92
|
+
GEM_NAME: ${{env.GEM_NAME}}
|
|
93
|
+
VERSION: ${{env.VERSION}}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
name: Lint, test & build gem
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
|
|
8
|
+
pull_request:
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
lint-test-build:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
name: Ruby ${{ matrix.ruby }}
|
|
14
|
+
strategy:
|
|
15
|
+
matrix:
|
|
16
|
+
ruby:
|
|
17
|
+
- '2.7.6'
|
|
18
|
+
- '3.1.2'
|
|
19
|
+
|
|
20
|
+
steps:
|
|
21
|
+
- uses: actions/checkout@v2
|
|
22
|
+
|
|
23
|
+
- name: Set up Ruby
|
|
24
|
+
uses: ruby/setup-ruby@v1
|
|
25
|
+
with:
|
|
26
|
+
ruby-version: ${{ matrix.ruby }}
|
|
27
|
+
bundler-cache: true
|
|
28
|
+
|
|
29
|
+
- name: Install dependencies
|
|
30
|
+
run: bundle
|
|
31
|
+
|
|
32
|
+
- name: Run linter
|
|
33
|
+
run: bundle exec rubocop
|
|
34
|
+
|
|
35
|
+
- name: Run tests
|
|
36
|
+
run: bundle exec rspec
|
|
37
|
+
|
|
38
|
+
- name: Build gem
|
|
39
|
+
run: gem build *.gemspec
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
AllCops:
|
|
2
2
|
DisplayCopNames: true
|
|
3
|
-
TargetRubyVersion: 2.
|
|
3
|
+
TargetRubyVersion: 2.7
|
|
4
|
+
NewCops: enable
|
|
4
5
|
|
|
5
6
|
# This configuration was generated by
|
|
6
7
|
# `rubocop --auto-gen-config`
|
|
@@ -13,7 +14,7 @@ AllCops:
|
|
|
13
14
|
# Offense count: 8
|
|
14
15
|
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes.
|
|
15
16
|
# URISchemes: http, https
|
|
16
|
-
|
|
17
|
+
Layout/LineLength:
|
|
17
18
|
Max: 140
|
|
18
19
|
|
|
19
20
|
Metrics/MethodLength:
|
|
@@ -21,17 +22,12 @@ Metrics/MethodLength:
|
|
|
21
22
|
|
|
22
23
|
Metrics/BlockLength:
|
|
23
24
|
Max: 190
|
|
25
|
+
Exclude:
|
|
26
|
+
- 'spec/**/*.rb'
|
|
24
27
|
|
|
25
28
|
Metrics/AbcSize:
|
|
26
29
|
Enabled: false
|
|
27
30
|
|
|
28
|
-
# Offense count: 2
|
|
29
|
-
# Cop supports --auto-correct.
|
|
30
|
-
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
|
31
|
-
# SupportedStyles: braces, no_braces, context_dependent
|
|
32
|
-
Style/BracesAroundHashParameters:
|
|
33
|
-
Enabled: false
|
|
34
|
-
|
|
35
31
|
# Offense count: 7
|
|
36
32
|
Style/Documentation:
|
|
37
33
|
Enabled: false
|
data/Dockerfile
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
FROM ruby:2.
|
|
1
|
+
FROM ruby:2.7
|
|
2
2
|
|
|
3
3
|
RUN mkdir /gem
|
|
4
4
|
WORKDIR /gem
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
RUN apk add git build-base
|
|
8
|
-
RUN gem install bundler
|
|
9
|
-
|
|
10
|
-
COPY Gemfile idnow-client.gemspec /gem/
|
|
6
|
+
COPY Gemfile *.lock idnow-client.gemspec /gem/
|
|
11
7
|
RUN bundle install
|
|
12
8
|
|
|
13
9
|
COPY . /gem/
|
data/LICENSE.txt
CHANGED
data/Makefile
CHANGED
data/README.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# Idnow Client
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://badge.fury.io/rb/idnow)
|
|
4
|
+
|
|
5
|
+
Library to consume the [IDnow API](http://www.idnow.eu/developers) in Ruby.
|
|
4
6
|
|
|
5
7
|
## Installation
|
|
6
8
|
|
|
@@ -114,8 +116,11 @@ Idnow.client.list_identifications(status: 'pending')
|
|
|
114
116
|
# keep in mind that it might take a while until the identification is completed.
|
|
115
117
|
Idnow.client.get_identification(transaction_number: transaction_number)
|
|
116
118
|
|
|
117
|
-
# Download identification
|
|
119
|
+
# Download identification file via SFTP
|
|
118
120
|
Idnow.client.download_identification(transaction_number: transaction_number)
|
|
121
|
+
|
|
122
|
+
# Get identification file via HTTP
|
|
123
|
+
Idnow.client.get_identification_file(transaction_number: transaction_number)
|
|
119
124
|
```
|
|
120
125
|
|
|
121
126
|
#### Esigning
|
|
@@ -152,7 +157,22 @@ Idnow.client.download_default_document(document_identifier)
|
|
|
152
157
|
|
|
153
158
|
## Development & testing
|
|
154
159
|
|
|
155
|
-
RSpec is used for testing.
|
|
160
|
+
RSpec is used for testing. For easier development, the project is dockerized allowing development inisde the container. Make use of following make targets:
|
|
161
|
+
|
|
162
|
+
Create development container:
|
|
163
|
+
|
|
164
|
+
```
|
|
165
|
+
make build
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
Open development console
|
|
169
|
+
|
|
170
|
+
```
|
|
171
|
+
make dev
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
Inside the console, `rspec` or `bundle` can be executed.
|
|
175
|
+
|
|
156
176
|
|
|
157
177
|
### Coverage report
|
|
158
178
|
|
|
@@ -167,6 +187,6 @@ COV=true make test
|
|
|
167
187
|
To run the tests through docker, you can use the included `Dockerfile`:
|
|
168
188
|
|
|
169
189
|
```sh
|
|
170
|
-
|
|
190
|
+
make build
|
|
171
191
|
docker run -it idnow-client:latest make test
|
|
172
192
|
```
|
|
@@ -33,5 +33,5 @@ puts "\n\n"
|
|
|
33
33
|
puts '--- Testing video chat---'
|
|
34
34
|
Idnow.client.testing_request_video_chat(transaction_number: transaction_number)
|
|
35
35
|
|
|
36
|
-
puts 'It might take a while until the identification is marked as successfull,' \
|
|
37
|
-
'
|
|
36
|
+
puts 'It might take a while until the identification is marked as successfull, ' \
|
|
37
|
+
'wait a little bit and then run idnow_get_identification.rb script'
|
|
@@ -2,15 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
Gem::Specification.new do |spec|
|
|
4
4
|
spec.name = 'idnow'
|
|
5
|
-
spec.version = '2.
|
|
5
|
+
spec.version = '2.4.0'
|
|
6
6
|
spec.authors = ['Joan Martinez, Tobias Bielohlawek']
|
|
7
|
-
spec.email = ['
|
|
7
|
+
spec.email = ['developers@solarisbank.de']
|
|
8
8
|
|
|
9
9
|
spec.summary = 'Ruby client for the IDnow API'
|
|
10
10
|
spec.description = 'Library to consume the IDnow API in Ruby, http://www.idnow.eu/developers'
|
|
11
11
|
|
|
12
|
-
raise 'RubyGems 2.0 or newer is required to protect against public gem pushes.' unless spec.respond_to?(:metadata)
|
|
13
|
-
|
|
14
12
|
spec.homepage = 'https://github.com/solarisBank/idnow-client'
|
|
15
13
|
spec.license = 'MIT'
|
|
16
14
|
|
|
@@ -19,14 +17,15 @@ Gem::Specification.new do |spec|
|
|
|
19
17
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
20
18
|
spec.require_paths = ['lib']
|
|
21
19
|
|
|
22
|
-
spec.
|
|
20
|
+
spec.required_ruby_version = '>= 2.7'
|
|
23
21
|
|
|
24
|
-
spec.
|
|
22
|
+
spec.add_runtime_dependency 'net-sftp', '~>2.1'
|
|
25
23
|
|
|
26
|
-
spec.add_development_dependency 'factory_bot'
|
|
27
|
-
spec.add_development_dependency 'rspec'
|
|
28
|
-
spec.add_development_dependency 'rubocop'
|
|
29
|
-
spec.add_development_dependency 'shoulda-matchers'
|
|
30
|
-
spec.add_development_dependency 'simplecov'
|
|
31
|
-
spec.add_development_dependency 'webmock'
|
|
24
|
+
spec.add_development_dependency 'factory_bot'
|
|
25
|
+
spec.add_development_dependency 'rspec'
|
|
26
|
+
spec.add_development_dependency 'rubocop'
|
|
27
|
+
spec.add_development_dependency 'shoulda-matchers'
|
|
28
|
+
spec.add_development_dependency 'simplecov'
|
|
29
|
+
spec.add_development_dependency 'webmock'
|
|
30
|
+
spec.metadata['rubygems_mfa_required'] = 'true'
|
|
32
31
|
end
|
|
@@ -8,13 +8,13 @@ module Idnow
|
|
|
8
8
|
def testing_start(transaction_number:)
|
|
9
9
|
path = full_path_for("identifications/#{transaction_number}/start")
|
|
10
10
|
request = Idnow::PostJsonRequest.new(path, {})
|
|
11
|
-
execute(request, 'X-API_KEY' => @api_key, http_client: automated_testing_http_client)
|
|
11
|
+
execute(request, { 'X-API_KEY' => @api_key }, http_client: automated_testing_http_client)
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
def testing_request_video_chat(transaction_number:)
|
|
15
15
|
path = full_path_for("identifications/#{transaction_number}/requestVideoChat")
|
|
16
16
|
request = Idnow::PostJsonRequest.new(path, {})
|
|
17
|
-
execute(request, 'X-API_KEY' => @api_key, http_client: automated_testing_http_client)
|
|
17
|
+
execute(request, { 'X-API_KEY' => @api_key }, http_client: automated_testing_http_client)
|
|
18
18
|
end
|
|
19
19
|
end
|
|
20
20
|
end
|
|
@@ -8,7 +8,7 @@ module Idnow
|
|
|
8
8
|
|
|
9
9
|
path = full_path_for('documentdefinitions')
|
|
10
10
|
request = Idnow::PostJsonRequest.new(path, document_data)
|
|
11
|
-
execute(request, 'X-API-LOGIN-TOKEN' => @auth_token)
|
|
11
|
+
execute(request, { 'X-API-LOGIN-TOKEN' => @auth_token })
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
def list_document_definitions
|
|
@@ -16,14 +16,15 @@ module Idnow
|
|
|
16
16
|
|
|
17
17
|
path = full_path_for('documentdefinitions')
|
|
18
18
|
request = Idnow::GetRequest.new(path)
|
|
19
|
-
response = execute(request, 'X-API-LOGIN-TOKEN' => @auth_token)
|
|
19
|
+
response = execute(request, { 'X-API-LOGIN-TOKEN' => @auth_token })
|
|
20
20
|
response.data.map do |data|
|
|
21
21
|
Idnow::DocumentDefinition.new(data)
|
|
22
22
|
end
|
|
23
23
|
end
|
|
24
24
|
|
|
25
|
-
def list_cached_document_definitions(refresh = false)
|
|
25
|
+
def list_cached_document_definitions(refresh = false) # rubocop:disable Style/OptionalBooleanParameter
|
|
26
26
|
return @list_cached_document_definitions = list_document_definitions if refresh
|
|
27
|
+
|
|
27
28
|
@list_cached_document_definitions ||= list_document_definitions
|
|
28
29
|
end
|
|
29
30
|
end
|
|
@@ -8,7 +8,7 @@ module Idnow
|
|
|
8
8
|
|
|
9
9
|
path = full_path_for("documentdefinitions/#{document_definition_identifier}/data")
|
|
10
10
|
request = Idnow::GetRequest.new(path, '')
|
|
11
|
-
execute(request, 'X-API-LOGIN-TOKEN' => @auth_token)
|
|
11
|
+
execute(request, { 'X-API-LOGIN-TOKEN' => @auth_token })
|
|
12
12
|
end
|
|
13
13
|
end
|
|
14
14
|
end
|
|
@@ -6,7 +6,7 @@ module Idnow
|
|
|
6
6
|
def request_identification(transaction_number:, identification_data:)
|
|
7
7
|
path = full_path_for("identifications/#{transaction_number}/start")
|
|
8
8
|
request = Idnow::PostJsonRequest.new(path, identification_data)
|
|
9
|
-
response = execute(request, 'X-API-KEY' => @api_key)
|
|
9
|
+
response = execute(request, { 'X-API-KEY' => @api_key })
|
|
10
10
|
Idnow::IdentificationRequest.new(response.data, transaction_number, @target_host, @company_id)
|
|
11
11
|
end
|
|
12
12
|
end
|
|
@@ -11,10 +11,11 @@ module Idnow
|
|
|
11
11
|
unless status.nil? || IDENTIFICATION_STATUSES.include?(status)
|
|
12
12
|
raise Idnow::InvalidArguments, "Status #{status} not defined, possible options are: #{IDENTIFICATION_STATUSES.join(',')}"
|
|
13
13
|
end
|
|
14
|
+
|
|
14
15
|
partial_path = status.nil? ? 'identifications' : "identifications?#{status}=true"
|
|
15
16
|
path = full_path_for(partial_path)
|
|
16
17
|
request = Idnow::GetRequest.new(path)
|
|
17
|
-
response = execute(request, 'X-API-LOGIN-TOKEN' => @auth_token)
|
|
18
|
+
response = execute(request, { 'X-API-LOGIN-TOKEN' => @auth_token })
|
|
18
19
|
response.data['identifications'].map do |data|
|
|
19
20
|
Idnow::Identification.new(data)
|
|
20
21
|
end
|
|
@@ -25,10 +26,18 @@ module Idnow
|
|
|
25
26
|
|
|
26
27
|
path = full_path_for("identifications/#{transaction_number}")
|
|
27
28
|
request = Idnow::GetRequest.new(path)
|
|
28
|
-
response = execute(request, 'X-API-LOGIN-TOKEN' => @auth_token)
|
|
29
|
+
response = execute(request, { 'X-API-LOGIN-TOKEN' => @auth_token })
|
|
29
30
|
Idnow::Identification.new(response.data)
|
|
30
31
|
end
|
|
31
32
|
|
|
33
|
+
def get_identification_file(transaction_number:)
|
|
34
|
+
raise Idnow::AuthenticationException if @auth_token.nil?
|
|
35
|
+
|
|
36
|
+
path = full_path_for("identifications/#{transaction_number}.zip")
|
|
37
|
+
request = Idnow::GetRequest.new(path, '')
|
|
38
|
+
execute(request, { 'X-API-LOGIN-TOKEN' => @auth_token })
|
|
39
|
+
end
|
|
40
|
+
|
|
32
41
|
def download_identification(transaction_number:)
|
|
33
42
|
path = "#{transaction_number}.zip"
|
|
34
43
|
@sftp_client.download(path)
|
|
@@ -17,8 +17,9 @@ module Idnow
|
|
|
17
17
|
|
|
18
18
|
def upload_document(file_data, request_path)
|
|
19
19
|
raise Idnow::AuthenticationException if @auth_token.nil?
|
|
20
|
+
|
|
20
21
|
request = Idnow::PostBinaryRequest.new(request_path, file_data)
|
|
21
|
-
execute(request, 'X-API-LOGIN-TOKEN' => @auth_token)
|
|
22
|
+
execute(request, { 'X-API-LOGIN-TOKEN' => @auth_token })
|
|
22
23
|
end
|
|
23
24
|
end
|
|
24
25
|
end
|
data/lib/idnow/client.rb
CHANGED
|
@@ -22,10 +22,11 @@ module Idnow
|
|
|
22
22
|
|
|
23
23
|
attr_reader :host
|
|
24
24
|
|
|
25
|
-
def initialize(env:, company_id:, api_key:, timeout: nil)
|
|
25
|
+
def initialize(env:, company_id:, api_key:, timeout: nil, sftp_options: {})
|
|
26
26
|
raise 'Please set env to :test or :live' unless Idnow::ENVIRONMENTS.keys.include?(env)
|
|
27
27
|
raise 'Please set your company_id' if company_id.nil?
|
|
28
28
|
raise 'Please set your api_key' if api_key.nil?
|
|
29
|
+
|
|
29
30
|
@host = Idnow.endpoint(env, :host)
|
|
30
31
|
@target_host = Idnow.endpoint(env, :target_host)
|
|
31
32
|
@company_id = company_id
|
|
@@ -33,9 +34,8 @@ module Idnow
|
|
|
33
34
|
|
|
34
35
|
@http_client = HttpClient.new(host: @host)
|
|
35
36
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
@sftp_client = SftpClient.new(sftp_client_options)
|
|
37
|
+
sftp_options[:timeout] = timeout if timeout
|
|
38
|
+
@sftp_client = SftpClient.new(host: @host, username: @company_id, password: @api_key, options: sftp_options)
|
|
39
39
|
end
|
|
40
40
|
|
|
41
41
|
private
|
data/lib/idnow/configuration.rb
CHANGED
|
@@ -10,9 +10,7 @@ module Idnow
|
|
|
10
10
|
# config.company_id = company_id
|
|
11
11
|
# end
|
|
12
12
|
|
|
13
|
-
attr_accessor :api_key
|
|
14
|
-
|
|
15
|
-
attr_accessor :company_id
|
|
13
|
+
attr_accessor :api_key, :company_id, :host, :api_version
|
|
16
14
|
|
|
17
15
|
module Idnow
|
|
18
16
|
module Host
|
|
@@ -20,8 +18,5 @@ module Idnow
|
|
|
20
18
|
PRODUCTION = 'https://gateway.idnow.de'
|
|
21
19
|
end
|
|
22
20
|
end
|
|
23
|
-
attr_accessor :host
|
|
24
|
-
|
|
25
|
-
attr_accessor :api_version
|
|
26
21
|
end
|
|
27
22
|
end
|
data/lib/idnow/helpers.rb
CHANGED
|
@@ -5,7 +5,7 @@ module Idnow
|
|
|
5
5
|
PROJECT_ROOT = File.dirname(File.dirname(File.dirname(__FILE__)))
|
|
6
6
|
|
|
7
7
|
module Factories
|
|
8
|
-
Dir[File.join(PROJECT_ROOT, 'spec', 'support', 'factories', '*.rb')].each { |file| require(file) }
|
|
8
|
+
Dir[File.join(PROJECT_ROOT, 'spec', 'support', 'factories', '*.rb')].sort.each { |file| require(file) }
|
|
9
9
|
end
|
|
10
10
|
end
|
|
11
11
|
end
|
data/lib/idnow/json_response.rb
CHANGED
|
@@ -9,22 +9,24 @@ module Idnow
|
|
|
9
9
|
FEMALE = 'FEMALE'
|
|
10
10
|
end
|
|
11
11
|
|
|
12
|
+
# rubocop:disable Naming/MethodName
|
|
12
13
|
attr_accessor :birthplace, :birthname, :city, :custom1,
|
|
13
14
|
:custom2, :custom3, :custom4, :custom5, :trackingid, :email, :firstname,
|
|
14
15
|
:lastname, :mobilephone, :nationality, :street, :streetnumber, :title, :zipcode,
|
|
15
16
|
:preferredLang
|
|
17
|
+
# rubocop:enable Naming/MethodName
|
|
16
18
|
|
|
17
19
|
attr_reader :country, :gender
|
|
18
20
|
|
|
19
21
|
def initialize(params = {})
|
|
20
|
-
params.
|
|
22
|
+
params.each_key do |key|
|
|
21
23
|
raise ArgumentError, "Attribute #{key} is not supported!" unless respond_to?(key.to_sym)
|
|
22
24
|
|
|
23
25
|
send("#{key}=", params[key])
|
|
24
26
|
end
|
|
25
27
|
end
|
|
26
28
|
|
|
27
|
-
def to_json
|
|
29
|
+
def to_json(*_args)
|
|
28
30
|
result = {}
|
|
29
31
|
instance_variables.each do |attribute|
|
|
30
32
|
result[attribute.to_s.delete('@')] = instance_variable_get(attribute)
|
|
@@ -14,7 +14,7 @@ module Idnow
|
|
|
14
14
|
end
|
|
15
15
|
end
|
|
16
16
|
|
|
17
|
-
def to_json
|
|
17
|
+
def to_json(*_args)
|
|
18
18
|
keys_without_underscores(to_h).to_json
|
|
19
19
|
end
|
|
20
20
|
|
|
@@ -22,6 +22,7 @@ module Idnow
|
|
|
22
22
|
|
|
23
23
|
def keys_without_underscores(obj)
|
|
24
24
|
return obj unless obj.is_a?(Hash)
|
|
25
|
+
|
|
25
26
|
obj.each_with_object({}) do |(k, v), result|
|
|
26
27
|
result[k.to_s.delete('_')] = keys_without_underscores(v)
|
|
27
28
|
end
|
data/lib/idnow/raw_response.rb
CHANGED
data/lib/idnow/sftp_client.rb
CHANGED
|
@@ -4,19 +4,19 @@ require 'net/sftp'
|
|
|
4
4
|
|
|
5
5
|
module Idnow
|
|
6
6
|
class SftpClient
|
|
7
|
-
def initialize(host:, username:, password:,
|
|
7
|
+
def initialize(host:, username:, password:, options: {})
|
|
8
8
|
@host = URI.parse(host).host
|
|
9
9
|
@username = username
|
|
10
10
|
@password = password
|
|
11
|
-
@
|
|
11
|
+
@options = options
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
def download(file_name)
|
|
15
15
|
data = nil
|
|
16
|
-
options =
|
|
17
|
-
options[:timeout] = @timeout if @timeout
|
|
16
|
+
options = @options.merge(password: @password)
|
|
18
17
|
Net::SFTP.start(@host, @username, options) do |sftp|
|
|
19
18
|
raise Idnow::Exception, "Invalid path. No identification file found under #{file_name}" unless file_exists(sftp, file_name)
|
|
19
|
+
|
|
20
20
|
begin
|
|
21
21
|
data = sftp.download!(file_name)
|
|
22
22
|
rescue Net::SFTP::Exception => e
|
data/lib/idnow.rb
CHANGED
|
@@ -50,6 +50,7 @@ module Idnow
|
|
|
50
50
|
|
|
51
51
|
def env=(env)
|
|
52
52
|
raise ArgumentError, 'Please provide a valid enviroment, :test or :live' unless ENVIRONMENTS.keys.include?(env)
|
|
53
|
+
|
|
53
54
|
@client = nil
|
|
54
55
|
@env = env
|
|
55
56
|
end
|
|
@@ -64,6 +65,11 @@ module Idnow
|
|
|
64
65
|
@api_key = api_key
|
|
65
66
|
end
|
|
66
67
|
|
|
68
|
+
def sftp_options=(sftp_options)
|
|
69
|
+
@client = nil
|
|
70
|
+
@sftp_options = sftp_options
|
|
71
|
+
end
|
|
72
|
+
|
|
67
73
|
def custom_environments=(custom_environments)
|
|
68
74
|
@client = nil
|
|
69
75
|
@custom_environments = custom_environments
|
|
@@ -74,8 +80,8 @@ module Idnow
|
|
|
74
80
|
end
|
|
75
81
|
|
|
76
82
|
def client
|
|
77
|
-
@client ||= Idnow::Client.new(env: @env, company_id: @company_id, api_key: @api_key)
|
|
83
|
+
@client ||= Idnow::Client.new(env: @env, company_id: @company_id, api_key: @api_key, sftp_options: @sftp_options || {})
|
|
78
84
|
end
|
|
79
85
|
|
|
80
|
-
module_function :env=, :company_id=, :api_key=, :custom_environments=, :endpoint, :client
|
|
86
|
+
module_function :env=, :company_id=, :api_key=, :sftp_options=, :custom_environments=, :endpoint, :client
|
|
81
87
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: idnow
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.4.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Joan Martinez, Tobias Bielohlawek
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2022-07-25 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: net-sftp
|
|
@@ -28,110 +28,110 @@ dependencies:
|
|
|
28
28
|
name: factory_bot
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
30
30
|
requirements:
|
|
31
|
-
- - "
|
|
31
|
+
- - ">="
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
|
-
version: '
|
|
33
|
+
version: '0'
|
|
34
34
|
type: :development
|
|
35
35
|
prerelease: false
|
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
37
|
requirements:
|
|
38
|
-
- - "
|
|
38
|
+
- - ">="
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
|
-
version: '
|
|
40
|
+
version: '0'
|
|
41
41
|
- !ruby/object:Gem::Dependency
|
|
42
42
|
name: rspec
|
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
|
44
44
|
requirements:
|
|
45
|
-
- - "
|
|
45
|
+
- - ">="
|
|
46
46
|
- !ruby/object:Gem::Version
|
|
47
|
-
version: '
|
|
47
|
+
version: '0'
|
|
48
48
|
type: :development
|
|
49
49
|
prerelease: false
|
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
|
51
51
|
requirements:
|
|
52
|
-
- - "
|
|
52
|
+
- - ">="
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
|
-
version: '
|
|
54
|
+
version: '0'
|
|
55
55
|
- !ruby/object:Gem::Dependency
|
|
56
56
|
name: rubocop
|
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
|
58
58
|
requirements:
|
|
59
|
-
- - "
|
|
59
|
+
- - ">="
|
|
60
60
|
- !ruby/object:Gem::Version
|
|
61
|
-
version: 0
|
|
61
|
+
version: '0'
|
|
62
62
|
type: :development
|
|
63
63
|
prerelease: false
|
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
|
65
65
|
requirements:
|
|
66
|
-
- - "
|
|
66
|
+
- - ">="
|
|
67
67
|
- !ruby/object:Gem::Version
|
|
68
|
-
version: 0
|
|
68
|
+
version: '0'
|
|
69
69
|
- !ruby/object:Gem::Dependency
|
|
70
70
|
name: shoulda-matchers
|
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
|
72
72
|
requirements:
|
|
73
|
-
- - "
|
|
73
|
+
- - ">="
|
|
74
74
|
- !ruby/object:Gem::Version
|
|
75
|
-
version: '
|
|
75
|
+
version: '0'
|
|
76
76
|
type: :development
|
|
77
77
|
prerelease: false
|
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
|
79
79
|
requirements:
|
|
80
|
-
- - "
|
|
80
|
+
- - ">="
|
|
81
81
|
- !ruby/object:Gem::Version
|
|
82
|
-
version: '
|
|
82
|
+
version: '0'
|
|
83
83
|
- !ruby/object:Gem::Dependency
|
|
84
84
|
name: simplecov
|
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
|
86
86
|
requirements:
|
|
87
|
-
- - "
|
|
87
|
+
- - ">="
|
|
88
88
|
- !ruby/object:Gem::Version
|
|
89
|
-
version: '0
|
|
89
|
+
version: '0'
|
|
90
90
|
type: :development
|
|
91
91
|
prerelease: false
|
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
|
93
93
|
requirements:
|
|
94
|
-
- - "
|
|
94
|
+
- - ">="
|
|
95
95
|
- !ruby/object:Gem::Version
|
|
96
|
-
version: '0
|
|
96
|
+
version: '0'
|
|
97
97
|
- !ruby/object:Gem::Dependency
|
|
98
98
|
name: webmock
|
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
|
100
100
|
requirements:
|
|
101
|
-
- - "
|
|
101
|
+
- - ">="
|
|
102
102
|
- !ruby/object:Gem::Version
|
|
103
|
-
version: '
|
|
103
|
+
version: '0'
|
|
104
104
|
type: :development
|
|
105
105
|
prerelease: false
|
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
|
107
107
|
requirements:
|
|
108
|
-
- - "
|
|
108
|
+
- - ">="
|
|
109
109
|
- !ruby/object:Gem::Version
|
|
110
|
-
version: '
|
|
110
|
+
version: '0'
|
|
111
111
|
description: Library to consume the IDnow API in Ruby, http://www.idnow.eu/developers
|
|
112
112
|
email:
|
|
113
|
-
-
|
|
113
|
+
- developers@solarisbank.de
|
|
114
114
|
executables: []
|
|
115
115
|
extensions: []
|
|
116
116
|
extra_rdoc_files: []
|
|
117
117
|
files:
|
|
118
|
+
- ".github/workflows/build-release.yml"
|
|
119
|
+
- ".github/workflows/lint-test-build.yml"
|
|
118
120
|
- ".gitignore"
|
|
119
121
|
- ".rspec"
|
|
120
122
|
- ".rubocop.yml"
|
|
121
|
-
- ".travis.yml"
|
|
122
123
|
- CODE_OF_CONDUCT.md
|
|
123
124
|
- Dockerfile
|
|
124
125
|
- Gemfile
|
|
125
126
|
- LICENSE.txt
|
|
126
127
|
- Makefile
|
|
127
128
|
- README.md
|
|
128
|
-
- circle.yml
|
|
129
129
|
- docs/IDnow_API.pdf
|
|
130
130
|
- examples/idnow_automated_testing.rb
|
|
131
131
|
- examples/idnow_download_identification.rb
|
|
132
132
|
- examples/idnow_get_identification.rb
|
|
133
133
|
- examples/idnow_upload_download_default_document.rb
|
|
134
|
-
- idnow
|
|
134
|
+
- idnow.gemspec
|
|
135
135
|
- lib/idnow.rb
|
|
136
136
|
- lib/idnow/API/authentication.rb
|
|
137
137
|
- lib/idnow/API/automated_testing.rb
|
|
@@ -165,24 +165,24 @@ files:
|
|
|
165
165
|
homepage: https://github.com/solarisBank/idnow-client
|
|
166
166
|
licenses:
|
|
167
167
|
- MIT
|
|
168
|
-
metadata:
|
|
168
|
+
metadata:
|
|
169
|
+
rubygems_mfa_required: 'true'
|
|
169
170
|
post_install_message:
|
|
170
171
|
rdoc_options: []
|
|
171
172
|
require_paths:
|
|
172
173
|
- lib
|
|
173
174
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
174
175
|
requirements:
|
|
175
|
-
- - "
|
|
176
|
+
- - ">="
|
|
176
177
|
- !ruby/object:Gem::Version
|
|
177
|
-
version: '2.
|
|
178
|
+
version: '2.7'
|
|
178
179
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
179
180
|
requirements:
|
|
180
181
|
- - ">="
|
|
181
182
|
- !ruby/object:Gem::Version
|
|
182
183
|
version: '0'
|
|
183
184
|
requirements: []
|
|
184
|
-
|
|
185
|
-
rubygems_version: 2.6.14
|
|
185
|
+
rubygems_version: 3.3.7
|
|
186
186
|
signing_key:
|
|
187
187
|
specification_version: 4
|
|
188
188
|
summary: Ruby client for the IDnow API
|
data/.travis.yml
DELETED