fastbound-ruby 1.1.1 → 1.1.5
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e1ddd372f0736a3153b3f7e3004b77edc4f4a472856a4b47bde3dd888e653546
|
4
|
+
data.tar.gz: 87ee6aba545cae8ddb3748b1190910a9542f313bb3f2e04466690e549716e85c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 489f34169de6fb6865505271bc54a5f2ff1beb3c81a9123084da897165f7bed229c77d96298af9d6cc8c0f9b712b43cb8c4edcabe360023237a00ac2c26dc4e9
|
7
|
+
data.tar.gz: f99ec40017fc51153d88ab9799511a74f432ebdbcda5b38e70845d92d1ee9d11c188aff309b48f709324718feccb287318abf0aa04d59e23f821a62f1c6ceeef
|
@@ -82,12 +82,11 @@ module FastBound
|
|
82
82
|
def create_and_commit(acquisition_data, item_data, contact_data)
|
83
83
|
requires!(acquisition_data, *CREATE_AND_EDIT_ATTRS[:required])
|
84
84
|
requires!(item_data, *Item::CREATE_AND_EDIT_ATTRS[:required])
|
85
|
-
requires!(contact_data, *Contact::CREATE_AND_EDIT_ATTRS[:required])
|
86
85
|
|
87
86
|
endpoint = ENDPOINTS[:create_and_commit]
|
88
87
|
acquisition_data = standardize_body_data(acquisition_data, CREATE_AND_EDIT_ATTRS[:permitted])
|
89
88
|
item_data = standardize_body_data(item_data, Item::CREATE_AND_EDIT_ATTRS[:permitted])
|
90
|
-
contact_data = standardize_body_data(contact_data, Contact::CREATE_AND_EDIT_ATTRS
|
89
|
+
contact_data = standardize_body_data(contact_data, Contact::CREATE_AND_EDIT_ATTRS)
|
91
90
|
request_data = acquisition_data.merge(
|
92
91
|
contact: contact_data,
|
93
92
|
items: [item_data]
|
data/lib/fastbound-ruby/api.rb
CHANGED
@@ -62,11 +62,12 @@ module FastBound
|
|
62
62
|
|
63
63
|
def process_request(request)
|
64
64
|
uri = URI(request.path)
|
65
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
65
66
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
67
|
+
http.use_ssl = true
|
68
|
+
http.set_debug_output($stdout) if FastBound.config.full_debug?
|
69
|
+
|
70
|
+
response = http.start { |_http| _http.request(request) }
|
70
71
|
|
71
72
|
FastBound::Response.new(response)
|
72
73
|
end
|
@@ -5,14 +5,11 @@ module FastBound
|
|
5
5
|
|
6
6
|
include FastBound::API
|
7
7
|
|
8
|
-
CREATE_AND_EDIT_ATTRS =
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
).freeze,
|
14
|
-
required: %i( ffl_number ffl_expires premise_address_1 premise_city premise_state premise_zip_code ).freeze
|
15
|
-
}
|
8
|
+
CREATE_AND_EDIT_ATTRS = %i(
|
9
|
+
external_id ffl_number ffl_expires lookup_ffl license_name trade_name sotein sot_class business_type
|
10
|
+
organization_name first_name middle_name last_name premise_address_1 premise_address_2 premise_city
|
11
|
+
premise_county premise_state premise_zip_code premise_country phone_number fax email_address
|
12
|
+
).freeze
|
16
13
|
|
17
14
|
CREATE_AND_EDIT_LICENSE_ATTRS = {
|
18
15
|
permitted: %i( type number expiration copy_on_file ).freeze,
|
@@ -49,17 +46,15 @@ module FastBound
|
|
49
46
|
end
|
50
47
|
|
51
48
|
def create(contact_data)
|
52
|
-
requires!(contact_data, *CREATE_AND_EDIT_ATTRS[:required])
|
53
|
-
|
54
49
|
endpoint = ENDPOINTS[:create]
|
55
|
-
contact_data = standardize_body_data(contact_data, CREATE_AND_EDIT_ATTRS
|
50
|
+
contact_data = standardize_body_data(contact_data, CREATE_AND_EDIT_ATTRS)
|
56
51
|
|
57
52
|
post_request(@client, endpoint, contact_data)
|
58
53
|
end
|
59
54
|
|
60
55
|
def edit(contact_id, contact_data)
|
61
56
|
endpoint = ENDPOINTS[:edit] % contact_id
|
62
|
-
contact_data = standardize_body_data(contact_data, CREATE_AND_EDIT_ATTRS
|
57
|
+
contact_data = standardize_body_data(contact_data, CREATE_AND_EDIT_ATTRS)
|
63
58
|
|
64
59
|
put_request(@client, endpoint, contact_data)
|
65
60
|
end
|
@@ -152,19 +152,18 @@ module FastBound
|
|
152
152
|
post_request(@client, endpoint, commit_data)
|
153
153
|
end
|
154
154
|
|
155
|
-
def create_and_commit(disposition_data, items_data, contact_data, commit_data = {})
|
156
|
-
requires!(contact_data, *Contact::CREATE_AND_EDIT_ATTRS[:required])
|
155
|
+
def create_and_commit(disposition_data, items_data, contact_data = {}, commit_data = {})
|
157
156
|
items_data.each { |item| requires!(item, :id) }
|
158
157
|
|
159
158
|
endpoint = ENDPOINTS[:create_and_commit]
|
160
159
|
disposition_data = standardize_body_data(disposition_data, EDIT_AND_CREATE_COMMIT_ATTRS)
|
161
160
|
items_data = items_data.map { |item| standardize_body_data(item, ITEM_ATTRS[:add]) }
|
162
|
-
contact_data = standardize_body_data(contact_data, Contact::CREATE_AND_EDIT_ATTRS
|
161
|
+
contact_data = standardize_body_data(contact_data, Contact::CREATE_AND_EDIT_ATTRS)
|
163
162
|
request_data = disposition_data.merge(
|
164
163
|
contact: contact_data,
|
165
164
|
items: items_data,
|
166
165
|
manufacturingChanges: commit_data
|
167
|
-
)
|
166
|
+
).compact
|
168
167
|
|
169
168
|
post_request(@client, endpoint, request_data)
|
170
169
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastbound-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeffrey Dill
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-02-
|
11
|
+
date: 2022-02-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|