kycaid 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1999bd4b60fb80929a0b45fe53360df63853a7ec4197adb6d1547452034e11f3
4
- data.tar.gz: a14c29feb77760e76d99507d2cc7ff065c6234741e183a2455004dc483ae6318
3
+ metadata.gz: da8fada89d402ccef3f8a699ae8157e0d6ac358a0c32f3993ebe7f13d2062465
4
+ data.tar.gz: 94443b7c2be1c0b8a5031cfb0396a5210079f2d7400c98ba72c06f03d84dd652
5
5
  SHA512:
6
- metadata.gz: 1f7268f0a5cb09cb0c3aaa6a582bf0ba24660d45a241a9bcafa66e065a8d9c7c47b7ccb864bb3835b45891a3862d02c6dec405f31a70eebe9b748c6c96f55d6d
7
- data.tar.gz: ef8b4e33822ebfccdb5b28600df1b635a4ab7ec211f0b7fee740fe0af31d0dba35094403d0e971114582c6552d65337f19a106028612993500c1bcac140480e9
6
+ metadata.gz: cb539a0e082e0075dfb21fc1db85a5eed6226e6cc0e6d5f421cc374fb6cf334d2810b1c8cd0c163eeb1751e79f377392f656d487a0653337f2910045f5612f96
7
+ data.tar.gz: 808a95eec8cac009c55e30f4f9f1f151d26c772ecac71628eac24196a7437802a3e005bea572af71ff36ed9a696ef15de653ae68713d61d379c474cc69261fb3
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- kycaid (1.0.1)
4
+ kycaid (1.0.2)
5
5
  faraday
6
6
  json
7
7
 
@@ -15,11 +15,15 @@ GEM
15
15
  safe_yaml (~> 1.0.0)
16
16
  diff-lcs (1.3)
17
17
  docile (1.3.2)
18
- faraday (1.3.0)
18
+ faraday (1.4.1)
19
+ faraday-excon (~> 1.1)
19
20
  faraday-net_http (~> 1.0)
21
+ faraday-net_http_persistent (~> 1.1)
20
22
  multipart-post (>= 1.2, < 3)
21
- ruby2_keywords
23
+ ruby2_keywords (>= 0.0.4)
24
+ faraday-excon (1.1.0)
22
25
  faraday-net_http (1.0.1)
26
+ faraday-net_http_persistent (1.1.0)
23
27
  hashdiff (1.0.1)
24
28
  json (2.3.0)
25
29
  method_source (1.0.0)
@@ -21,19 +21,8 @@ module KYCAID
21
21
  #
22
22
  # Returns Response object, conatining +document_id+.
23
23
  def self.create(params)
24
- front_file_id = unless params[:front_file].nil?
25
- front_file = file_params(params[:front_file])
26
- return front_file unless front_file.errors.nil?
27
-
28
- front_file.file_id
29
- end
30
-
31
- back_file_id = unless params[:back_file].nil?
32
- back_file = file_params(params[:back_file])
33
- return back_file unless back_file.errors.nil?
34
-
35
- back_file.file_id
36
- end
24
+ front_file_id = create_file(params[:front_file])
25
+ back_file_id = create_file(params[:back_file])
37
26
 
38
27
  protected_params = params.slice(:applicant_id, :type, :document_number, :issue_date, :expiry_date)
39
28
  .merge(front_side_id: front_file_id, back_side_id: back_file_id)
@@ -46,11 +35,18 @@ module KYCAID
46
35
  # * +:document_number+ - see #create
47
36
  # * +:issue_date+ - see #create
48
37
  # * +:expiry_date+ - see #create
49
- # * +:front_side_id+ - new File ID to associate document with.
50
- # * +:back_side_id+ - new File ID to associate document with.
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
+ #
51
43
  # Returns Response object, conatining +document_id+.
52
44
  def self.update(params)
53
- protected_params = params.slice(:type, :document_number, :issue_date, :expiry_date, :front_side_id, :back_side_id)
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)
54
50
  respond(patch("/documents/#{params[:id]}", protected_params))
55
51
  end
56
52
 
@@ -63,5 +59,14 @@ module KYCAID
63
59
  original_filename: params[:file_name]
64
60
  )
65
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
66
71
  end
67
72
  end
@@ -1,3 +1,3 @@
1
1
  module KYCAID
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kycaid
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Openware
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-04-14 00:00:00.000000000 Z
11
+ date: 2021-04-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler