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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 71c54deac5050e48ce75bb19ff81ab76ca827055
4
- data.tar.gz: 5e47156913a5f7127277cb5c6ef5a1e343ecad15
2
+ SHA256:
3
+ metadata.gz: 82db134ab8710048f63870b2f4c5735b4a4b2c2808481efedd2bd0816e63d3bb
4
+ data.tar.gz: a021696004917135fe482aa575ef2fd18c8d27d8e3e46cd7737511012a733354
5
5
  SHA512:
6
- metadata.gz: 303055651e8474d3f2d42f76c331f11ba45c8ca85eff341fa9b3b2fb05c5dbe31e581b854bf3fb84f9e481eea682420f82b024cc317251dc6c194703a986f4ed
7
- data.tar.gz: 6de474e0a88f7e24adf051327bbd14438ae93352a0304aa3660af81f79cdddb487d8d5eec051b418fdb18bd3358af543fe925d0cc4c6668b508b099681778fd8
6
+ metadata.gz: e0be012fca98d2b9385292d99b50a33dc61889e7e9251ca3ce0c2f56c9b95f92b00a3960d8df66456e188129a5bf44701d9891856fe02466c9648002686cbfaa
7
+ data.tar.gz: cc023ff9bf7703e4b987ef6b24b5af7745ef231f4ca1ef57d8dc57d5e15f20a07afaff5b5cc628b699e11443b195cfd632ef3e455a40c7aa399cf4f66717e8de
@@ -21,6 +21,8 @@ Metrics/MethodLength:
21
21
 
22
22
  Metrics/BlockLength:
23
23
  Max: 190
24
+ Exclude:
25
+ - 'spec/**/*.rb'
24
26
 
25
27
  Metrics/AbcSize:
26
28
  Enabled: false
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = 'idnow'
5
- spec.version = '2.1.1'
5
+ spec.version = '2.2.0'
6
6
  spec.authors = ['Joan Martinez, Tobias Bielohlawek']
7
7
  spec.email = ['joan.martinez@solarisbank.de']
8
8
 
@@ -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
@@ -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
- sftp_client_options = { host: @host, username: @company_id, password: @api_key }
37
- sftp_client_options[:timeout] = timeout if timeout
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
@@ -4,17 +4,16 @@ require 'net/sftp'
4
4
 
5
5
  module Idnow
6
6
  class SftpClient
7
- def initialize(host:, username:, password:, timeout: nil)
7
+ def initialize(host:, username:, password:, options: {})
8
8
  @host = URI.parse(host).host
9
9
  @username = username
10
10
  @password = password
11
- @timeout = timeout
11
+ @options = options
12
12
  end
13
13
 
14
14
  def download(file_name)
15
15
  data = nil
16
- options = { password: @password }
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.1.1
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: 2018-04-10 00:00:00.000000000 Z
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
- rubyforge_project:
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