credova 0.1.7 → 0.1.8

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: c6def1751d664ad20feed546ae2d5573bb1a3155d6baeb43342bd2e4205a7a78
4
- data.tar.gz: bfee41159a3021857829a50e007bbba298b49c1b9138cb8aee2e0b7ae087172e
3
+ metadata.gz: 6160ea02df46ba9763039d59ba0e830751de8a6f1690502ae2517cd088da7aa2
4
+ data.tar.gz: 1dbbac5c77a59dc687e214ee1e26c7f39056963c6de3da34f02e633f07808aba
5
5
  SHA512:
6
- metadata.gz: c2ca07bb361904ea34388e520b9ec17ca189d109ea4c199adb3b6927fb5949effae5e831821da21a3bab41e3a87445d988349700d1d5a18d68ccf28293adaad4
7
- data.tar.gz: 2ac7fdc9b902253c07d706ee14200c2e578d58d97ab988fcd495573dfad178e7df0bc57e3368549b2960f7209427d2a5d89a1c2866aac4f17d5706595a97b8da
6
+ metadata.gz: b4bc3b0004e98909c525d200e92729e13f2287b2f18b3f5311d01e1235a304194c33f07502013c95cf2f578df7b8ae1d12658a3c9efc67bf8a95be2889f26326
7
+ data.tar.gz: c356d3d1a6f1f946399e2bb03b7dd18034f02bc2cb5c55fd498e13a78fbdc15ffc9699a9a37d72dba888d089e6ef37e6bfe11c2e45874b23f6c7dcc674a66a75
@@ -29,8 +29,6 @@ module Credova
29
29
  uri = URI(request.path)
30
30
  request.body = data.is_a?(Hash) ? data.to_json : data
31
31
 
32
- puts "\n-\nREQUEST_BODY_DATA: #{request.body.inspect}\n-\n"
33
-
34
32
  response = Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http|
35
33
  http.request(request)
36
34
  end
@@ -31,7 +31,7 @@ module Credova
31
31
  end
32
32
 
33
33
  def create(application_data, callback_url = nil)
34
- requires!(application_data, CREATE_ATTRS[:required])
34
+ requires!(application_data, *CREATE_ATTRS[:required])
35
35
 
36
36
  endpoint = ENDPOINTS[:create]
37
37
  headers = [
@@ -59,7 +59,7 @@ module Credova
59
59
  end
60
60
 
61
61
  def set_delivery_information(public_id, delivery_data)
62
- requires!(delivery_data, SET_DELIVERY_INFORMATION_ATTRS[:required])
62
+ requires!(delivery_data, *SET_DELIVERY_INFORMATION_ATTRS[:required])
63
63
 
64
64
  endpoint = ENDPOINTS[:set_delivery_information] % public_id
65
65
  headers = [
@@ -5,7 +5,11 @@ module Credova
5
5
 
6
6
  include Credova::API
7
7
 
8
- REQUIRED_CREATE_ATTRS = %i( license_number expiration address_one city state zip )
8
+ CREATE_ATTRS = {
9
+ permitted: %i( license_number expiration address address_2 city state zip ).freeze,
10
+ required: %i( license_number expiration address city state zip ).freeze,
11
+ }
12
+
9
13
  ENDPOINTS = {
10
14
  create: "federallicense".freeze,
11
15
  upload_document: "federallicense/%s/uploadfile".freeze,
@@ -15,17 +19,19 @@ module Credova
15
19
  @client = client
16
20
  end
17
21
 
18
- def create(options = {})
19
- requires!(options, REQUIRED_CREATE_ATTRS)
22
+ def create(ffl_data)
23
+ requires!(options, *REQUIRED_CREATE_ATTRS)
20
24
 
25
+ ffl_data[:expiration] = ffl_data[:expiration].strftime('%Y/%m/%d')
21
26
  endpoint = ENDPOINTS[:create]
22
- data = format_data_for_create(options)
23
27
  headers = [
24
28
  *auth_header(@client.access_token),
25
29
  *content_type_header('application/json'),
26
30
  ].to_h
27
31
 
28
- post_request(endpoint, data, headers)
32
+ standardize_body_data!(ffl_data, CREATE_ATTRS[:permitted])
33
+
34
+ post_request(endpoint, ffl_data, headers)
29
35
  end
30
36
 
31
37
  def upload_document(ffl_public_id, ffl_document_url)
@@ -39,19 +45,5 @@ module Credova
39
45
  post_request(endpoint, data, headers)
40
46
  end
41
47
 
42
- private
43
-
44
- def format_data_for_create(data)
45
- {
46
- licenseNumber: data[:license_number],
47
- expiration: data[:expiration].strftime('%Y/%m/%d'),
48
- address: data[:address_one],
49
- address2: data[:address_two],
50
- city: data[:city],
51
- state: data[:state],
52
- zip: data[:zip],
53
- }
54
- end
55
-
56
48
  end
57
49
  end
@@ -1,3 +1,3 @@
1
1
  module Credova
2
- VERSION = "0.1.7"
2
+ VERSION = "0.1.8"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: credova
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeffrey Dill
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-01-09 00:00:00.000000000 Z
11
+ date: 2019-01-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler