idnow 1.1.0 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +7 -0
- data/Makefile +6 -1
- data/idnow-client.gemspec +1 -1
- data/lib/idnow.rb +1 -0
- data/lib/idnow/API/automated_testing.rb +1 -0
- data/lib/idnow/client.rb +1 -0
- data/lib/idnow/configuration.rb +1 -0
- data/lib/idnow/http_client.rb +10 -9
- data/lib/idnow/models/identification.rb +1 -1
- data/lib/idnow/models/identification_data.rb +1 -0
- data/lib/idnow/models/identification_process.rb +1 -1
- data/lib/idnow/models/user_data.rb +5 -0
- data/lib/idnow/sftp_client.rb +8 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f7636a8ddecbc36e100f54413150590a4ace73ea
|
4
|
+
data.tar.gz: 7457d857840d07698651ad9353a72dd8e08a9cfc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cc4b30834b1f450d9c9e56e43c3fabb37f6029760f25bd0178c06dd48e7bf5358b6dbee6b4243eb1d863828adfb8724dd334bf5ebcb9b64506e28edd1d2ed09a
|
7
|
+
data.tar.gz: ecded6e3fc954b139141d84c88aa6fdf64aa95773aefef95cfa30b720bab12b97313d451ca503e4b1532c025577ad3f92d052e421c6f415b0b4d6fb1a1c612a1
|
data/.gitignore
CHANGED
data/.travis.yml
ADDED
data/Makefile
CHANGED
data/idnow-client.gemspec
CHANGED
data/lib/idnow.rb
CHANGED
data/lib/idnow/client.rb
CHANGED
data/lib/idnow/configuration.rb
CHANGED
data/lib/idnow/http_client.rb
CHANGED
@@ -1,26 +1,27 @@
|
|
1
1
|
module Idnow
|
2
2
|
class HttpClient
|
3
|
-
def initialize(host:)
|
4
|
-
@uri
|
3
|
+
def initialize(host:, read_timout_sec: 30)
|
4
|
+
@uri = URI.parse(host)
|
5
|
+
@read_timeout = read_timout_sec
|
5
6
|
end
|
6
7
|
|
7
8
|
def execute(request, headers = {})
|
8
9
|
headers.each do |k, v|
|
9
10
|
request[k] = v
|
10
11
|
end
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
end
|
12
|
+
|
13
|
+
client.request(request)
|
14
|
+
rescue Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, EOFError,
|
15
|
+
Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError => e
|
16
|
+
raise Idnow::ConnectionException, e
|
17
17
|
end
|
18
18
|
|
19
19
|
private
|
20
20
|
|
21
21
|
def client
|
22
22
|
Net::HTTP.new(@uri.host, @uri.port).tap do |http|
|
23
|
-
http.
|
23
|
+
http.read_timeout = @read_timeout
|
24
|
+
http.use_ssl = true
|
24
25
|
end
|
25
26
|
end
|
26
27
|
end
|
@@ -19,12 +19,17 @@ module Idnow
|
|
19
19
|
@streetnumber = dig_value('address', 'streetnumber', data)
|
20
20
|
@title = dig_value('title', data)
|
21
21
|
@zipcode = dig_value('address', 'zipcode', data)
|
22
|
+
@raw_data = data
|
22
23
|
end
|
23
24
|
|
24
25
|
def address
|
25
26
|
"#{street} #{streetnumber}, #{zipcode} #{city}, #{country}"
|
26
27
|
end
|
27
28
|
|
29
|
+
def address_changed?
|
30
|
+
@raw_data['address'].values.any? { |field| field['status'] == 'CHANGE' }
|
31
|
+
end
|
32
|
+
|
28
33
|
private
|
29
34
|
|
30
35
|
def dig_value(*keys, data)
|
data/lib/idnow/sftp_client.rb
CHANGED
@@ -11,7 +11,7 @@ module Idnow
|
|
11
11
|
def download(file_name)
|
12
12
|
data = nil
|
13
13
|
Net::SFTP.start(@host, @username, password: @password) do |sftp|
|
14
|
-
fail Idnow::Exception, "Invalid path. No identification file found under #{file_name}"
|
14
|
+
fail Idnow::Exception, "Invalid path. No identification file found under #{file_name}" unless file_exists(sftp, file_name)
|
15
15
|
begin
|
16
16
|
data = sftp.download!(file_name)
|
17
17
|
rescue Net::SFTP::Exception => e
|
@@ -20,5 +20,12 @@ module Idnow
|
|
20
20
|
end
|
21
21
|
data
|
22
22
|
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def file_exists(sftp, file_name)
|
27
|
+
sftp.dir.entries('.').each { |entry| return true if file_name == entry.name }
|
28
|
+
false
|
29
|
+
end
|
23
30
|
end
|
24
31
|
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: 1.
|
4
|
+
version: 1.3.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: 2016-
|
11
|
+
date: 2016-10-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: net-sftp
|
@@ -118,6 +118,7 @@ files:
|
|
118
118
|
- ".gitignore"
|
119
119
|
- ".rspec"
|
120
120
|
- ".rubocop.yml"
|
121
|
+
- ".travis.yml"
|
121
122
|
- CODE_OF_CONDUCT.md
|
122
123
|
- Gemfile
|
123
124
|
- LICENSE.txt
|
@@ -180,7 +181,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
180
181
|
version: '0'
|
181
182
|
requirements: []
|
182
183
|
rubyforge_project:
|
183
|
-
rubygems_version: 2.
|
184
|
+
rubygems_version: 2.6.6
|
184
185
|
signing_key:
|
185
186
|
specification_version: 4
|
186
187
|
summary: Ruby client for the IDnow API
|