fastbound-ruby 1.0.1 → 1.1.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: 6d2531751f10fb98c84aa798ec9bcd781e2964027412418bdffcab48f86e81ed
4
- data.tar.gz: 48bed4354d29205924c2d4ac773b2f1558f6836cb3323dbdadc3bdbc9a44035b
3
+ metadata.gz: 50df0cbbde2a5bddc6bf840dca3ea5e3427b513cde3a4536676b801916615246
4
+ data.tar.gz: 72d930597d1867d1583d7e7b80b3f6c273184c1966421aa2814b9cbb9421b850
5
5
  SHA512:
6
- metadata.gz: 331d7226825389d572af61e23068d4b51c859c0baf289aecf4629e2a6833918e630eff84953a55d265709ba259dc5ca0109014d635fa9404ed69fa1707116d9f
7
- data.tar.gz: c45ecf70ba039bcdbd5a29ec896b44ad598bfd12d81cec4b906df5a945b0b4a186c907829d5236a9948a262b5535e683061fc2559ad740de36cdc10e09c942b4
6
+ metadata.gz: 27e08924d1543b95a0a28926160dee348fd9468c18563dd53ff9aa6bcd6298501108b8db5c38aeadf21e8adb7d32967e3dbbfb68e62bb1fd53ed008049ab7132
7
+ data.tar.gz: 9cfd6874dd9de4964031202086c9ec857402056544e365de6eddccb2b29b22c6166214ec7bd83effb4e88ba7047d341c99d386f0b5a4646e1eebb915559a644d
@@ -40,7 +40,7 @@ module FastBound
40
40
  end
41
41
 
42
42
  def create(acquisition_data)
43
- requires!(acquisition_data, CREATE_AND_EDIT_ATTRS[:required])
43
+ requires!(acquisition_data, *CREATE_AND_EDIT_ATTRS[:required])
44
44
 
45
45
  endpoint = ENDPOINTS[:create]
46
46
  acquisition_data = standardize_body_data(acquisition_data, CREATE_AND_EDIT_ATTRS[:permitted])
@@ -80,9 +80,9 @@ module FastBound
80
80
  end
81
81
 
82
82
  def create_and_commit(acquisition_data, item_data, contact_data)
83
- requires!(acquisition_data, CREATE_AND_EDIT_ATTRS[:required])
84
- requires!(item_data, Item::CREATE_AND_EDIT_ATTRS[:required])
85
- requires!(contact_data, Contact::CREATE_AND_EDIT_ATTRS[:required])
83
+ requires!(acquisition_data, *CREATE_AND_EDIT_ATTRS[:required])
84
+ requires!(item_data, *Item::CREATE_AND_EDIT_ATTRS[:required])
85
+ requires!(contact_data, *Contact::CREATE_AND_EDIT_ATTRS[:required])
86
86
 
87
87
  endpoint = ENDPOINTS[:create_and_commit]
88
88
  acquisition_data = standardize_body_data(acquisition_data, CREATE_AND_EDIT_ATTRS[:permitted])
@@ -97,7 +97,7 @@ module FastBound
97
97
  end
98
98
 
99
99
  def create_item(acquisition_id, item_data)
100
- requires!(item_data, Item::CREATE_AND_EDIT_ATTRS[:required])
100
+ requires!(item_data, *Item::CREATE_AND_EDIT_ATTRS[:required])
101
101
 
102
102
  endpoint = ENDPOINTS[:create_item] % acquisition_id
103
103
  item_data = standardize_body_data(item_data, Item::CREATE_AND_EDIT_ATTRS[:permitted])
@@ -62,10 +62,11 @@ 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, use_ssl: true)
65
66
 
66
- response = Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http|
67
- http.request(request)
68
- end
67
+ http.set_debug_output($stdout) if FastBound.config.full_debug?
68
+
69
+ response = http.start { |_http| _http.request(request) }
69
70
 
70
71
  FastBound::Response.new(response)
71
72
  end
@@ -49,7 +49,7 @@ module FastBound
49
49
  end
50
50
 
51
51
  def create(contact_data)
52
- requires!(contact_data, CREATE_AND_EDIT_ATTRS[:required])
52
+ requires!(contact_data, *CREATE_AND_EDIT_ATTRS[:required])
53
53
 
54
54
  endpoint = ENDPOINTS[:create]
55
55
  contact_data = standardize_body_data(contact_data, CREATE_AND_EDIT_ATTRS[:permitted])
@@ -83,7 +83,7 @@ module FastBound
83
83
  end
84
84
 
85
85
  def merge(merge_data)
86
- requires!(merge_data, MERGE_ATTRS[:required])
86
+ requires!(merge_data, *MERGE_ATTRS[:required])
87
87
 
88
88
  endpoint = ENDPOINTS[:merge]
89
89
  merge_data = standardize_body_data(merge_data, MERGE_ATTRS[:permitted])
@@ -92,7 +92,7 @@ module FastBound
92
92
  end
93
93
 
94
94
  def create_license(contact_id, license_data)
95
- requires!(license_data, CREATE_AND_EDIT_LICENSE_ATTRS[:required])
95
+ requires!(license_data, *CREATE_AND_EDIT_LICENSE_ATTRS[:required])
96
96
 
97
97
  endpoint = ENDPOINTS[:create_license] % contact_id
98
98
  license_data = standardize_body_data(license_data, CREATE_AND_EDIT_LICENSE_ATTRS[:permitted])
@@ -89,7 +89,7 @@ module FastBound
89
89
  end
90
90
 
91
91
  def create(disposition_data)
92
- requires!(disposition_data, CREATE_ATTRS[:required])
92
+ requires!(disposition_data, *CREATE_ATTRS[:required])
93
93
 
94
94
  endpoint = ENDPOINTS[:create]
95
95
  disposition_data = standardize_body_data(disposition_data, CREATE_ATTRS[:permitted])
@@ -98,7 +98,7 @@ module FastBound
98
98
  end
99
99
 
100
100
  def create_as_nfa(disposition_data)
101
- requires!(disposition_data, CREATE_AS_NFA_ATTRS[:required])
101
+ requires!(disposition_data, *CREATE_AS_NFA_ATTRS[:required])
102
102
 
103
103
  endpoint = ENDPOINTS[:create_as_nfa]
104
104
  disposition_data = standardize_body_data(disposition_data, CREATE_AS_NFA_ATTRS[:permitted])
@@ -153,7 +153,7 @@ module FastBound
153
153
  end
154
154
 
155
155
  def create_and_commit(disposition_data, items_data, contact_data, commit_data = {})
156
- requires!(contact_data, Contact::CREATE_AND_EDIT_ATTRS[:required])
156
+ requires!(contact_data, *Contact::CREATE_AND_EDIT_ATTRS[:required])
157
157
  items_data.each { |item| requires!(item, :id) }
158
158
 
159
159
  endpoint = ENDPOINTS[:create_and_commit]
@@ -19,7 +19,7 @@ module FastBound
19
19
  }
20
20
 
21
21
  ENDPOINTS = {
22
- list: "items".freeze,
22
+ list: "items?%s".freeze,
23
23
  fetch: "items/%s".freeze,
24
24
  edit: "items/%s".freeze,
25
25
  delete: "items/%s".freeze,
@@ -1,3 +1,3 @@
1
1
  module FastBound
2
- VERSION = "1.0.1"
2
+ VERSION = "1.1.2"
3
3
  end
@@ -23,7 +23,7 @@ module FastBound
23
23
  end
24
24
 
25
25
  def create(webhook_data)
26
- requires!(webhook_data, CREATE_AND_EDIT_ATTRS[:required])
26
+ requires!(webhook_data, *CREATE_AND_EDIT_ATTRS[:required])
27
27
 
28
28
  endpoint = ENDPOINTS[:create]
29
29
  webhook_data = standardize_body_data(webhook_data, CREATE_AND_EDIT_ATTRS[:permitted])
@@ -15,4 +15,25 @@ require 'fastbound-ruby/smart_list'
15
15
  require 'fastbound-ruby/webhook'
16
16
 
17
17
  module FastBound
18
+ class << self
19
+ attr_accessor :config
20
+ end
21
+
22
+ def self.config
23
+ @config ||= Configuration.new
24
+ end
25
+
26
+ def self.configure
27
+ yield(config)
28
+ end
29
+
30
+ class Configuration
31
+ attr_accessor :full_debug
32
+
33
+ alias :full_debug? :full_debug
34
+
35
+ def initialize
36
+ @full_debug ||= false
37
+ end
38
+ end
18
39
  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.0.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeffrey Dill
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-11-30 00:00:00.000000000 Z
11
+ date: 2022-02-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler