bigid_bgcheck 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 061bab2e6ded3cddad6973dca46452ac88a24b5930ad9d774a1dcd6b33b26a1e
4
+ data.tar.gz: 95de36d25c4b50fb8680917b9dd2bef2f9fc3c74fa27ce238f9f250859130cfd
5
+ SHA512:
6
+ metadata.gz: 354a23277c46fab26ca4982b0ce52335249ea0305cfd49166e506e7b2c06bf3eb9d455ee9ca7c2683936b83ed1cd191af51c8d3a4012d855551fdc21b0a591c0
7
+ data.tar.gz: febce1e53fa05ab98ef4ad058a0331a5f0f90247094734378eafb8ed288e1aa6c80d6dec442883d868d614f6a288b23d0066bb0542660a76ac5ef91941e3d137
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ # CHANGELOG for bigid_bgcheck
2
+
3
+ ## v0.1.0
4
+
5
+ * Initial release of bigid_bgcheck
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2021 Danilo Carolino
2
+
3
+ MIT LICENSE
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,26 @@
1
+ = bigid_bgcheck
2
+
3
+ {<img src="https://travis-ci.org/Danilo Carolino/bigid_bgcheck.png?branch=master" alt="Build Status" />}[https://travis-ci.org/Danilo Carolino/bigid_bgcheck]
4
+ {<img src="https://codeclimate.com/github/Danilo Carolino/bigid_bgcheck.png" />}[https://codeclimate.com/github/Danilo Carolino/bigid_bgcheck]
5
+ {<img src="https://gemnasium.com/Danilo Carolino/bigid_bgcheck.png" alt="Dependency Status"/>}[https://gemnasium.com/Danilo Carolino/bigid_bgcheck]
6
+ {<img src="https://badge.fury.io/rb/bigid_bgcheck.png" alt="Gem Version" />}[http://badge.fury.io/rb/bigid_bgcheck]
7
+
8
+ # TODO: Suggested free useful projects and badges: The first 3 require free signup to setup, and are best used with GitHub. The last will display the current version released to rubygems.org
9
+ http://travis-ci.org https://codeclimate.com https://gemnasium.com/ https://badge.fury.io/
10
+
11
+ Description goes here.
12
+
13
+ == Contributing to bigid_bgcheck
14
+
15
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
16
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
17
+ * Fork the project
18
+ * Start a feature/bugfix branch
19
+ * Commit and push until you are happy with your contribution
20
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
21
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
22
+
23
+ == Copyright
24
+
25
+ Copyright (c) 2021 Danilo Carolino. See LICENSE.txt for
26
+ further details.
data/Rakefile ADDED
@@ -0,0 +1,38 @@
1
+ #!/usr/bin/env rake
2
+ begin
3
+ require 'bundler/setup'
4
+ rescue LoadError
5
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
+ end
7
+ begin
8
+ require 'rdoc/task'
9
+ rescue LoadError
10
+ require 'rdoc/rdoc'
11
+ require 'rake/rdoctask'
12
+ RDoc::Task = Rake::RDocTask
13
+ end
14
+
15
+ RDoc::Task.new(:rdoc) do |rdoc|
16
+ rdoc.rdoc_dir = 'rdoc'
17
+ rdoc.title = 'bigid_bgcheck'
18
+ rdoc.options << '--line-numbers'
19
+ rdoc.rdoc_files.include('README.rdoc')
20
+ rdoc.rdoc_files.include('lib/**/*.rb')
21
+ end
22
+
23
+
24
+
25
+
26
+ Bundler::GemHelper.install_tasks
27
+
28
+
29
+ require "rake/testtask"
30
+
31
+ Rake::TestTask.new(:spec) do |t|
32
+ t.libs << 'lib'
33
+ t.libs << 'spec'
34
+ t.pattern = "spec/**/*_spec.rb"
35
+ t.verbose = true
36
+ end
37
+
38
+ task :default => :spec
@@ -0,0 +1,44 @@
1
+ module Bigid
2
+ module Bgcheck
3
+ module Auth
4
+ class AuthenticatedConnection < Connection
5
+ COOKIE_CACHE_KEY = 'BIG_ID_AUTHENTICATION_COOKIE_CACHE_KEY'.freeze
6
+
7
+ def initialize(authentication: Bigid::Bgcheck::Auth::Authentication.new,
8
+ cache: defined?(Rails) ? Rails.cache : nil,
9
+ request_class: Faraday,
10
+ base_url: Bigid::Bgcheck::BASE_URL,
11
+ token_expiration_time_in_seconds: Bigid::Bgcheck::TOKEN_EXPIRATION)
12
+ super(request_class: request_class, base_url: base_url)
13
+ @authentication = authentication
14
+ @cache = cache
15
+ @token_expiration_time_in_seconds = token_expiration_time_in_seconds
16
+ end
17
+
18
+ def default_headers
19
+ super.merge(Authorization: (@cache ? cached_token : auth_token))
20
+ end
21
+
22
+ private
23
+
24
+ def auth_token
25
+ response = @authentication.login
26
+ extract_token(response.body)
27
+ end
28
+
29
+ def cached_token
30
+ @cache.fetch(COOKIE_CACHE_KEY, expires_in: @token_expiration_time_in_seconds.seconds) do
31
+ auth_token
32
+ end
33
+ end
34
+
35
+ def extract_token(value)
36
+ raise Bigid::Bgcheck::AuthenticationError unless value
37
+
38
+ value_json = JSON.parse(value)
39
+ "Bearer #{value_json['token']}"
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,11 @@
1
+ module Bigid
2
+ module Bgcheck
3
+ module Auth
4
+ class AuthenticatedResource
5
+ def initialize(connection: AuthenticatedConnection.new)
6
+ @connection = connection
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,37 @@
1
+ module Bigid
2
+ module Bgcheck
3
+ module Auth
4
+ class Authentication
5
+ def initialize(connection: Connection.new,
6
+ username: Bigid::Bgcheck.configuration&.username,
7
+ password: Bigid::Bgcheck.configuration&.password,
8
+ token_expiration_time_in_seconds: Bigid::Bgcheck::AUTH_ENDPOINT)
9
+ @connection = connection
10
+ @token_expiration_time_in_seconds = Bigid::Bgcheck::TOKEN_EXPIRATION
11
+ @username = username ? username : ENV['BIGID_USERNAME']
12
+ @password = password ? password : ENV['BIGID_PASSWORD']
13
+ end
14
+
15
+ def login
16
+ res = @connection.post(url: 'Generate', body: login_body)
17
+
18
+ return res if res.status == 200
19
+
20
+ raise Bigid::Bgcheck::InvalidCredentialsError if res.status == 401
21
+ raise Bigid::Bgcheck::BadRequestError if res.status == 400
22
+ raise Bigid::Bgcheck::ServerError if res.status == 500
23
+ end
24
+
25
+ private
26
+
27
+ def login_body
28
+ {
29
+ login: @username,
30
+ password: @password,
31
+ expires: @token_expiration_time_in_seconds.to_i
32
+ }.to_json
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,18 @@
1
+ module Bigid
2
+ module Bgcheck
3
+ module Auth
4
+ class Connection < Bigid::Bgcheck::Integration::Connection
5
+ def initialize(request_class: Faraday, base_url: Bigid::Bgcheck::AUTH_ENDPOINT)
6
+ super(request_class: request_class, base_url: base_url)
7
+ end
8
+
9
+ def default_headers
10
+ {
11
+ 'Content-Type': 'application/json',
12
+ 'Accept': 'application/json'
13
+ }
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,6 @@
1
+ module Bigid
2
+ module Bgcheck
3
+ class BadRequestError < BaseError
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,25 @@
1
+ module Bigid
2
+ module Bgcheck
3
+ class BaseError < StandardError
4
+ def initialize(message = self.class.default_message)
5
+ super
6
+ end
7
+
8
+ def self.default_message
9
+ name = self.name.dup
10
+
11
+ I18n.t("errors.#{underscore(name)}")
12
+ end
13
+
14
+ protected
15
+
16
+ def self.underscore(str)
17
+ str.gsub(/::/, '.')
18
+ .gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2')
19
+ .gsub(/([a-z\d])([A-Z])/,'\1_\2')
20
+ .tr("-", "_")
21
+ .downcase
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,6 @@
1
+ module Bigid
2
+ module Bgcheck
3
+ class DocumentNotSupportedError < BaseError
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,119 @@
1
+ module Bigid
2
+ module Bgcheck
3
+ module Integration
4
+ class Connection
5
+ attr_reader :base_url
6
+
7
+ def initialize(request_class: Faraday, base_url:)
8
+ @request_class = request_class
9
+ @base_url = base_url
10
+ end
11
+
12
+ def get(url: '', params: {}, headers: {})
13
+ send_request(
14
+ method: :get,
15
+ url: url,
16
+ params: params,
17
+ headers: headers
18
+ )
19
+ end
20
+
21
+ def post(url: '', params: {}, headers: {}, body: {}, multipart: false)
22
+ send_request(
23
+ method: :post,
24
+ url: url,
25
+ params: params,
26
+ headers: headers,
27
+ body: body,
28
+ multipart: multipart
29
+ )
30
+ end
31
+
32
+ def put(url: '', params: {}, headers: {}, body: {})
33
+ send_request(
34
+ method: :put,
35
+ url: url,
36
+ params: params,
37
+ headers: headers,
38
+ body: body
39
+ )
40
+ end
41
+
42
+ def patch(url: '', params: {}, headers: {}, body: {})
43
+ send_request(
44
+ method: :patch,
45
+ url: url,
46
+ params: params,
47
+ headers: headers,
48
+ body: body
49
+ )
50
+ end
51
+
52
+ def delete(url: '', params: {}, headers: {}, body: {})
53
+ send_request(
54
+ method: :delete,
55
+ url: url,
56
+ params: params,
57
+ headers: headers,
58
+ body: body
59
+ )
60
+ end
61
+
62
+ def default_headers
63
+ {}
64
+ end
65
+
66
+ private
67
+
68
+ def send_request(method:, url:, params:, headers:, body: nil, multipart: false)
69
+ connection = multipart ? multipart_connection : @request_class.new(url: @base_url)
70
+
71
+ merged_headers = default_headers.merge(headers)
72
+
73
+ request = build_request(
74
+ method, connection.build_url(url).to_s, params, merged_headers, body
75
+ )
76
+
77
+ result =
78
+ connection.send(method) do |request|
79
+ request.url(url)
80
+ request.params = params
81
+ request.headers = merged_headers
82
+ request.body = body if body
83
+ end
84
+
85
+ build_response(request, result.status, result.headers, result.body)
86
+ end
87
+
88
+ def multipart_connection
89
+ @request_class.new(url: @base_url) do |conn|
90
+ conn.use Bigid::Bgcheck::Integration::MultipartFlat
91
+ conn.request :url_encoded
92
+ conn.adapter @request_class.default_adapter
93
+ end
94
+ end
95
+
96
+ def build_request(method, url, params, headers, body)
97
+ Bigid::Bgcheck::Integration::Request.new(
98
+ method: method,
99
+ url: url,
100
+ params: params,
101
+ headers: headers,
102
+ body: body,
103
+ time: Time.now.utc
104
+ )
105
+ end
106
+
107
+ def build_response(request, status, headers, body)
108
+ Bigid::Bgcheck::Integration::Response.new(
109
+ request: request,
110
+ status: status,
111
+ headers: headers,
112
+ body: body,
113
+ time: Time.now.utc
114
+ )
115
+ end
116
+ end
117
+ end
118
+ end
119
+ end
@@ -0,0 +1,26 @@
1
+ module Bigid
2
+ module Bgcheck
3
+ module Integration
4
+ class MultipartFlat < Faraday::Request::Multipart
5
+ self.mime_type = 'multipart/form-data'.freeze
6
+ DEFAULT_BOUNDARY_PREFIX = "-----------RubyMultipartPost".freeze unless defined? DEFAULT_BOUNDARY_PREFIX
7
+
8
+ def process_params(params, prefix = nil, pieces = nil, &block)
9
+ params.inject(pieces || []) do |all, (key, value)|
10
+ key = "#{prefix}" if prefix
11
+
12
+ case value
13
+ when Array
14
+ values = value.inject([]) { |a,v| a << [nil, v] }
15
+ process_params(values, key, all, &block)
16
+ when Hash
17
+ process_params(value, key, all, &block)
18
+ else
19
+ all << block.call(key, value)
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,18 @@
1
+ module Bigid
2
+ module Bgcheck
3
+ module Integration
4
+ class Request
5
+ attr_reader :method, :url, :params, :headers, :body, :time
6
+
7
+ def initialize(attributes)
8
+ @method = attributes.fetch(:method)
9
+ @url = attributes.fetch(:url)
10
+ @params = attributes[:params] || {}
11
+ @headers = attributes[:headers] || {}
12
+ @body = attributes[:body] || {}
13
+ @time = attributes[:time] || Time.current
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,25 @@
1
+ module Bigid
2
+ module Bgcheck
3
+ module Integration
4
+ class Response
5
+ attr_reader :request, :status, :headers, :body, :time
6
+
7
+ def initialize(attributes)
8
+ @request = attributes.fetch(:request)
9
+ @status = attributes.fetch(:status)
10
+ @headers = attributes[:headers] || {}
11
+ @body = attributes[:body] || {}
12
+ @time = attributes[:time] || Time.current
13
+ end
14
+
15
+ def success?
16
+ @status.between?(200, 299)
17
+ end
18
+
19
+ def error?
20
+ !success?
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,21 @@
1
+ module Bigid
2
+ module Bgcheck
3
+ class InternalError < BaseError
4
+ HTTP_STATUS = 400
5
+ STATUS = 'internal_error'.freeze
6
+ STATUS_CODE = '-1101'.freeze
7
+
8
+ def http_status
9
+ HTTP_STATUS
10
+ end
11
+
12
+ def status
13
+ STATUS
14
+ end
15
+
16
+ def status_code
17
+ STATUS_CODE
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,6 @@
1
+ module Bigid
2
+ module Bgcheck
3
+ class InvalidCredentialsError < BaseError
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ module Bigid
2
+ module Bgcheck
3
+ class InvalidDocumentValueError < BaseError
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,21 @@
1
+ module Bigid
2
+ module Bgcheck
3
+ class NoInfoError < BaseError
4
+ HTTP_STATUS = 200
5
+ STATUS = 'no_info_error'.freeze
6
+ STATUS_CODE = '-1102'.freeze
7
+
8
+ def http_status
9
+ HTTP_STATUS
10
+ end
11
+
12
+ def status
13
+ STATUS
14
+ end
15
+
16
+ def status_code
17
+ STATUS_CODE
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,6 @@
1
+ module Bigid
2
+ module Bgcheck
3
+ class NotPermissionError < BaseError
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,68 @@
1
+ module Bigid
2
+ module Bgcheck
3
+ class Request < Bigid::Bgcheck::Auth::AuthenticatedResource
4
+ VALID_DOCUMENTS = %w[CPF CNPJ].freeze
5
+
6
+ APPROVED = 90.freeze
7
+ NOT_APPROVED = -1100.freeze
8
+ ERROR = -1101.freeze
9
+ NO_INFO = -1102.freeze
10
+
11
+ def call(document:, document_type:, group:)
12
+ res = @connection.post(url: Bigid::Bgcheck::SRV_ENDPOINT, body: payload(document, document_type, group).to_json)
13
+
14
+ check_status(res.status)
15
+
16
+ return parse_response_body(res.body)
17
+ end
18
+
19
+ def self.call(document:, document_type:, group:)
20
+ new.call(document: document, document_type: document_type, group: group)
21
+ end
22
+
23
+ private
24
+
25
+ def check_status(status)
26
+ raise Bigid::Bgcheck::InternalError unless status
27
+ raise Bigid::Bgcheck::ServerError if status == 500
28
+ raise Bigid::Bgcheck::InvalidCredentialsError if status == 401
29
+ raise Bigid::Bgcheck::BadRequestError if status == 400
30
+ end
31
+
32
+ def payload(document, document_type, group, parameters = {})
33
+ login = Bigid::Bgcheck.configuration&.username || ENV['BIGID_USERNAME']
34
+ document_type = document_type.upcase.strip
35
+
36
+ if !VALID_DOCUMENTS.include?(document_type)
37
+ raise Bigid::Bgcheck::DocumentNotSupportedError
38
+ end
39
+
40
+ parameters[:"#{document_type}"] = document
41
+
42
+ { Login: login, parameters: parameters, Group: group }
43
+ end
44
+
45
+ def check_result_code(code)
46
+ raise Bigid::Bgcheck::InvalidDocumentValueError unless code
47
+ raise Bigid::Bgcheck::NoInfoError if code == NO_INFO
48
+ end
49
+
50
+ def parse_response_body(body)
51
+ body = JSON.parse(body)
52
+
53
+ check_result_code(body['ResultCode'])
54
+
55
+ Bigid::Bgcheck::Result.new(
56
+ approved: body['ResultCode'] == APPROVED,
57
+ ticket_id: body['TicketId'],
58
+ code: body['ResultCode'],
59
+ message: body['ResultMessage'],
60
+ score: body['Score'],
61
+ limit_score: body['LimitScore']
62
+ )
63
+ rescue StandardError
64
+ raise Bigid::Bgcheck::InternalError
65
+ end
66
+ end
67
+ end
68
+ end
@@ -0,0 +1,16 @@
1
+ module Bigid
2
+ module Bgcheck
3
+ class Result
4
+ attr_accessor :approved, :ticket_id, :code, :message, :score, :limit_score
5
+
6
+ def initialize(approved:, ticket_id:, code:, message:, score:, limit_score:)
7
+ @approved = approved
8
+ @ticket_id = ticket_id
9
+ @code = code
10
+ @message = message
11
+ @score = score
12
+ @limit_score = limit_score
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,6 @@
1
+ module Bigid
2
+ module Bgcheck
3
+ class ServerError < BaseError
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,12 @@
1
+ module Bigid
2
+ module Bgcheck
3
+ # When updating version, keep in mind Semantic Versioning http://semver.org/
4
+ # TL;DR; (Major.Minor.Patch)
5
+ # Releases before 1.0.0 are in active development and can change anytime
6
+ # 1.0.0 and up is indication and declaration of a stable public API
7
+ # Major - Incremented for incompatible changes with previous release (or big enough new features)
8
+ # Minor - Incremented for new backwards-compatible features + deprecations
9
+ # Patch - Incremented for backwards-compatible bug fixes
10
+ VERSION = "0.1.0"
11
+ end
12
+ end
@@ -0,0 +1,62 @@
1
+ require 'faraday'
2
+ require 'i18n'
3
+ require 'json'
4
+
5
+ require 'bigid/bgcheck/version'
6
+
7
+ require 'bigid/bgcheck/integration/multipart_flat'
8
+ require 'bigid/bgcheck/integration/response'
9
+ require 'bigid/bgcheck/integration/request'
10
+ require 'bigid/bgcheck/integration/connection'
11
+
12
+ require 'bigid/bgcheck/auth/connection'
13
+ require 'bigid/bgcheck/auth/authentication'
14
+ require 'bigid/bgcheck/auth/authenticated_resource'
15
+ require 'bigid/bgcheck/auth/authenticated_connection'
16
+
17
+ require 'bigid/bgcheck/base_error'
18
+ require 'bigid/bgcheck/bad_request_error'
19
+ require 'bigid/bgcheck/document_not_supported_error'
20
+ require 'bigid/bgcheck/internal_error'
21
+ require 'bigid/bgcheck/invalid_credentials_error'
22
+ require 'bigid/bgcheck/no_info_error'
23
+ require 'bigid/bgcheck/result'
24
+ require 'bigid/bgcheck/server_error'
25
+
26
+ require 'bigid/bgcheck/request'
27
+
28
+ module Bigid
29
+ module Bgcheck
30
+ BASE_URL = 'https://bigid.bigdatacorp.com.br'
31
+ AUTH_ENDPOINT = 'https://accesstoken.bigdatacorp.com.br'
32
+ SRV_ENDPOINT = 'backgroundcheck'
33
+ TOKEN_EXPIRATION = 60000.freeze
34
+ # Welcome to your new gem!
35
+ # This file is the entry point for your gem. Logic can go in this file, though most gems are big enough to warrant splitting
36
+ # functionality out into multiple files namespaced under a module named the same as a gem.
37
+ # Create those files as lib/bigid_bgcheck/foo as BigidBgcheck::Foo remembering to require each file at the top of this file,
38
+ # unless you want your users to manually require a specific file (for example opt-in feature in a distinct file)
39
+ class << self
40
+ attr_accessor :configuration
41
+ end
42
+
43
+ def self.configure
44
+ self.configuration ||= Configuration.new
45
+
46
+ yield(configuration)
47
+ end
48
+
49
+ class Configuration
50
+ attr_accessor :username, :password
51
+
52
+ def initialize
53
+ @username = ''
54
+ @password = ''
55
+ end
56
+ end
57
+
58
+ I18n.load_path << Dir[File.expand_path("config/locales") + "/*.yml"]
59
+ I18n.config.available_locales = :en
60
+ I18n.default_locale = :en
61
+ end
62
+ end
@@ -0,0 +1,7 @@
1
+ require 'spec_helper'
2
+
3
+ describe Bigid::Bgcheck do
4
+ it 'should have some tests' do
5
+ flunk "Please write some tests"
6
+ end
7
+ end
@@ -0,0 +1,24 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ begin
4
+ Bundler.setup(:default, :development, :test)
5
+ rescue Bundler::BundlerError => e
6
+ $stderr.puts e.message
7
+ $stderr.puts "Run `bundle install` to install missing gems"
8
+ exit e.status_code
9
+ end
10
+
11
+ require 'simplecov'
12
+ SimpleCov.start do
13
+ add_filter 'spec'
14
+ end
15
+
16
+ require "minitest/autorun"
17
+ require "minitest/spec"
18
+ begin
19
+ require "minitest/pride"
20
+ rescue LoadError
21
+ # Continue, but without colors
22
+ end
23
+
24
+ # minitest/mock # Uncomment me to use minitest mocks
metadata ADDED
@@ -0,0 +1,170 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bigid_bgcheck
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Danilo Carolino
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2021-04-17 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: faraday
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
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: i18n
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: json
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: bundler
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: 1.2.0
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: 1.2.0
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: 10.0.0
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: 10.0.0
83
+ - !ruby/object:Gem::Dependency
84
+ name: minitest
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
+ description: A library to use BigData Corps background check features
112
+ email:
113
+ - danilo.carolino@qflash.com.br
114
+ executables: []
115
+ extensions: []
116
+ extra_rdoc_files: []
117
+ files:
118
+ - CHANGELOG.md
119
+ - LICENSE.txt
120
+ - README.rdoc
121
+ - Rakefile
122
+ - lib/bigid/bgcheck/auth/authenticated_connection.rb
123
+ - lib/bigid/bgcheck/auth/authenticated_resource.rb
124
+ - lib/bigid/bgcheck/auth/authentication.rb
125
+ - lib/bigid/bgcheck/auth/connection.rb
126
+ - lib/bigid/bgcheck/bad_request_error.rb
127
+ - lib/bigid/bgcheck/base_error.rb
128
+ - lib/bigid/bgcheck/document_not_supported_error.rb
129
+ - lib/bigid/bgcheck/integration/connection.rb
130
+ - lib/bigid/bgcheck/integration/multipart_flat.rb
131
+ - lib/bigid/bgcheck/integration/request.rb
132
+ - lib/bigid/bgcheck/integration/response.rb
133
+ - lib/bigid/bgcheck/internal_error.rb
134
+ - lib/bigid/bgcheck/invalid_credentials_error.rb
135
+ - lib/bigid/bgcheck/invalid_document_value_error.rb
136
+ - lib/bigid/bgcheck/no_info_error.rb
137
+ - lib/bigid/bgcheck/not_permission_error.rb
138
+ - lib/bigid/bgcheck/request.rb
139
+ - lib/bigid/bgcheck/result.rb
140
+ - lib/bigid/bgcheck/server_error.rb
141
+ - lib/bigid/bgcheck/version.rb
142
+ - lib/bigid_bgcheck.rb
143
+ - spec/bigid_bgcheck_spec.rb
144
+ - spec/spec_helper.rb
145
+ homepage: https://github.com/Quasar-Flash/bigid-bgcheck-ruby
146
+ licenses:
147
+ - MIT
148
+ metadata: {}
149
+ post_install_message:
150
+ rdoc_options: []
151
+ require_paths:
152
+ - lib
153
+ required_ruby_version: !ruby/object:Gem::Requirement
154
+ requirements:
155
+ - - ">="
156
+ - !ruby/object:Gem::Version
157
+ version: '0'
158
+ required_rubygems_version: !ruby/object:Gem::Requirement
159
+ requirements:
160
+ - - ">="
161
+ - !ruby/object:Gem::Version
162
+ version: '0'
163
+ requirements: []
164
+ rubygems_version: 3.1.4
165
+ signing_key:
166
+ specification_version: 4
167
+ summary: Bigid Background Check Library
168
+ test_files:
169
+ - spec/bigid_bgcheck_spec.rb
170
+ - spec/spec_helper.rb