idnow 2.1.1 → 2.2.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/.rubocop.yml +2 -0
- data/idnow-client.gemspec +1 -1
- data/lib/idnow.rb +7 -2
- data/lib/idnow/client.rb +3 -4
- data/lib/idnow/sftp_client.rb +3 -4
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 82db134ab8710048f63870b2f4c5735b4a4b2c2808481efedd2bd0816e63d3bb
|
4
|
+
data.tar.gz: a021696004917135fe482aa575ef2fd18c8d27d8e3e46cd7737511012a733354
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e0be012fca98d2b9385292d99b50a33dc61889e7e9251ca3ce0c2f56c9b95f92b00a3960d8df66456e188129a5bf44701d9891856fe02466c9648002686cbfaa
|
7
|
+
data.tar.gz: cc023ff9bf7703e4b987ef6b24b5af7745ef231f4ca1ef57d8dc57d5e15f20a07afaff5b5cc628b699e11443b195cfd632ef3e455a40c7aa399cf4f66717e8de
|
data/.rubocop.yml
CHANGED
data/idnow-client.gemspec
CHANGED
data/lib/idnow.rb
CHANGED
@@ -64,6 +64,11 @@ module Idnow
|
|
64
64
|
@api_key = api_key
|
65
65
|
end
|
66
66
|
|
67
|
+
def sftp_options=(sftp_options)
|
68
|
+
@client = nil
|
69
|
+
@sftp_options = sftp_options
|
70
|
+
end
|
71
|
+
|
67
72
|
def custom_environments=(custom_environments)
|
68
73
|
@client = nil
|
69
74
|
@custom_environments = custom_environments
|
@@ -74,8 +79,8 @@ module Idnow
|
|
74
79
|
end
|
75
80
|
|
76
81
|
def client
|
77
|
-
@client ||= Idnow::Client.new(env: @env, company_id: @company_id, api_key: @api_key)
|
82
|
+
@client ||= Idnow::Client.new(env: @env, company_id: @company_id, api_key: @api_key, sftp_options: @sftp_options || {})
|
78
83
|
end
|
79
84
|
|
80
|
-
module_function :env=, :company_id=, :api_key=, :custom_environments=, :endpoint, :client
|
85
|
+
module_function :env=, :company_id=, :api_key=, :sftp_options=, :custom_environments=, :endpoint, :client
|
81
86
|
end
|
data/lib/idnow/client.rb
CHANGED
@@ -22,7 +22,7 @@ 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?
|
@@ -33,9 +33,8 @@ module Idnow
|
|
33
33
|
|
34
34
|
@http_client = HttpClient.new(host: @host)
|
35
35
|
|
36
|
-
|
37
|
-
|
38
|
-
@sftp_client = SftpClient.new(sftp_client_options)
|
36
|
+
sftp_options[:timeout] = timeout if timeout
|
37
|
+
@sftp_client = SftpClient.new(host: @host, username: @company_id, password: @api_key, options: sftp_options)
|
39
38
|
end
|
40
39
|
|
41
40
|
private
|
data/lib/idnow/sftp_client.rb
CHANGED
@@ -4,17 +4,16 @@ 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)
|
20
19
|
begin
|
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.2.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: 2020-08-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: net-sftp
|
@@ -181,8 +181,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
181
181
|
- !ruby/object:Gem::Version
|
182
182
|
version: '0'
|
183
183
|
requirements: []
|
184
|
-
|
185
|
-
rubygems_version: 2.6.14
|
184
|
+
rubygems_version: 3.0.3
|
186
185
|
signing_key:
|
187
186
|
specification_version: 4
|
188
187
|
summary: Ruby client for the IDnow API
|