gvive 0.1.0 → 1.0.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 +4 -4
- data/README.md +2 -1
- data/lib/gvive/identities.rb +22 -1
- data/lib/gvive/identity/driver.rb +10 -4
- data/lib/gvive/identity/passport.rb +7 -4
- data/lib/gvive/identity/voter.rb +11 -4
- data/lib/gvive/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2eaf74e4921bc1ab21759c460a8655c350df6e07
|
4
|
+
data.tar.gz: '0954b56a1456ca6452ff48933d45758a15ec803d'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 94186cf9843777f5cf64659ae294b9b39ba7d29e81b7d2cdb6e904c29042436344d3998011f9b6afec6483bd646d739c9f00fd77cfb0e5632b2d293f512d32ed
|
7
|
+
data.tar.gz: c514974adf452accf88b8412c08f7dc2c59a0d85e3b5535856bae876c23c7f5164246c20cc4b7e7cf779955db665ac1027eee6a1b405d124bdd4e58e55fb0b9a
|
data/README.md
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
[](https://codeclimate.com/github/nukturnal/gvive) [](https://travis-ci.org/nukturnal/gvive)
|
1
|
+
[](https://badge.fury.io/rb/gvive) [](https://codeclimate.com/github/nukturnal/gvive) [](https://travis-ci.org/nukturnal/gvive) [](https://codeclimate.com/github/nukturnal/gvive/coverage) [](https://codeclimate.com/github/nukturnal/gvive) [](https://www.codacy.com/app/nukturnal/gvive?utm_source=github.com&utm_medium=referral&utm_content=nukturnal/gvive&utm_campaign=Badge_Grade) [](https://codebeat.co/projects/github-com-nukturnal-gvive-master)
|
2
|
+
|
2
3
|
# GVIVE Ruby SDK
|
3
4
|
|
4
5
|
This gem is a wrapper around GVIVE Identity Verification API offered at https://gvivegh.com/ by Bsystems Limited Ghana. The SDK currently supports Voter ID, Passport & Driver License verifications.
|
data/lib/gvive/identities.rb
CHANGED
@@ -2,7 +2,28 @@ module GVIVE
|
|
2
2
|
class Identities
|
3
3
|
include GVIVE::Utils
|
4
4
|
|
5
|
-
attr_accessor :data, :response
|
5
|
+
attr_accessor :data, :response, :id, :photo, :signature
|
6
|
+
|
7
|
+
# Identity classes have 3 common requirements
|
8
|
+
# - ID to search
|
9
|
+
# - Option to return a Base64Encoded Image of the ID
|
10
|
+
# - Option to return a Base64Encoded Signature of the ID
|
11
|
+
# Optionally specify whether you want to return a Base64Encoded Photo
|
12
|
+
# Optionally specify whether you want to return a Base64Encoded Signature
|
13
|
+
# @param [String] id
|
14
|
+
# @param [Boolean] photo
|
15
|
+
# @param [Boolean] signature
|
16
|
+
def initialize(id, photo = false, signature = false)
|
17
|
+
@id = id
|
18
|
+
@photo = photo
|
19
|
+
@signature = signature
|
20
|
+
end
|
21
|
+
|
22
|
+
# Automatically merge photo & signature into the request
|
23
|
+
# We don't want to repeat this across all subclasses :)
|
24
|
+
def id_params(params = {})
|
25
|
+
params.merge(incp: @photo, incs: @signature)
|
26
|
+
end
|
6
27
|
|
7
28
|
# Implement this method in subclass
|
8
29
|
# Validate Identity with GVIVE Web Service
|
@@ -1,20 +1,26 @@
|
|
1
|
+
require 'cgi'
|
2
|
+
|
1
3
|
module GVIVE
|
2
4
|
module Identity
|
3
5
|
class Driver < GVIVE::Identities
|
4
|
-
attr_accessor :
|
6
|
+
attr_accessor :fullname
|
5
7
|
|
6
8
|
# Certificate of Competence required
|
7
9
|
# Fullname of card holder as it appears on the card
|
10
|
+
# Optionally specify whether you want to return a Base64Encoded Photo
|
11
|
+
# Optionally specify whether you want to return a Base64Encoded signature
|
8
12
|
# @param [String] coc
|
9
13
|
# @param [String] fullname
|
10
|
-
|
11
|
-
|
14
|
+
# @param [Boolean] photo
|
15
|
+
# @param [Boolean] signature
|
16
|
+
def initialize(coc, fullname, photo = false, signature = false)
|
17
|
+
super(coc, photo, signature)
|
12
18
|
@fullname = fullname
|
13
19
|
end
|
14
20
|
|
15
21
|
# Implementing valid? method signature as described in Identity Class
|
16
22
|
def valid?
|
17
|
-
@response = gvive_request(driver_endpoint, { coc: @
|
23
|
+
@response = gvive_request(driver_endpoint, id_params({ coc: @id, fname: @fullname}))
|
18
24
|
@data = @response.to_o
|
19
25
|
@response.success?
|
20
26
|
end
|
@@ -1,17 +1,20 @@
|
|
1
1
|
module GVIVE
|
2
2
|
module Identity
|
3
3
|
class Passport < GVIVE::Identities
|
4
|
-
attr_accessor :passport_id
|
5
4
|
|
6
5
|
# Passport ID number required
|
6
|
+
# Optionally specify whether you want to return a Base64Encoded Photo
|
7
|
+
# Optionally specify whether you want to return a Base64Encoded signature
|
7
8
|
# @param [String] passport_id
|
8
|
-
|
9
|
-
|
9
|
+
# @param [Boolean] photo
|
10
|
+
# @param [Boolean] signature
|
11
|
+
def initialize(passport_id, photo = false, signature = false)
|
12
|
+
super(passport_id, photo, signature)
|
10
13
|
end
|
11
14
|
|
12
15
|
# Implementing valid? method signature as described in Identity Class
|
13
16
|
def valid?
|
14
|
-
@response = gvive_request(passport_endpoint, { pid: @
|
17
|
+
@response = gvive_request(passport_endpoint, id_params({ pid: @id }))
|
15
18
|
@data = @response.to_o
|
16
19
|
@response.success?
|
17
20
|
end
|
data/lib/gvive/identity/voter.rb
CHANGED
@@ -1,17 +1,24 @@
|
|
1
1
|
module GVIVE
|
2
2
|
module Identity
|
3
3
|
class Voter < GVIVE::Identities
|
4
|
-
attr_accessor :voter_id
|
5
4
|
|
6
5
|
# Voter ID number required
|
6
|
+
# Optionally specify whether you want to return a Base64Encoded Photo
|
7
7
|
# @param [String] voter_id
|
8
|
-
|
9
|
-
|
8
|
+
# @param [Boolean] photo
|
9
|
+
def initialize(voter_id, photo = false)
|
10
|
+
super(voter_id, photo)
|
10
11
|
end
|
11
12
|
|
12
13
|
# Implementing valid? method signature as described in Identity Class
|
13
14
|
def valid?
|
14
|
-
|
15
|
+
params = id_params({ vid: @id })
|
16
|
+
|
17
|
+
# Voter ID does not include signature photo request
|
18
|
+
# Let's remove this from the API request call
|
19
|
+
params.delete(:incs)
|
20
|
+
|
21
|
+
@response = gvive_request(voter_endpoint, params)
|
15
22
|
@data = @response.to_o
|
16
23
|
@response.success?
|
17
24
|
end
|
data/lib/gvive/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gvive
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alfred Rowe
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-09-
|
11
|
+
date: 2017-09-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|