kycid-gem 1.0.9

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: b32d2e120a4b576e8b7ad626a95aa6ce98db8fe810483aae38edfa04bc683f5c
4
+ data.tar.gz: 7e0c5104cc8b0931e3b739f323c4bb1f6ab825b8a7de33d8962db551029321c7
5
+ SHA512:
6
+ metadata.gz: cc6fab3f1c15ea8d8943422c7e22fdd33a75e5a23e548d316768a7cf9178c6f8e9f61557da16fab598550b4c6fb6c76b14383bc57a642b365d38f8f7f02e7a27
7
+ data.tar.gz: 99e8d9d23bceefc67dd78edb3e12c9b8cbd39496acf8ea7412c4d373957a15b19382dc150748f6c74658a07930aab00035fda977cda5fb8d50d789d543a223e5
data/.drone.yml ADDED
@@ -0,0 +1,30 @@
1
+ ---
2
+ kind: pipeline
3
+ name: default
4
+
5
+ steps:
6
+ - name: Run rspec
7
+ image: ruby:2.6
8
+ commands:
9
+ - gem install bundler:2.1.4
10
+ - bundle install
11
+ - bundle exec rspec
12
+
13
+ - name: Release gems
14
+ image: ruby:2.6
15
+ environment:
16
+ GEM_CREDENTIALS:
17
+ from_secret: gem_credentials
18
+ commands:
19
+ - mkdir -p ~/.gem
20
+ - echo $GEM_CREDENTIALS | base64 -d > ~/.gem/credentials
21
+ - chmod 0600 ~/.gem/credentials
22
+ - gem build kycid-gem.gemspec
23
+ - gem push kycid-gem*.gem
24
+ when:
25
+ branch:
26
+ - master
27
+
28
+ trigger:
29
+ event:
30
+ - push
data/.gitattributes ADDED
@@ -0,0 +1,2 @@
1
+ # Auto detect text files and perform LF normalization
2
+ * text=auto
data/.gitignore ADDED
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.travis-yml ADDED
@@ -0,0 +1,6 @@
1
+ ---
2
+ language: ruby
3
+ cache: bundler
4
+ rvm:
5
+ - 2.6.5
6
+ before_install: gem install bundler -v 2.1.4
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in kycid-gem.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,76 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ kycid-gem (1.0.9)
5
+ faraday
6
+ json
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ addressable (2.7.0)
12
+ public_suffix (>= 2.0.2, < 5.0)
13
+ coderay (1.1.2)
14
+ crack (0.4.3)
15
+ safe_yaml (~> 1.0.0)
16
+ diff-lcs (1.3)
17
+ docile (1.3.2)
18
+ faraday (1.4.1)
19
+ faraday-excon (~> 1.1)
20
+ faraday-net_http (~> 1.0)
21
+ faraday-net_http_persistent (~> 1.1)
22
+ multipart-post (>= 1.2, < 3)
23
+ ruby2_keywords (>= 0.0.4)
24
+ faraday-excon (1.1.0)
25
+ faraday-net_http (1.0.1)
26
+ faraday-net_http_persistent (1.1.0)
27
+ hashdiff (1.0.1)
28
+ json (2.3.0)
29
+ method_source (1.0.0)
30
+ multipart-post (2.1.1)
31
+ pry (0.13.1)
32
+ coderay (~> 1.1)
33
+ method_source (~> 1.0)
34
+ public_suffix (4.0.5)
35
+ rake (13.0.1)
36
+ rspec (3.9.0)
37
+ rspec-core (~> 3.9.0)
38
+ rspec-expectations (~> 3.9.0)
39
+ rspec-mocks (~> 3.9.0)
40
+ rspec-core (3.9.1)
41
+ rspec-support (~> 3.9.1)
42
+ rspec-expectations (3.9.1)
43
+ diff-lcs (>= 1.2.0, < 2.0)
44
+ rspec-support (~> 3.9.0)
45
+ rspec-mocks (3.9.1)
46
+ diff-lcs (>= 1.2.0, < 2.0)
47
+ rspec-support (~> 3.9.0)
48
+ rspec-support (3.9.2)
49
+ ruby2_keywords (0.0.4)
50
+ safe_yaml (1.0.5)
51
+ simplecov (0.17.1)
52
+ docile (~> 1.1)
53
+ json (>= 1.8, < 3)
54
+ simplecov-html (~> 0.10.0)
55
+ simplecov-html (0.10.2)
56
+ vcr (5.1.0)
57
+ webmock (3.8.3)
58
+ addressable (>= 2.3.6)
59
+ crack (>= 0.3.2)
60
+ hashdiff (>= 0.4.0, < 2.0.0)
61
+
62
+ PLATFORMS
63
+ ruby
64
+
65
+ DEPENDENCIES
66
+ bundler
67
+ kycid-gem!
68
+ pry
69
+ rake (~> 13.0)
70
+ rspec (~> 3.0)
71
+ simplecov
72
+ vcr
73
+ webmock
74
+
75
+ BUNDLED WITH
76
+ 2.1.4
data/README.md ADDED
@@ -0,0 +1,36 @@
1
+ # Ruby KYCAID
2
+
3
+ Ruby gem to interact with KYC provider https://www.kycaid.com/
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'kycid-gem'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle install
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install kycid-gem
20
+
21
+ ## Usage
22
+
23
+ Configure the gem using your issued KYCAID credentials in an initializer file. For example, in config/initializers/kycid-gem.rb:
24
+
25
+ ```
26
+ KYCAID.configure do |config|
27
+ config.authorization_token = ENV['KYCAID_AUTHORIZATION_TOKEN']
28
+ config.sandbox_mode = ENV['KYCAID_SANDBOX_MODE']
29
+ end
30
+ ```
31
+
32
+ ## Development
33
+
34
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
35
+
36
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "kycid-gem"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/kycid-gem.gemspec ADDED
@@ -0,0 +1,34 @@
1
+ require_relative 'lib/kycid-gem/version'
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = "kycid-gem"
5
+ spec.version = KYCAID::VERSION
6
+ spec.authors = ["Vitalspec."]
7
+ spec.email = ["support@vitalspec.io"]
8
+
9
+ spec.summary = %q{kycaid.com ruby library.}
10
+ spec.description = %q{Support for functionalities of kycaid.com}
11
+ spec.homepage = "https://www.kycaid.com/"
12
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
13
+
14
+ spec.metadata["homepage_uri"] = spec.homepage
15
+ spec.metadata["source_code_uri"] = "https://github.com/vitalspec/kycid-gem"
16
+
17
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
18
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
19
+ end
20
+ spec.bindir = "exe"
21
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
+ spec.require_paths = ["lib"]
23
+
24
+ spec.add_development_dependency "bundler"
25
+ spec.add_development_dependency "rake", "~> 13.0"
26
+ spec.add_development_dependency "rspec", "~> 3.0"
27
+ spec.add_development_dependency "vcr"
28
+ spec.add_development_dependency "webmock"
29
+ spec.add_development_dependency "pry"
30
+ spec.add_development_dependency "simplecov"
31
+
32
+ spec.add_dependency "faraday"
33
+ spec.add_dependency "json"
34
+ end
@@ -0,0 +1,30 @@
1
+ module KYCAID
2
+ # Address is wrapper for KYCAID Address endpoints.
3
+ class Address < Response
4
+ extend Client
5
+
6
+ # Creates new address, params is a Hash.
7
+ # * +:applicant_id+ - _required_ The applicant’s unique identificator that received in response of create an applicant.
8
+ # * +:type+ - _required_ The address type. Valid values are: +'REGISTERED', 'BUSINESS', 'ADDITIONAL'+.
9
+ # * +:country+ - The country of the applicants’s address. Example: GB (ISO 3166-2).
10
+ # * +:city+ - The city or town of the applicant’s address.
11
+ # * +:postal_code+ - The post or zip code of the applicant’s address.
12
+ # * +:full_address+ - The applicant’s full address.
13
+ #
14
+ # Returns Response object, conatining +address_id+.
15
+ def self.create(params)
16
+ response = KYCAID::Document.create(
17
+ {
18
+ front_file: params[:front_file],
19
+ applicant_id: params[:applicant_id],
20
+ type: 'ADDRESS_DOCUMENT'
21
+ }
22
+ )
23
+ return response unless response.errors.nil?
24
+
25
+ protected_params = params.slice(:country, :city, :postal_code, :full_address, :applicant_id, :type)
26
+
27
+ respond(post("/addresses", protected_params))
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,34 @@
1
+ module KYCAID
2
+ # Applicant is wrapper for KYCAID Applicants endpoints.
3
+ class Applicant < Response
4
+ extend Client
5
+
6
+ # Creates new applicant, params is a Hash.
7
+ # * +:type+ - _required_ The applicant type. Valid values are PERSON or COMPANY.
8
+ # * +:first_name+ - _required_ The applicant’s first name.
9
+ # * +:last_name+ - _required_ The applicant’s last name.
10
+ # * +:dob+ - _required_ The applicant’s day of birth date. (ISO 8601, YYYY-MM-DD).
11
+ # * +:residence_country+ - _required_ The applicant’s current nationality. Example: GB (ISO 3166-2).
12
+ # * +:email+ - _required_ The applicant’s email address.
13
+ # * +:phone+ - _required_ The phone number of applicant.
14
+ #
15
+ # Returns Response object, conatining +applicant_id+.
16
+ def self.create(params)
17
+ protected_params = params.slice(:type, :first_name, :last_name, :dob, :residence_country, :email, :phone)
18
+ respond(post("/applicants", protected_params))
19
+ end
20
+
21
+ # Send get request to retrieve applicant by his ID.
22
+ #
23
+ # Returns Response object, conatining:
24
+ # * +:applicant_id+
25
+ # * +:first_name+
26
+ # * +:last_name+
27
+ # * +:dob+
28
+ # * +:residence_country+
29
+ # * +:email+
30
+ def self.fetch(applicant_id)
31
+ respond(get("/applicants/#{applicant_id}"))
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,62 @@
1
+ module KYCAID
2
+ # Client contins REST API and handles content type and injecting Authorization token.
3
+ module Client
4
+ # Returns Faraday connection with authorization header containing token.
5
+ def conn
6
+ @conn ||= Faraday.new(url: KYCAID.configuration.api_endpoint).tap do |faraday|
7
+ faraday.authorization("Token", KYCAID.configuration.authorization_token)
8
+ end
9
+ end
10
+
11
+ # Returns Faraday connection for multipart data uploading with authorization header containing token.
12
+ def multipart_conn
13
+ @multipart_conn ||= Faraday.new(url: KYCAID.configuration.api_endpoint) do |faraday|
14
+ faraday.request :multipart
15
+ faraday.request :url_encoded
16
+ faraday.adapter Faraday.default_adapter
17
+ faraday.authorization("Token", KYCAID.configuration.authorization_token)
18
+ end
19
+ end
20
+
21
+ # Returns true if sandbox mode is set.
22
+ def sandbox?
23
+ KYCAID.configuration.sandbox_mode
24
+ end
25
+
26
+ # Performs a get request, adds sandbox flag to request.
27
+ def get(url, options={})
28
+ conn.get(url, options.merge(sandbox: sandbox?))
29
+ end
30
+
31
+ # Performs a post request, adds sandbox flag to request.
32
+ def post(url, params={})
33
+ conn.post(url, params.merge(sandbox: sandbox?))
34
+ end
35
+
36
+ # Performs a patch request, adds sandbox flag to request.
37
+ def patch(url, params={})
38
+ conn.patch(url, params.merge(sandbox: sandbox?))
39
+ end
40
+
41
+ # Performs a post request with multipart data, adds sandbox flag to request.
42
+ def file_post(url, params={})
43
+ multipart_conn.post(url, file_payload(params))
44
+ end
45
+
46
+ # Performs a put request with multipart data, adds sandbox flag to request.
47
+ def file_put(url, params={})
48
+ multipart_conn.put(url, file_payload(params))
49
+ end
50
+
51
+ # Returns multipart data body params.
52
+ def file_payload(params={})
53
+ file = Faraday::UploadIO.new(
54
+ params[:tempfile].path,
55
+ params[:content_type],
56
+ params[:original_filename]
57
+ )
58
+ payload = { :file => file }.merge(sandbox: sandbox?)
59
+ payload
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,21 @@
1
+ module KYCAID
2
+ # Configuration contains KYCAID gem preferences.
3
+ # * +:authorization_token+ - KYCAID acces token.
4
+ # * +:sandbox_mode+ - run requests in sandbox mode.
5
+ # * +:api_endpoint+ - KYCAID service endpoint.
6
+ # * +:raise_errors+ - if set to true, KYCAID errors (like unauthorized) will be raised, otherwise access errors by Response#errors.
7
+ class Configuration
8
+ attr_accessor :authorization_token
9
+ attr_accessor :sandbox_mode
10
+ attr_accessor :api_endpoint
11
+ attr_accessor :raise_errors
12
+
13
+ # Initizes configuration with default values.
14
+ def initialize
15
+ @authorization_token = "d9883415047de3439328df17b0310569669a"
16
+ @sandbox_mode = true
17
+ @api_endpoint = "https://api.kycaid.com/"
18
+ @raise_errors = false
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,72 @@
1
+ module KYCAID
2
+ # Document is wrapper for KYCAID Documents endpoints.
3
+ class Document < Response
4
+ extend Client
5
+
6
+ # Creates +:front_file+ and +:back_file+ files (see File) and a document,referring to those files.
7
+ # * +:applicant_id+ - _required_ The applicant’s unique identificator that received in response of Applicant#create.
8
+ # * +:type+ - _required_ The document type. Valid values are: GOVERNMENT_ID, PASSPORT, DRIVERS_LICENSE, SELFIE_IMAGE,
9
+ # ADDRESS_DOCUMENT, FINANCIAL_DOCUMENT, TAX_ID_NUMBER, REGISTRATION_COMPANY, COMPANY_LEGAL_ADDRESS, AUTHORISED_PERSON,
10
+ # COMPANY_OWNERSHIP.
11
+ # * +:document_number+ - The unique number associated with document (e.g. passport number).
12
+ # * +:issue_date+ - The issue date of the document. (ISO 8601, YYYY-MM-DD).
13
+ # * +:expiry_date+ - The expiry date of the document. (ISO 8601, YYYY-MM-DD)
14
+ # * +:front_file+ - nested param to create a file.
15
+ # * +:back_file+ - nested param to create a file.
16
+ #
17
+ # Front file and Back file are a Hash:
18
+ # * +:tempfile+ - file to upload.
19
+ # * +:file_extension+ - file's extensions (f.e., .jpeg)
20
+ # * +:file_name+ - filename.
21
+ #
22
+ # Returns Response object, conatining +document_id+.
23
+ def self.create(params)
24
+ front_file_id = create_file(params[:front_file])
25
+ back_file_id = create_file(params[:back_file])
26
+
27
+ protected_params = params.slice(:applicant_id, :type, :document_number, :issue_date, :expiry_date)
28
+ .merge(front_side_id: front_file_id, back_side_id: back_file_id)
29
+
30
+ respond(post("/documents", protected_params.compact))
31
+ end
32
+
33
+ # Update document, params is a Hash.
34
+ # * +:type+ - see #create
35
+ # * +:document_number+ - see #create
36
+ # * +:issue_date+ - see #create
37
+ # * +:expiry_date+ - see #create
38
+ # Front file and Back file are a Hash:
39
+ # * +:tempfile+ - file to upload.
40
+ # * +:file_extension+ - file's extensions (f.e., .jpeg)
41
+ # * +:file_name+ - filename.
42
+ #
43
+ # Returns Response object, conatining +document_id+.
44
+ def self.update(params)
45
+ front_file_id = create_file(params[:front_file])
46
+ back_file_id = create_file(params[:back_file])
47
+
48
+ protected_params = params.slice(:type, :document_number, :issue_date, :expiry_date)
49
+ .merge(front_side_id: front_file_id, back_side_id: back_file_id)
50
+ respond(patch("/documents/#{params[:id]}", protected_params))
51
+ end
52
+
53
+ # A helper to create associated file before creating document.
54
+ # Return a File Response object.
55
+ def self.file_params(params)
56
+ KYCAID::File.create(
57
+ tempfile: params[:tempfile],
58
+ content_type: "image/#{params[:file_extension]}",
59
+ original_filename: params[:file_name]
60
+ )
61
+ end
62
+
63
+ def self.create_file(file)
64
+ unless file.nil?
65
+ front_file = file_params(file)
66
+ return front_file unless front_file.errors.nil?
67
+
68
+ front_file.file_id
69
+ end
70
+ end
71
+ end
72
+ end
@@ -0,0 +1,28 @@
1
+ module KYCAID
2
+ # File is wrapper for KYCAID Files endpoints.
3
+ class File < Response
4
+ extend Client
5
+
6
+ # Creates new file.
7
+ # * +:tempfile+ - file to upload.
8
+ # * +:content_type+ - multipart data content type.
9
+ # * +:original_filename+ - filename.
10
+ #
11
+ # Returns Response object, conatining +file_id+.
12
+ def self.create(params)
13
+ respond(file_post("/files", params.slice(:tempfile, :content_type, :original_filename)))
14
+ end
15
+
16
+ # Updates a file.
17
+ # * +:file_id+ - file ID to update.
18
+ # * +:tempfile+ - file to upload.
19
+ # * +:content_type+ - multipart data content type.
20
+ # * +:original_filename+ - filename.
21
+ #
22
+ # Returns Response object, conatining +file_id+.
23
+ def self.update(params)
24
+ respond(file_put("/files/#{params[:file_id]}",
25
+ params.slice(:tempfile, :content_type, :original_filename)))
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,24 @@
1
+ module KYCAID
2
+ # Liveness is wrapper for KYCAID endpoints to perform liveness check.
3
+ class LivenessCheck < Response
4
+ extend Client
5
+
6
+ # Gets form url based on the template prepared in dashboard
7
+ # * +:applicant_id+ - _mandatory_ The applicant’s unique identificator that received in response of create an applicant. It's supposed to use when need to create verification for exists applicant.
8
+ # * +:external_applicant_id+ -_optional_ Custom identifier of the applicant, which is intended for binding the applicant in the customer and KYCAID systems.
9
+ # * +:redirect_url+ -_mandatory_ The customer site URL, where applicant will be redirected after completing filling the form.
10
+ #
11
+ # Returns Response object, containing
12
+ # * +form_id+ - _mandatory_ The form’s unique identificator.
13
+ # * +form_url+ - _mandatory_ One-time URL to the verification form. This URL will be available until applicant will not complete the form.
14
+ # * +verificiation_id+ - _mandatory_ The verification’s unique identificator.
15
+ def self.create(params)
16
+
17
+ protected_params = params.slice(:applicant_id, :external_applicant_id, :redirect_url)
18
+ form_id = params[:form_id]
19
+
20
+ respond(post("/forms/#{form_id}/urls", protected_params))
21
+
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,32 @@
1
+ module KYCAID
2
+ # Response is an object to wrap parsed json response.
3
+ class Response < OpenStruct
4
+ def initialize(response)
5
+ super(response)
6
+ end
7
+
8
+ # * If response is not successful, set errors to array of detected errors.
9
+ # * If response is successful, errors in nil.
10
+ # * If raise_errors is set in configuration, will raise error if any.
11
+ def handle_error(err)
12
+ self.errors ||= []
13
+ self.errors << err
14
+
15
+ raise err if KYCAID.configuration.raise_errors
16
+
17
+ self
18
+ end
19
+
20
+ # Wraps JSON response into OpenStruct.
21
+ # Original response in stored in +raw_response+
22
+ def self.respond(response)
23
+ resp = new(JSON.parse(response.body))
24
+ resp.raw_response = response
25
+
26
+ resp.handle_error(Unauthorized.new(response.body)) if response.status == 403
27
+ resp.handle_error(Error.new(response.body)) unless response.success?
28
+
29
+ resp
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,33 @@
1
+ module KYCAID
2
+ # Verification is wrapper for KYCAID Verifications endpoints.
3
+ class Verification < Response
4
+ extend Client
5
+
6
+ # Create a verification.
7
+ # * +:applicant_id+ - _required_ The applicant unique identificator that received in response of Applicant#create.
8
+ # * +:types+ - _required_ The verification types. Valid values are: DOCUMENT, FACIAL, ADDRESS, AML, FINANCIAL, VIDEO, COMPANY.
9
+ # * +:callback_url+ - _required_ URL on which the result will come.
10
+ # * +:form_id+ - _optional_ The form unique identificator. Used for inheritance of form configuration like ACR and email templates.
11
+ #
12
+ # See https://docs.kycaid.com/#create-a-verification for more info.
13
+ #
14
+ # Returns Response object, conatining +verification_id+.
15
+ def self.create(params)
16
+ protected_params = params.slice(:applicant_id, :types, :callback_url, :form_id)
17
+ respond(post("/verifications", protected_params))
18
+ end
19
+
20
+ # Retrieve a verification by it's id.
21
+ #
22
+ # Returns Response object, conatining:
23
+ # * +:verification_id+ - The verification’s unique identificator.
24
+ # * +:status+ - Status of verification. Possible values: +unused+, +pending+, +completed+.
25
+ # * +:verified+ - Result of verification. Possible values: +true+ or +false+.
26
+ # * +:verifications+ - VerificationsList object.
27
+ #
28
+ # See https://docs.kycaid.com/#retrieve-a-verification for more info.
29
+ def self.fetch(verification_id)
30
+ respond(get("/verifications/#{verification_id}"))
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,3 @@
1
+ module KYCAID
2
+ VERSION = "1.0.9"
3
+ end
data/lib/kycid-gem.rb ADDED
@@ -0,0 +1,46 @@
1
+ require "faraday"
2
+ require "json"
3
+ require "ostruct"
4
+
5
+ require "kycid-gem/version"
6
+ require "kycid-gem/configuration"
7
+ require "kycid-gem/client"
8
+ require "kycid-gem/response"
9
+ require "kycid-gem/applicant"
10
+ require "kycid-gem/file"
11
+ require "kycid-gem/document"
12
+ require "kycid-gem/address"
13
+ require "kycid-gem/verification"
14
+ require "kycid-gem/liveness_check"
15
+
16
+ # KYCAID module contains wrappers around KYCAID API.
17
+ # See https://kycaid.com/
18
+ module KYCAID
19
+
20
+ # Error is generic error used in this gem.
21
+ # All defined errors are inherited from Error.
22
+ class Error < StandardError; end
23
+
24
+ # Unauthorized is raised when 403 status returned,
25
+ # when request is correct but refuses to authorize it.
26
+ # Check your token or contact KYCAID support.
27
+ class Unauthorized < Error; end
28
+
29
+ class << self
30
+ attr_accessor :configuration
31
+ end
32
+
33
+ # Coinfigure allows to change gem preferences. Check Configuration for the list of options.
34
+ # ==== Example
35
+ #
36
+ # KYCAID.configure do |c|
37
+ # c.authorization_token = '1MAR3SP3CTABL3t0k3N'
38
+ # c.sandbox_mode = false
39
+ # c.api_endpoint = 'https://api.kycaid.com/'
40
+ # c.raise_errors = true
41
+ # end
42
+ def self.configure
43
+ self.configuration ||= Configuration.new
44
+ yield(configuration) if block_given?
45
+ end
46
+ end
data/metadata ADDED
@@ -0,0 +1,192 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: kycid-gem
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.9
5
+ platform: ruby
6
+ authors:
7
+ - Vitalspec
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2023-08-08 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '13.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '13.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: vcr
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: webmock
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: pry
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: simplecov
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: faraday
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: json
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :runtime
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ description: Support for functionalities of kycaid.com
140
+ email:
141
+ - hello@vitalspec.io
142
+ executables: []
143
+ extensions: []
144
+ extra_rdoc_files: []
145
+ files:
146
+ - ".drone.yml"
147
+ - ".gitignore"
148
+ - ".rspec"
149
+ - ".travis-yml"
150
+ - Gemfile
151
+ - Gemfile.lock
152
+ - README.md
153
+ - Rakefile
154
+ - bin/console
155
+ - bin/setup
156
+ - kycid-gem.gemspec
157
+ - lib/kycid-gem.rb
158
+ - lib/kycid-gem/address.rb
159
+ - lib/kycid-gem/applicant.rb
160
+ - lib/kycid-gem/client.rb
161
+ - lib/kycid-gem/configuration.rb
162
+ - lib/kycid-gem/document.rb
163
+ - lib/kycid-gem/file.rb
164
+ - lib/kycid-gem/liveness_check.rb
165
+ - lib/kycid-gem/response.rb
166
+ - lib/kycid-gem/verification.rb
167
+ - lib/kycid-gem/version.rb
168
+ homepage: https://www.kycaid.com/
169
+ licenses: []
170
+ metadata:
171
+ homepage_uri: https://www.kycaid.com/
172
+ source_code_uri: https://github.com/vitalspec/kycid-gem
173
+ post_install_message:
174
+ rdoc_options: []
175
+ require_paths:
176
+ - lib
177
+ required_ruby_version: !ruby/object:Gem::Requirement
178
+ requirements:
179
+ - - ">="
180
+ - !ruby/object:Gem::Version
181
+ version: 2.3.0
182
+ required_rubygems_version: !ruby/object:Gem::Requirement
183
+ requirements:
184
+ - - ">="
185
+ - !ruby/object:Gem::Version
186
+ version: '0'
187
+ requirements: []
188
+ rubygems_version: 3.0.3.1
189
+ signing_key:
190
+ specification_version: 4
191
+ summary: kycaid.com ruby library.
192
+ test_files: []
metadata ADDED
@@ -0,0 +1,191 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: kycid-gem
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.9
5
+ platform: ruby
6
+ authors:
7
+ - Vitalspec.
8
+ bindir: exe
9
+ cert_chain: []
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
+ dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: bundler
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - ">="
17
+ - !ruby/object:Gem::Version
18
+ version: '0'
19
+ type: :development
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - ">="
24
+ - !ruby/object:Gem::Version
25
+ version: '0'
26
+ - !ruby/object:Gem::Dependency
27
+ name: rake
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - "~>"
31
+ - !ruby/object:Gem::Version
32
+ version: '13.0'
33
+ type: :development
34
+ prerelease: false
35
+ version_requirements: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '13.0'
40
+ - !ruby/object:Gem::Dependency
41
+ name: rspec
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '3.0'
47
+ type: :development
48
+ prerelease: false
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '3.0'
54
+ - !ruby/object:Gem::Dependency
55
+ name: vcr
56
+ requirement: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ type: :development
62
+ prerelease: false
63
+ version_requirements: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ - !ruby/object:Gem::Dependency
69
+ name: webmock
70
+ requirement: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ type: :development
76
+ prerelease: false
77
+ version_requirements: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
82
+ - !ruby/object:Gem::Dependency
83
+ name: pry
84
+ requirement: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ type: :development
90
+ prerelease: false
91
+ version_requirements: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
96
+ - !ruby/object:Gem::Dependency
97
+ name: simplecov
98
+ requirement: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ type: :development
104
+ prerelease: false
105
+ version_requirements: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - ">="
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ - !ruby/object:Gem::Dependency
111
+ name: faraday
112
+ requirement: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - ">="
115
+ - !ruby/object:Gem::Version
116
+ version: '0'
117
+ type: :runtime
118
+ prerelease: false
119
+ version_requirements: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - ">="
122
+ - !ruby/object:Gem::Version
123
+ version: '0'
124
+ - !ruby/object:Gem::Dependency
125
+ name: json
126
+ requirement: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - ">="
129
+ - !ruby/object:Gem::Version
130
+ version: '0'
131
+ type: :runtime
132
+ prerelease: false
133
+ version_requirements: !ruby/object:Gem::Requirement
134
+ requirements:
135
+ - - ">="
136
+ - !ruby/object:Gem::Version
137
+ version: '0'
138
+ description: Support for functionalities of kycaid.com
139
+ email:
140
+ - support@vitalspec.io
141
+ executables: []
142
+ extensions: []
143
+ extra_rdoc_files: []
144
+ files:
145
+ - ".drone.yml"
146
+ - ".gitattributes"
147
+ - ".gitignore"
148
+ - ".rspec"
149
+ - ".travis-yml"
150
+ - Gemfile
151
+ - Gemfile.lock
152
+ - README.md
153
+ - Rakefile
154
+ - bin/console
155
+ - bin/setup
156
+ - kycid-gem.gemspec
157
+ - lib/kycid-gem.rb
158
+ - lib/kycid-gem/address.rb
159
+ - lib/kycid-gem/applicant.rb
160
+ - lib/kycid-gem/client.rb
161
+ - lib/kycid-gem/configuration.rb
162
+ - lib/kycid-gem/document.rb
163
+ - lib/kycid-gem/file.rb
164
+ - lib/kycid-gem/liveness_check.rb
165
+ - lib/kycid-gem/response.rb
166
+ - lib/kycid-gem/verification.rb
167
+ - lib/kycid-gem/version.rb
168
+ - metadata
169
+ homepage: https://www.kycaid.com/
170
+ licenses: []
171
+ metadata:
172
+ homepage_uri: https://www.kycaid.com/
173
+ source_code_uri: https://github.com/vitalspec/kycid-gem
174
+ rdoc_options: []
175
+ require_paths:
176
+ - lib
177
+ required_ruby_version: !ruby/object:Gem::Requirement
178
+ requirements:
179
+ - - ">="
180
+ - !ruby/object:Gem::Version
181
+ version: 2.3.0
182
+ required_rubygems_version: !ruby/object:Gem::Requirement
183
+ requirements:
184
+ - - ">="
185
+ - !ruby/object:Gem::Version
186
+ version: '0'
187
+ requirements: []
188
+ rubygems_version: 3.7.2
189
+ specification_version: 4
190
+ summary: kycaid.com ruby library.
191
+ test_files: []