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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7f150a770738b0094810f0822cdd64b28353875e
4
- data.tar.gz: be2426747f4a084c0a6ade7ac646afe31f80fce6
3
+ metadata.gz: 2eaf74e4921bc1ab21759c460a8655c350df6e07
4
+ data.tar.gz: '0954b56a1456ca6452ff48933d45758a15ec803d'
5
5
  SHA512:
6
- metadata.gz: 3c37d011e68a97d21970f550a71874d2b59687fc5b4d7239e214f3870a0c5cb1d3e27738fc0f4cd103f6af311ba03bfa305161a02eb381a8453303141737aa8a
7
- data.tar.gz: 3003aec8f51e6f040ada1a1ccfc7cc30f9cdadd8b0132f694f24a33897629d4dccda02cd605c72bbb1f47410ec08778738f1959b99d2de636d204058c6c98466
6
+ metadata.gz: 94186cf9843777f5cf64659ae294b9b39ba7d29e81b7d2cdb6e904c29042436344d3998011f9b6afec6483bd646d739c9f00fd77cfb0e5632b2d293f512d32ed
7
+ data.tar.gz: c514974adf452accf88b8412c08f7dc2c59a0d85e3b5535856bae876c23c7f5164246c20cc4b7e7cf779955db665ac1027eee6a1b405d124bdd4e58e55fb0b9a
data/README.md CHANGED
@@ -1,4 +1,5 @@
1
- [![Code Climate](https://codeclimate.com/github/nukturnal/gvive/badges/gpa.svg)](https://codeclimate.com/github/nukturnal/gvive) [![Build Status](https://travis-ci.org/nukturnal/gvive.svg?branch=master)](https://travis-ci.org/nukturnal/gvive)
1
+ [![Gem Version](https://badge.fury.io/rb/gvive.svg)](https://badge.fury.io/rb/gvive) [![Code Climate](https://codeclimate.com/github/nukturnal/gvive/badges/gpa.svg)](https://codeclimate.com/github/nukturnal/gvive) [![Build Status](https://travis-ci.org/nukturnal/gvive.svg?branch=master)](https://travis-ci.org/nukturnal/gvive) [![Test Coverage](https://codeclimate.com/github/nukturnal/gvive/badges/coverage.svg)](https://codeclimate.com/github/nukturnal/gvive/coverage) [![Issue Count](https://codeclimate.com/github/nukturnal/gvive/badges/issue_count.svg)](https://codeclimate.com/github/nukturnal/gvive) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/7425ac54e6484723a5482a92fc7f35ef)](https://www.codacy.com/app/nukturnal/gvive?utm_source=github.com&utm_medium=referral&utm_content=nukturnal/gvive&utm_campaign=Badge_Grade) [![codebeat badge](https://codebeat.co/badges/33b4fac4-6c7b-4176-95e0-f6fd56f74d59)](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.
@@ -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 :coc, :fullname
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
- def initialize(coc, fullname)
11
- @coc = coc
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: @coc, fname: @fullname })
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
- def initialize(passport_id)
9
- @passport_id = passport_id
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: @passport_id })
17
+ @response = gvive_request(passport_endpoint, id_params({ pid: @id }))
15
18
  @data = @response.to_o
16
19
  @response.success?
17
20
  end
@@ -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
- def initialize(voter_id)
9
- @voter_id = voter_id
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
- @response = gvive_request(voter_endpoint, { vid: @voter_id })
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
@@ -1,3 +1,3 @@
1
1
  module GVIVE
2
- VERSION = "0.1.0"
2
+ VERSION = "1.0.0"
3
3
  end
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: 0.1.0
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-28 00:00:00.000000000 Z
11
+ date: 2017-09-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler