xhash_client 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +59 -0
- data/Gemfile +12 -0
- data/Gemfile.lock +74 -0
- data/LICENSE +21 -0
- data/README.md +2 -0
- data/Rakefile +7 -0
- data/lib/xhash/client/api_client.rb +27 -0
- data/lib/xhash/client/json_api.rb +48 -0
- data/lib/xhash/database_lookup.rb +28 -0
- data/lib/xhash/document_types.rb +15 -0
- data/lib/xhash/error.rb +15 -0
- data/lib/xhash/error_messages.rb +8 -0
- data/lib/xhash/formatters.rb +9 -0
- data/lib/xhash/general.rb +63 -0
- data/lib/xhash/ocr.rb +124 -0
- data/lib/xhash/sat.rb +18 -0
- data/lib/xhash/structs/curp.rb +15 -0
- data/lib/xhash/structs/customer.rb +49 -0
- data/lib/xhash/structs/identification.rb +30 -0
- data/lib/xhash/structs/proof_of_address.rb +15 -0
- data/lib/xhash/structs/rfc.rb +3 -0
- data/lib/xhash/version.rb +3 -0
- data/spec/files/ife_front.png +0 -0
- data/spec/files/ife_reverse.jpg +0 -0
- data/spec/files/telmex.png +0 -0
- data/spec/spec_helper.rb +9 -0
- data/spec/xhash/database_lookup_spec.rb +95 -0
- data/spec/xhash/general_spec.rb +208 -0
- data/spec/xhash/ocr_spec.rb +365 -0
- data/spec/xhash/sat_spec.rb +36 -0
- data/spec/xhash_ruby_spec.rb +11 -0
- data/xhash_client.gemspec +28 -0
- metadata +43 -2
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Xhash::SAT do
|
4
|
+
describe '.get_rfc' do
|
5
|
+
it 'successfully gets rfc by user data' do
|
6
|
+
stub_request(:post, 'https://xhash.dev/api/sat/get-rfc').to_return(
|
7
|
+
body:
|
8
|
+
JSON.dump(
|
9
|
+
{
|
10
|
+
name: 'Bernardo',
|
11
|
+
last_name: 'Suarez',
|
12
|
+
mothers_last_name: 'sepulveda',
|
13
|
+
birth_date: '1994-03-19',
|
14
|
+
rfc: 'SUSB940319BA5'
|
15
|
+
}
|
16
|
+
),
|
17
|
+
status: 200
|
18
|
+
)
|
19
|
+
|
20
|
+
rfc =
|
21
|
+
Xhash::SAT.get_rfc(
|
22
|
+
name: 'Bernardo',
|
23
|
+
last_name: 'Suarez',
|
24
|
+
mothers_last_name: 'sepulveda',
|
25
|
+
birth_date: '1994-03-19'
|
26
|
+
)
|
27
|
+
|
28
|
+
expect(rfc).to be_a(Xhash::RFC)
|
29
|
+
expect(rfc.name).to eq('Bernardo')
|
30
|
+
expect(rfc.last_name).to eq('Suarez')
|
31
|
+
expect(rfc.mothers_last_name).to eq('sepulveda')
|
32
|
+
expect(rfc.birth_date).to eq('1994-03-19')
|
33
|
+
expect(rfc.rfc).to eq('SUSB940319BA5')
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
$:.push File.expand_path("lib", __dir__)
|
2
|
+
|
3
|
+
# Maintain your gem's version:
|
4
|
+
require "xhash/version"
|
5
|
+
|
6
|
+
# Describe your gem and declare its dependencies:
|
7
|
+
Gem::Specification.new do |spec|
|
8
|
+
spec.name = "xhash_client"
|
9
|
+
spec.version = Xhash::VERSION
|
10
|
+
spec.date = '2019-10-10'
|
11
|
+
spec.description = "Ruby Bindings for Xhash API"
|
12
|
+
spec.summary = "Ruby library built for Xhash API"
|
13
|
+
spec.files = `git ls-files`.split($/)
|
14
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
15
|
+
spec.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
16
|
+
spec.authors = ["Yellowme"]
|
17
|
+
spec.email = 'hola@yellowme.mx'
|
18
|
+
spec.homepage = 'https://rubygems.org/gems/xhash-ruby'
|
19
|
+
spec.license = 'MIT'
|
20
|
+
|
21
|
+
spec.add_dependency 'httparty', "~> 0.16.0"
|
22
|
+
spec.add_dependency "json", "~> 2.0"
|
23
|
+
spec.add_dependency 'activesupport', "~> 5.2"
|
24
|
+
|
25
|
+
spec.add_development_dependency "rspec", "~> 3.8"
|
26
|
+
spec.add_development_dependency "webmock", "~> 3.7"
|
27
|
+
spec.add_development_dependency "simplecov", "~> 0.17"
|
28
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xhash_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yellowme
|
@@ -100,7 +100,39 @@ executables: []
|
|
100
100
|
extensions: []
|
101
101
|
extra_rdoc_files: []
|
102
102
|
files:
|
103
|
+
- ".gitignore"
|
104
|
+
- Gemfile
|
105
|
+
- Gemfile.lock
|
106
|
+
- LICENSE
|
107
|
+
- README.md
|
108
|
+
- Rakefile
|
103
109
|
- lib/xhash.rb
|
110
|
+
- lib/xhash/client/api_client.rb
|
111
|
+
- lib/xhash/client/json_api.rb
|
112
|
+
- lib/xhash/database_lookup.rb
|
113
|
+
- lib/xhash/document_types.rb
|
114
|
+
- lib/xhash/error.rb
|
115
|
+
- lib/xhash/error_messages.rb
|
116
|
+
- lib/xhash/formatters.rb
|
117
|
+
- lib/xhash/general.rb
|
118
|
+
- lib/xhash/ocr.rb
|
119
|
+
- lib/xhash/sat.rb
|
120
|
+
- lib/xhash/structs/curp.rb
|
121
|
+
- lib/xhash/structs/customer.rb
|
122
|
+
- lib/xhash/structs/identification.rb
|
123
|
+
- lib/xhash/structs/proof_of_address.rb
|
124
|
+
- lib/xhash/structs/rfc.rb
|
125
|
+
- lib/xhash/version.rb
|
126
|
+
- spec/files/ife_front.png
|
127
|
+
- spec/files/ife_reverse.jpg
|
128
|
+
- spec/files/telmex.png
|
129
|
+
- spec/spec_helper.rb
|
130
|
+
- spec/xhash/database_lookup_spec.rb
|
131
|
+
- spec/xhash/general_spec.rb
|
132
|
+
- spec/xhash/ocr_spec.rb
|
133
|
+
- spec/xhash/sat_spec.rb
|
134
|
+
- spec/xhash_ruby_spec.rb
|
135
|
+
- xhash_client.gemspec
|
104
136
|
homepage: https://rubygems.org/gems/xhash-ruby
|
105
137
|
licenses:
|
106
138
|
- MIT
|
@@ -125,4 +157,13 @@ rubygems_version: 2.7.6
|
|
125
157
|
signing_key:
|
126
158
|
specification_version: 4
|
127
159
|
summary: Ruby library built for Xhash API
|
128
|
-
test_files:
|
160
|
+
test_files:
|
161
|
+
- spec/files/ife_front.png
|
162
|
+
- spec/files/ife_reverse.jpg
|
163
|
+
- spec/files/telmex.png
|
164
|
+
- spec/spec_helper.rb
|
165
|
+
- spec/xhash/database_lookup_spec.rb
|
166
|
+
- spec/xhash/general_spec.rb
|
167
|
+
- spec/xhash/ocr_spec.rb
|
168
|
+
- spec/xhash/sat_spec.rb
|
169
|
+
- spec/xhash_ruby_spec.rb
|