ledger_sync 2.6.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/gem-workflow.yml +10 -8
- data/.gitignore +3 -1
- data/.rubocop.yml +7 -1
- data/Gemfile +2 -0
- data/Gemfile.lock +89 -64
- data/documentation/generators/generator.rb +1 -1
- data/documentation/generators/reference/generator.rb +1 -3
- data/documentation/generators/template.rb +1 -1
- data/ledger_sync.gemspec +19 -20
- data/lib/ledger_sync/deserializer.rb +4 -4
- data/lib/ledger_sync/error/ledger_errors.rb +2 -8
- data/lib/ledger_sync/error/operation_errors.rb +1 -0
- data/lib/ledger_sync/error/resource_errors.rb +2 -2
- data/lib/ledger_sync/ledger_configuration_store.rb +4 -4
- data/lib/ledger_sync/ledgers/client.rb +3 -3
- data/lib/ledger_sync/ledgers/mixins/infer_serializer_mixin.rb +12 -24
- data/lib/ledger_sync/ledgers/mixins/infer_validation_contract_mixin.rb +3 -5
- data/lib/ledger_sync/resource.rb +5 -5
- data/lib/ledger_sync/resource_attribute/dirty_mixin.rb +2 -2
- data/lib/ledger_sync/serialization/mixin.rb +1 -1
- data/lib/ledger_sync/serializer.rb +4 -4
- data/lib/ledger_sync/test/support/factory_bot.rb +2 -2
- data/lib/ledger_sync/test/support/qa/ledger_support_setup.rb +2 -2
- data/lib/ledger_sync/test/support/record_collection.rb +1 -1
- data/lib/ledger_sync/type/reference_many.rb +1 -1
- data/lib/ledger_sync/type/value_mixin.rb +1 -1
- data/lib/ledger_sync/util/dotenv_updator.rb +1 -1
- data/lib/ledger_sync/util/resource_converter/attribute_set.rb +1 -1
- data/lib/ledger_sync/util/resource_converter.rb +8 -8
- data/lib/ledger_sync/util/resources_builder.rb +23 -25
- data/lib/ledger_sync/util/signer.rb +4 -2
- data/lib/ledger_sync/util/string_helpers.rb +1 -1
- data/lib/ledger_sync/version.rb +2 -2
- metadata +10 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b63db8eefe2b7ef796c61c32d875751b2a3959086f01ae9f1706e0248a0a8875
|
4
|
+
data.tar.gz: 4cb44ba51344f600e60a3f10e33ef3d4d4bad7d1530d2935a732e33f0d63a75d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9039f8c4f393591c4a048f89c30344bf83329580b753edfbc65c2ad256f0e4c4c6f25656de6aec20261686157754c5353c8a86329c62b4092ce025e5d3bccbd4
|
7
|
+
data.tar.gz: 5038845e3146b964d104686c11e89744245f7c708f8811f813e222ac485dedb1dc4304757d642346c48b158b02a7afc6173f5ce7b7e13767dce3cd4dec391a0b
|
@@ -9,28 +9,30 @@ jobs:
|
|
9
9
|
strategy:
|
10
10
|
matrix:
|
11
11
|
os: [ubuntu-latest]
|
12
|
-
ruby-version: ['2.
|
12
|
+
ruby-version: ['3.1.6', '3.2.6', '3.3.6']
|
13
13
|
runs-on: ${{ matrix.os }}
|
14
14
|
steps:
|
15
15
|
- uses: actions/checkout@v3
|
16
16
|
with:
|
17
17
|
persist-credentials: false
|
18
18
|
fetch-depth: 0
|
19
|
-
- name: Ruby Setup
|
19
|
+
- name: Ruby Setup
|
20
20
|
uses: ruby/setup-ruby@v1
|
21
21
|
with:
|
22
22
|
ruby-version: ${{ matrix.ruby-version }}
|
23
23
|
bundler-cache: true
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
24
|
+
- name: Bundle install
|
25
|
+
run: |
|
26
|
+
gem install bundler
|
27
|
+
bundle config path vendor/bundle
|
28
|
+
bundle install --jobs 4 --retry 3
|
29
|
+
- name: Rubocop
|
30
|
+
run: bundle exec rubocop
|
29
31
|
rspec:
|
30
32
|
strategy:
|
31
33
|
matrix:
|
32
34
|
os: [ubuntu-latest]
|
33
|
-
ruby-version: ['2.
|
35
|
+
ruby-version: ['3.1.6', '3.2.6', '3.3.6']
|
34
36
|
runs-on: ${{ matrix.os }}
|
35
37
|
steps:
|
36
38
|
- uses: actions/checkout@v3
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
@@ -4,9 +4,12 @@ AllCops:
|
|
4
4
|
Exclude:
|
5
5
|
- "documentation/site/_plugins/**/*"
|
6
6
|
- "vendor/**/*"
|
7
|
-
TargetRubyVersion:
|
7
|
+
TargetRubyVersion: 3.1
|
8
8
|
NewCops: enable
|
9
9
|
|
10
|
+
Gemspec/DevelopmentDependencies:
|
11
|
+
Enabled: False
|
12
|
+
|
10
13
|
Layout/LineLength:
|
11
14
|
Enabled: True
|
12
15
|
Max: 120
|
@@ -41,6 +44,9 @@ Lint/RaiseException:
|
|
41
44
|
Lint/StructNewOverride:
|
42
45
|
Enabled: True
|
43
46
|
|
47
|
+
Naming/VariableNumber:
|
48
|
+
Enabled: False
|
49
|
+
|
44
50
|
Style/AccessorGrouping:
|
45
51
|
Enabled: True
|
46
52
|
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
ledger_sync (
|
4
|
+
ledger_sync (3.0.0)
|
5
5
|
activemodel
|
6
6
|
dotenv
|
7
7
|
dry-schema
|
@@ -21,46 +21,61 @@ PATH
|
|
21
21
|
GEM
|
22
22
|
remote: https://rubygems.org/
|
23
23
|
specs:
|
24
|
-
activemodel (7.
|
25
|
-
activesupport (= 7.
|
26
|
-
activesupport (7.
|
24
|
+
activemodel (7.1.5)
|
25
|
+
activesupport (= 7.1.5)
|
26
|
+
activesupport (7.1.5)
|
27
|
+
base64
|
28
|
+
benchmark (>= 0.3)
|
29
|
+
bigdecimal
|
27
30
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
31
|
+
connection_pool (>= 2.2.5)
|
32
|
+
drb
|
28
33
|
i18n (>= 1.6, < 2)
|
34
|
+
logger (>= 1.4.2)
|
29
35
|
minitest (>= 5.1)
|
36
|
+
mutex_m
|
37
|
+
securerandom (>= 0.3)
|
30
38
|
tzinfo (~> 2.0)
|
31
|
-
addressable (2.8.
|
32
|
-
public_suffix (>= 2.0.2, <
|
39
|
+
addressable (2.8.7)
|
40
|
+
public_suffix (>= 2.0.2, < 7.0)
|
33
41
|
ast (2.4.2)
|
34
42
|
awesome_print (1.9.2)
|
43
|
+
base64 (0.2.0)
|
44
|
+
benchmark (0.4.0)
|
45
|
+
bigdecimal (3.1.8)
|
35
46
|
bump (0.9.0)
|
36
47
|
byebug (11.1.3)
|
37
48
|
childprocess (4.1.0)
|
38
49
|
climate_control (1.2.0)
|
39
50
|
colorize (1.1.0)
|
40
|
-
concurrent-ruby (1.
|
41
|
-
|
51
|
+
concurrent-ruby (1.3.4)
|
52
|
+
connection_pool (2.4.1)
|
53
|
+
coveralls_reborn (0.28.0)
|
42
54
|
simplecov (~> 0.22.0)
|
43
55
|
term-ansicolor (~> 1.7)
|
44
56
|
thor (~> 1.2)
|
45
57
|
tins (~> 1.32)
|
46
|
-
crack (0.
|
58
|
+
crack (1.0.0)
|
59
|
+
bigdecimal
|
47
60
|
rexml
|
48
|
-
diff-lcs (1.5.
|
49
|
-
docile (1.4.
|
50
|
-
dotenv (
|
51
|
-
|
61
|
+
diff-lcs (1.5.1)
|
62
|
+
docile (1.4.1)
|
63
|
+
dotenv (3.1.4)
|
64
|
+
drb (2.2.1)
|
65
|
+
dry-configurable (1.2.0)
|
52
66
|
dry-core (~> 1.0, < 2)
|
53
67
|
zeitwerk (~> 2.6)
|
54
|
-
dry-core (1.0.
|
68
|
+
dry-core (1.0.2)
|
55
69
|
concurrent-ruby (~> 1.0)
|
70
|
+
logger
|
56
71
|
zeitwerk (~> 2.6)
|
57
|
-
dry-inflector (1.
|
72
|
+
dry-inflector (1.1.0)
|
58
73
|
dry-initializer (3.1.1)
|
59
74
|
dry-logic (1.5.0)
|
60
75
|
concurrent-ruby (~> 1.0)
|
61
76
|
dry-core (~> 1.0, < 2)
|
62
77
|
zeitwerk (~> 2.6)
|
63
|
-
dry-schema (1.13.
|
78
|
+
dry-schema (1.13.4)
|
64
79
|
concurrent-ruby (~> 1.0)
|
65
80
|
dry-configurable (~> 1.0, >= 1.0.1)
|
66
81
|
dry-core (~> 1.0, < 2)
|
@@ -68,7 +83,8 @@ GEM
|
|
68
83
|
dry-logic (>= 1.4, < 2)
|
69
84
|
dry-types (>= 1.7, < 2)
|
70
85
|
zeitwerk (~> 2.6)
|
71
|
-
dry-types (1.7.
|
86
|
+
dry-types (1.7.2)
|
87
|
+
bigdecimal (~> 3.0)
|
72
88
|
concurrent-ruby (~> 1.0)
|
73
89
|
dry-core (~> 1.0)
|
74
90
|
dry-inflector (~> 1.0)
|
@@ -82,7 +98,7 @@ GEM
|
|
82
98
|
zeitwerk (~> 2.6)
|
83
99
|
factory_bot (6.1.0)
|
84
100
|
activesupport (>= 5.0.0)
|
85
|
-
faraday (1.10.
|
101
|
+
faraday (1.10.4)
|
86
102
|
faraday-em_http (~> 1.0)
|
87
103
|
faraday-em_synchrony (~> 1.0)
|
88
104
|
faraday-excon (~> 1.1)
|
@@ -102,94 +118,103 @@ GEM
|
|
102
118
|
faraday-httpclient (1.0.1)
|
103
119
|
faraday-multipart (1.0.4)
|
104
120
|
multipart-post (~> 2)
|
105
|
-
faraday-net_http (1.0.
|
121
|
+
faraday-net_http (1.0.2)
|
106
122
|
faraday-net_http_persistent (1.2.0)
|
107
123
|
faraday-patron (1.0.0)
|
108
124
|
faraday-rack (1.0.0)
|
109
125
|
faraday-retry (1.0.3)
|
110
|
-
faraday_middleware (1.2.
|
126
|
+
faraday_middleware (1.2.1)
|
111
127
|
faraday (~> 1.0)
|
112
128
|
fingerprintable (1.2.1)
|
113
129
|
colorize
|
114
|
-
hashdiff (1.
|
115
|
-
i18n (1.14.
|
130
|
+
hashdiff (1.1.2)
|
131
|
+
i18n (1.14.6)
|
116
132
|
concurrent-ruby (~> 1.0)
|
117
133
|
iniparse (1.5.0)
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
134
|
+
json (2.9.1)
|
135
|
+
language_server-protocol (3.17.0.3)
|
136
|
+
logger (1.6.1)
|
137
|
+
mini_portile2 (2.8.8)
|
138
|
+
minitest (5.25.2)
|
139
|
+
multipart-post (2.4.1)
|
140
|
+
mutex_m (0.3.0)
|
141
|
+
nokogiri (1.16.7)
|
122
142
|
mini_portile2 (~> 2.8.2)
|
123
143
|
racc (~> 1.4)
|
124
|
-
nokogiri (1.
|
144
|
+
nokogiri (1.16.7-x86_64-darwin)
|
125
145
|
racc (~> 1.4)
|
126
|
-
openssl (3.
|
146
|
+
openssl (3.2.0)
|
127
147
|
overcommit (0.57.0)
|
128
148
|
childprocess (>= 0.6.3, < 5)
|
129
149
|
iniparse (~> 1.4)
|
130
|
-
parallel (1.
|
131
|
-
parser (3.
|
150
|
+
parallel (1.26.3)
|
151
|
+
parser (3.3.6.0)
|
132
152
|
ast (~> 2.4.1)
|
133
153
|
racc
|
134
154
|
pd_ruby (0.2.3)
|
135
155
|
colorize
|
136
|
-
public_suffix (
|
137
|
-
racc (1.
|
138
|
-
rack (3.
|
156
|
+
public_suffix (6.0.1)
|
157
|
+
racc (1.8.1)
|
158
|
+
rack (3.1.8)
|
139
159
|
rainbow (3.1.1)
|
140
|
-
rake (13.
|
141
|
-
regexp_parser (2.
|
160
|
+
rake (13.2.1)
|
161
|
+
regexp_parser (2.9.3)
|
142
162
|
resonad (1.4.0)
|
143
|
-
rexml (3.
|
144
|
-
rspec (3.
|
145
|
-
rspec-core (~> 3.
|
146
|
-
rspec-expectations (~> 3.
|
147
|
-
rspec-mocks (~> 3.
|
148
|
-
rspec-core (3.
|
149
|
-
rspec-support (~> 3.
|
150
|
-
rspec-expectations (3.
|
163
|
+
rexml (3.4.0)
|
164
|
+
rspec (3.13.0)
|
165
|
+
rspec-core (~> 3.13.0)
|
166
|
+
rspec-expectations (~> 3.13.0)
|
167
|
+
rspec-mocks (~> 3.13.0)
|
168
|
+
rspec-core (3.13.2)
|
169
|
+
rspec-support (~> 3.13.0)
|
170
|
+
rspec-expectations (3.13.3)
|
151
171
|
diff-lcs (>= 1.2.0, < 2.0)
|
152
|
-
rspec-support (~> 3.
|
153
|
-
rspec-mocks (3.
|
172
|
+
rspec-support (~> 3.13.0)
|
173
|
+
rspec-mocks (3.13.2)
|
154
174
|
diff-lcs (>= 1.2.0, < 2.0)
|
155
|
-
rspec-support (~> 3.
|
156
|
-
rspec-support (3.
|
157
|
-
rubocop (1.
|
175
|
+
rspec-support (~> 3.13.0)
|
176
|
+
rspec-support (3.13.1)
|
177
|
+
rubocop (1.69.2)
|
178
|
+
json (~> 2.3)
|
179
|
+
language_server-protocol (>= 3.17.0)
|
158
180
|
parallel (~> 1.10)
|
159
|
-
parser (>=
|
181
|
+
parser (>= 3.3.0.2)
|
160
182
|
rainbow (>= 2.2.2, < 4.0)
|
161
|
-
regexp_parser (>=
|
162
|
-
|
163
|
-
rubocop-ast (>= 0.6.0)
|
183
|
+
regexp_parser (>= 2.9.3, < 3.0)
|
184
|
+
rubocop-ast (>= 1.36.2, < 2.0)
|
164
185
|
ruby-progressbar (~> 1.7)
|
165
|
-
unicode-display_width (>=
|
166
|
-
rubocop-ast (1.
|
167
|
-
parser (>= 3.
|
186
|
+
unicode-display_width (>= 2.4.0, < 4.0)
|
187
|
+
rubocop-ast (1.37.0)
|
188
|
+
parser (>= 3.3.1.0)
|
168
189
|
ruby-progressbar (1.13.0)
|
169
190
|
ruby2_keywords (0.0.5)
|
191
|
+
securerandom (0.3.2)
|
170
192
|
simplecov (0.22.0)
|
171
193
|
docile (~> 1.1)
|
172
194
|
simplecov-html (~> 0.11)
|
173
195
|
simplecov_json_formatter (~> 0.1)
|
174
|
-
simplecov-html (0.
|
196
|
+
simplecov-html (0.13.1)
|
175
197
|
simplecov-lcov (0.8.0)
|
176
198
|
simplecov_json_formatter (0.1.4)
|
177
199
|
simply_serializable (1.5.1)
|
178
200
|
fingerprintable (>= 1.2.1)
|
179
201
|
sync (0.5.0)
|
180
|
-
term-ansicolor (1.
|
202
|
+
term-ansicolor (1.11.2)
|
181
203
|
tins (~> 1.0)
|
182
|
-
thor (1.
|
183
|
-
tins (1.
|
204
|
+
thor (1.3.2)
|
205
|
+
tins (1.37.0)
|
206
|
+
bigdecimal
|
184
207
|
sync
|
185
208
|
tzinfo (2.0.6)
|
186
209
|
concurrent-ruby (~> 1.0)
|
187
|
-
unicode-display_width (1.
|
188
|
-
|
210
|
+
unicode-display_width (3.1.2)
|
211
|
+
unicode-emoji (~> 4.0, >= 4.0.4)
|
212
|
+
unicode-emoji (4.0.4)
|
213
|
+
webmock (3.24.0)
|
189
214
|
addressable (>= 2.8.0)
|
190
215
|
crack (>= 0.3.2)
|
191
216
|
hashdiff (>= 0.4.0, < 2.0.0)
|
192
|
-
zeitwerk (2.6.
|
217
|
+
zeitwerk (2.6.18)
|
193
218
|
|
194
219
|
PLATFORMS
|
195
220
|
ruby
|
@@ -207,10 +232,10 @@ DEPENDENCIES
|
|
207
232
|
overcommit (~> 0.57.0)
|
208
233
|
rake (~> 13.0)
|
209
234
|
rspec (~> 3.2)
|
210
|
-
rubocop (
|
235
|
+
rubocop (~> 1.62)
|
211
236
|
simplecov
|
212
237
|
simplecov-lcov
|
213
238
|
webmock
|
214
239
|
|
215
240
|
BUNDLED WITH
|
216
|
-
2.2
|
241
|
+
2.6.2
|
@@ -15,7 +15,7 @@ module Docs
|
|
15
15
|
def write
|
16
16
|
template = ERB.new(File.read(template_path), trim_mode: '-')
|
17
17
|
yellow "Generating template: #{template_path}"
|
18
|
-
File.
|
18
|
+
File.write(destination_path, template.result_with_hash(data))
|
19
19
|
green "Wrote to destination: #{destination_path}"
|
20
20
|
end
|
21
21
|
end
|
data/ledger_sync.gemspec
CHANGED
@@ -8,17 +8,15 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.name = 'ledger_sync'
|
9
9
|
spec.version = LedgerSync.version
|
10
10
|
|
11
|
-
spec.required_ruby_version = '>=
|
11
|
+
spec.required_ruby_version = '>= 3.1'
|
12
12
|
|
13
13
|
# spec.required_rubygems_version = Gem::Requirement.new('>= 0') if spec.respond_to? :required_rubygems_version=
|
14
14
|
spec.authors = ['Ryan Jackson']
|
15
|
-
spec.
|
16
|
-
spec.description = 'LedgerSync is a simple library that allows you to sync common objects to popular accounting '\
|
15
|
+
spec.description = 'LedgerSync is a simple library that allows you to sync common objects to popular accounting ' \
|
17
16
|
'software like QuickBooks Online, Xero, NetSuite, etc.'
|
18
17
|
spec.email = ['ryanwjackson@gmail.com']
|
19
18
|
spec.homepage = 'https://github.com/LedgerSync/ledger_sync'
|
20
19
|
spec.licenses = ['MIT']
|
21
|
-
spec.rubygems_version = '3.0.3'
|
22
20
|
spec.summary = 'Sync common objects to accounting software.'
|
23
21
|
|
24
22
|
# Specify which files should be added to the gem when it is released.
|
@@ -40,23 +38,24 @@ Gem::Specification.new do |spec|
|
|
40
38
|
spec.add_development_dependency('overcommit', '~> 0.57.0')
|
41
39
|
spec.add_development_dependency('rake', '~> 13.0')
|
42
40
|
spec.add_development_dependency('rspec', '~> 3.2')
|
43
|
-
spec.add_development_dependency('rubocop', '1.
|
41
|
+
spec.add_development_dependency('rubocop', '~> 1.62')
|
44
42
|
spec.add_development_dependency('simplecov')
|
45
43
|
spec.add_development_dependency('simplecov-lcov')
|
46
44
|
spec.add_development_dependency('webmock', '>= 0')
|
47
|
-
spec.
|
48
|
-
spec.
|
49
|
-
spec.
|
50
|
-
spec.
|
51
|
-
spec.
|
52
|
-
spec.
|
53
|
-
spec.
|
54
|
-
spec.
|
55
|
-
spec.
|
56
|
-
spec.
|
57
|
-
spec.
|
58
|
-
spec.
|
59
|
-
spec.
|
60
|
-
spec.
|
61
|
-
spec.
|
45
|
+
spec.add_dependency('activemodel', '>= 0')
|
46
|
+
spec.add_dependency('dotenv')
|
47
|
+
spec.add_dependency('dry-schema')
|
48
|
+
spec.add_dependency('dry-validation')
|
49
|
+
spec.add_dependency('faraday', '>= 0')
|
50
|
+
spec.add_dependency('faraday-detailed_logger', '>= 0')
|
51
|
+
spec.add_dependency('faraday_middleware', '>= 0')
|
52
|
+
spec.add_dependency('fingerprintable', '>= 1.2.1')
|
53
|
+
spec.add_dependency('nokogiri', '>= 0')
|
54
|
+
spec.add_dependency('openssl', '> 2.2.0')
|
55
|
+
spec.add_dependency('pd_ruby', '>= 0')
|
56
|
+
spec.add_dependency('rack', '>= 2.2.3')
|
57
|
+
spec.add_dependency('rainbow', '~> 3.0')
|
58
|
+
spec.add_dependency('resonad', '>= 0')
|
59
|
+
spec.add_dependency('simply_serializable', '>= 1.5.1')
|
60
|
+
spec.metadata['rubygems_mfa_required'] = 'true'
|
62
61
|
end
|
@@ -71,7 +71,7 @@ module LedgerSync
|
|
71
71
|
@attributes ||= Serialization::DeserializerAttributeSet.new(serializer_class: self)
|
72
72
|
end
|
73
73
|
|
74
|
-
def self.references_one(resource_attribute, args = {}, &
|
74
|
+
def self.references_one(resource_attribute, args = {}, &)
|
75
75
|
attribute(
|
76
76
|
resource_attribute,
|
77
77
|
{
|
@@ -79,11 +79,11 @@ module LedgerSync
|
|
79
79
|
deserializer: deserializer_from(resource_attribute, args)
|
80
80
|
)
|
81
81
|
}.merge(args),
|
82
|
-
&
|
82
|
+
&
|
83
83
|
)
|
84
84
|
end
|
85
85
|
|
86
|
-
def self.references_many(resource_attribute, args = {}, &
|
86
|
+
def self.references_many(resource_attribute, args = {}, &)
|
87
87
|
attribute(
|
88
88
|
resource_attribute,
|
89
89
|
{
|
@@ -91,7 +91,7 @@ module LedgerSync
|
|
91
91
|
deserializer: deserializer_from(resource_attribute, args)
|
92
92
|
)
|
93
93
|
}.merge(args),
|
94
|
-
&
|
94
|
+
&
|
95
95
|
)
|
96
96
|
end
|
97
97
|
|
@@ -46,11 +46,7 @@ module LedgerSync
|
|
46
46
|
client_class: client.class
|
47
47
|
).rate_limiting_wait_in_seconds
|
48
48
|
|
49
|
-
super
|
50
|
-
client: client,
|
51
|
-
message: message,
|
52
|
-
response: response
|
53
|
-
)
|
49
|
+
super
|
54
50
|
end
|
55
51
|
end
|
56
52
|
|
@@ -62,9 +58,7 @@ module LedgerSync
|
|
62
58
|
|
63
59
|
super(
|
64
60
|
*args,
|
65
|
-
**
|
66
|
-
message: "Unknown URL format for #{resource.class}"
|
67
|
-
}.merge(keywords)
|
61
|
+
message: "Unknown URL format for #{resource.class}", **keywords
|
68
62
|
)
|
69
63
|
end
|
70
64
|
end
|
@@ -15,6 +15,7 @@ module LedgerSync
|
|
15
15
|
class DuplicateLedgerResourceError < self; end
|
16
16
|
class NotFoundError < self; end
|
17
17
|
class LedgerValidationError < self; end
|
18
|
+
|
18
19
|
class PerformedOperationError < self
|
19
20
|
def initialize(operation:, message: nil, response: nil)
|
20
21
|
message ||= 'Operation has already been performed. Please check the result.'
|
@@ -22,8 +22,8 @@ module LedgerSync
|
|
22
22
|
when LedgerSync::ResourceAttribute::Reference::Many
|
23
23
|
invalid_classes = value.reject { |e| e.is_a?(type_resource_class) }.map(&:class)
|
24
24
|
if type_resource_class.is_a?(Array)
|
25
|
-
"an array of one or more of the following: #{type_resource_class.name}. Given array containing: "\
|
26
|
-
|
25
|
+
"an array of one or more of the following: #{type_resource_class.name}. Given array containing: " \
|
26
|
+
"#{invalid_classes.join(', ')}"
|
27
27
|
else
|
28
28
|
"an array of #{type_resource_class.name}. Given array containing: #{invalid_classes.join(', ')}"
|
29
29
|
end
|
@@ -32,12 +32,12 @@ module LedgerSync
|
|
32
32
|
@base_module_to_config_mapping.fetch(base_module, nil)
|
33
33
|
end
|
34
34
|
|
35
|
-
def each(&
|
36
|
-
configs.each(&
|
35
|
+
def each(&)
|
36
|
+
configs.each(&)
|
37
37
|
end
|
38
38
|
|
39
|
-
def find(&
|
40
|
-
configs.values.find(&
|
39
|
+
def find(&)
|
40
|
+
configs.values.find(&)
|
41
41
|
end
|
42
42
|
|
43
43
|
def register_ledger(ledger_config:)
|
@@ -30,9 +30,9 @@ module LedgerSync
|
|
30
30
|
def ledger_attributes_to_save
|
31
31
|
return {} if self.class.ledger_attributes_to_save.nil?
|
32
32
|
|
33
|
-
|
33
|
+
self.class.ledger_attributes_to_save.to_h do |attribute|
|
34
34
|
[attribute, send(attribute)]
|
35
|
-
end
|
35
|
+
end
|
36
36
|
end
|
37
37
|
|
38
38
|
def operation_for(args = {})
|
@@ -98,7 +98,7 @@ module LedgerSync
|
|
98
98
|
end
|
99
99
|
|
100
100
|
def resource_from_ledger_type(type:, converter: nil)
|
101
|
-
converter ||= proc
|
101
|
+
converter ||= proc(&:underscore)
|
102
102
|
ledger_resource_type_overrides.invert[converter.call(type).to_sym] || resources[converter.call(type).to_sym]
|
103
103
|
end
|
104
104
|
|
@@ -9,45 +9,33 @@ module LedgerSync
|
|
9
9
|
module InferSerializerMixin
|
10
10
|
module ClassMethods
|
11
11
|
def inferred_deserializer_class
|
12
|
-
@inferred_deserializer_class ||=
|
13
|
-
|
14
|
-
|
15
|
-
)
|
16
|
-
end
|
12
|
+
@inferred_deserializer_class ||= inferred_config.base_module.const_get(
|
13
|
+
inferred_deserializer_class_name
|
14
|
+
)
|
17
15
|
end
|
18
16
|
|
19
17
|
def inferred_deserializer_class_name
|
20
|
-
@inferred_deserializer_class_name ||=
|
21
|
-
"#{inferred_resource_class}::Deserializer"
|
22
|
-
end
|
18
|
+
@inferred_deserializer_class_name ||= "#{inferred_resource_class}::Deserializer"
|
23
19
|
end
|
24
20
|
|
25
21
|
def inferred_searcher_deserializer_class
|
26
|
-
@inferred_searcher_deserializer_class ||=
|
27
|
-
|
28
|
-
|
29
|
-
)
|
30
|
-
end
|
22
|
+
@inferred_searcher_deserializer_class ||= inferred_config.base_module.const_get(
|
23
|
+
inferred_searcher_deserializer_class_name
|
24
|
+
)
|
31
25
|
end
|
32
26
|
|
33
27
|
def inferred_searcher_deserializer_class_name
|
34
|
-
@inferred_searcher_deserializer_class_name ||=
|
35
|
-
"#{inferred_resource_class}::SearcherDeserializer"
|
36
|
-
end
|
28
|
+
@inferred_searcher_deserializer_class_name ||= "#{inferred_resource_class}::SearcherDeserializer"
|
37
29
|
end
|
38
30
|
|
39
31
|
def inferred_serializer_class
|
40
|
-
@inferred_serializer_class ||=
|
41
|
-
|
42
|
-
|
43
|
-
)
|
44
|
-
end
|
32
|
+
@inferred_serializer_class ||= inferred_config.base_module.const_get(
|
33
|
+
inferred_serializer_class_name
|
34
|
+
)
|
45
35
|
end
|
46
36
|
|
47
37
|
def inferred_serializer_class_name
|
48
|
-
@inferred_serializer_class_name ||=
|
49
|
-
"#{inferred_resource_class}::Serializer"
|
50
|
-
end
|
38
|
+
@inferred_serializer_class_name ||= "#{inferred_resource_class}::Serializer"
|
51
39
|
end
|
52
40
|
end
|
53
41
|
|
@@ -6,11 +6,9 @@ module LedgerSync
|
|
6
6
|
module InferValidationContractMixin
|
7
7
|
module ClassMethods
|
8
8
|
def inferred_validation_contract_class
|
9
|
-
@inferred_validation_contract_class ||=
|
10
|
-
|
11
|
-
|
12
|
-
)
|
13
|
-
end
|
9
|
+
@inferred_validation_contract_class ||= const_get(
|
10
|
+
inferred_validation_contract_class_name
|
11
|
+
)
|
14
12
|
end
|
15
13
|
|
16
14
|
def inferred_validation_contract_class_name
|
data/lib/ledger_sync/resource.rb
CHANGED
@@ -44,13 +44,13 @@ module LedgerSync
|
|
44
44
|
end
|
45
45
|
|
46
46
|
def changed?
|
47
|
-
super || resource_attributes.references_many.
|
47
|
+
super || resource_attributes.references_many.any?(&:changed?)
|
48
48
|
end
|
49
49
|
|
50
50
|
def changes
|
51
|
-
super.merge(
|
52
|
-
|
53
|
-
|
51
|
+
super.merge(resource_attributes.references_many.map do |ref|
|
52
|
+
[ref.name, ref.changes['value']] if ref.changed?
|
53
|
+
end.compact.to_h)
|
54
54
|
end
|
55
55
|
|
56
56
|
def class_from_resource_type(obj)
|
@@ -62,7 +62,7 @@ module LedgerSync
|
|
62
62
|
end
|
63
63
|
|
64
64
|
def self.inherited(subclass)
|
65
|
-
resource_attributes.
|
65
|
+
resource_attributes.each_value do |resource_attribute|
|
66
66
|
subclass._add_resource_attribute(resource_attribute)
|
67
67
|
end
|
68
68
|
|
@@ -40,12 +40,12 @@ module LedgerSync
|
|
40
40
|
end
|
41
41
|
|
42
42
|
def dirty_attributes_to_h
|
43
|
-
|
43
|
+
self.class.dirty_attributes.keys.to_h do |k|
|
44
44
|
[
|
45
45
|
k,
|
46
46
|
public_send(k)
|
47
47
|
]
|
48
|
-
end
|
48
|
+
end
|
49
49
|
end
|
50
50
|
|
51
51
|
# Normally you would just call `changes_applied`, but because we
|
@@ -60,7 +60,7 @@ module LedgerSync
|
|
60
60
|
@attributes ||= Serialization::SerializerAttributeSet.new(serializer_class: self)
|
61
61
|
end
|
62
62
|
|
63
|
-
def self.references_one(hash_attribute, args = {}, &
|
63
|
+
def self.references_one(hash_attribute, args = {}, &)
|
64
64
|
attribute(
|
65
65
|
hash_attribute,
|
66
66
|
{
|
@@ -68,11 +68,11 @@ module LedgerSync
|
|
68
68
|
serializer: serializer_from(hash_attribute, args)
|
69
69
|
)
|
70
70
|
}.merge(args),
|
71
|
-
&
|
71
|
+
&
|
72
72
|
)
|
73
73
|
end
|
74
74
|
|
75
|
-
def self.references_many(hash_attribute, args = {}, &
|
75
|
+
def self.references_many(hash_attribute, args = {}, &)
|
76
76
|
attribute(
|
77
77
|
hash_attribute,
|
78
78
|
{
|
@@ -80,7 +80,7 @@ module LedgerSync
|
|
80
80
|
serializer: serializer_from(hash_attribute, args)
|
81
81
|
)
|
82
82
|
}.merge(args),
|
83
|
-
&
|
83
|
+
&
|
84
84
|
)
|
85
85
|
end
|
86
86
|
|
@@ -65,7 +65,7 @@ end
|
|
65
65
|
def generate_resource_factories
|
66
66
|
LedgerSync.ledgers.each do |ledger_key, ledger|
|
67
67
|
ledger.client_class.resources.each do |resource_key, resource_class|
|
68
|
-
factory_key = "#{ledger_key}_#{resource_key}"
|
68
|
+
factory_key = :"#{ledger_key}_#{resource_key}"
|
69
69
|
next if FactoryBot.factories.registered?(factory_key)
|
70
70
|
|
71
71
|
register_factory(prefix: ledger_key, resource_class: resource_class)
|
@@ -101,7 +101,7 @@ module FactoryBot
|
|
101
101
|
def self.test_run_id(*appends, **keywords)
|
102
102
|
@test_run_id ||= rand_id(
|
103
103
|
*appends,
|
104
|
-
**keywords
|
104
|
+
**keywords, include_test_run_id: false
|
105
105
|
)
|
106
106
|
end
|
107
107
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
def setup_client_qa_support(*clients, keyed: false) # rubocop:disable Metrics/PerceivedComplexity
|
4
|
-
qa_clients =
|
4
|
+
qa_clients = clients.uniq.to_h do |client|
|
5
5
|
key = client.config.root_key
|
6
6
|
|
7
7
|
qa_support "#{key}_helpers"
|
@@ -14,7 +14,7 @@ def setup_client_qa_support(*clients, keyed: false) # rubocop:disable Metrics/Pe
|
|
14
14
|
key: key
|
15
15
|
}
|
16
16
|
]
|
17
|
-
end
|
17
|
+
end
|
18
18
|
|
19
19
|
RSpec.configure do |config|
|
20
20
|
qa_clients.each_value do |data|
|
@@ -29,7 +29,7 @@ module LedgerSync
|
|
29
29
|
Gem.find_files(File.join(dir, '*.json')).map do |file_path|
|
30
30
|
record = File.basename(file_path, '.json').to_sym
|
31
31
|
@records[record] = record_class.new(
|
32
|
-
hash: JSON.parse(File.
|
32
|
+
hash: JSON.parse(File.read(file_path)),
|
33
33
|
path: file_path,
|
34
34
|
record: record
|
35
35
|
)
|
@@ -35,7 +35,7 @@ module LedgerSync
|
|
35
35
|
def valid?(args = {})
|
36
36
|
value = args.fetch(:value)
|
37
37
|
return false unless value.is_a?(Array)
|
38
|
-
return true if (
|
38
|
+
return true if resource_classes.intersect?(value.map(&:class))
|
39
39
|
return true if value.is_a?(Array) && value.empty?
|
40
40
|
|
41
41
|
false
|
@@ -24,7 +24,7 @@ module LedgerSync
|
|
24
24
|
client_method = env_key.split(prefix).last.downcase
|
25
25
|
|
26
26
|
if line =~ /\A#{prefix}/ && to_save.key?(client_method)
|
27
|
-
env_value = ENV
|
27
|
+
env_value = ENV.fetch(env_key, nil)
|
28
28
|
new_value = to_save.delete(client_method)
|
29
29
|
tempfile.puts "#{env_key}=#{new_value}"
|
30
30
|
next if env_value == new_value.to_s
|
@@ -22,7 +22,7 @@ module LedgerSync
|
|
22
22
|
def add(attribute)
|
23
23
|
unless attribute.destination_attribute.nil?
|
24
24
|
if @attribute_keys.key?(attribute.destination_attribute.to_s)
|
25
|
-
raise "destination_attribute already defined for #{resource_converter_class.name}: "\
|
25
|
+
raise "destination_attribute already defined for #{resource_converter_class.name}: " \
|
26
26
|
"#{attribute.destination_attribute}"
|
27
27
|
end
|
28
28
|
|
@@ -54,15 +54,15 @@ module LedgerSync
|
|
54
54
|
)
|
55
55
|
end
|
56
56
|
|
57
|
-
def self.attribute(
|
58
|
-
_attribute(
|
57
|
+
def self.attribute(...)
|
58
|
+
_attribute(...)
|
59
59
|
end
|
60
60
|
|
61
61
|
def self.attributes
|
62
62
|
@attributes ||= ResourceConverter::AttributeSet.new(resource_converter_class: self)
|
63
63
|
end
|
64
64
|
|
65
|
-
def self._references(destination_attribute = nil, args = {}, &
|
65
|
+
def self._references(destination_attribute = nil, args = {}, &)
|
66
66
|
reference_type = args.fetch(:reference_type)
|
67
67
|
resource_converter = args.fetch(:resource_converter)
|
68
68
|
|
@@ -89,27 +89,27 @@ module LedgerSync
|
|
89
89
|
]
|
90
90
|
)
|
91
91
|
),
|
92
|
-
&
|
92
|
+
&
|
93
93
|
)
|
94
94
|
end
|
95
95
|
|
96
|
-
def self.references_one(destination_attribute = nil, args = {}, &
|
96
|
+
def self.references_one(destination_attribute = nil, args = {}, &)
|
97
97
|
_references(
|
98
98
|
destination_attribute,
|
99
99
|
{
|
100
100
|
reference_type: :one
|
101
101
|
}.merge(args),
|
102
|
-
&
|
102
|
+
&
|
103
103
|
)
|
104
104
|
end
|
105
105
|
|
106
|
-
def self.references_many(destination_attribute = nil, args = {}, &
|
106
|
+
def self.references_many(destination_attribute = nil, args = {}, &)
|
107
107
|
_references(
|
108
108
|
destination_attribute,
|
109
109
|
{
|
110
110
|
reference_type: :many
|
111
111
|
}.merge(args),
|
112
|
-
&
|
112
|
+
&
|
113
113
|
)
|
114
114
|
end
|
115
115
|
end
|
@@ -51,37 +51,35 @@ module LedgerSync
|
|
51
51
|
end
|
52
52
|
raise "#{type} is an invalid resource type" if resource_class.nil?
|
53
53
|
|
54
|
-
current_data =
|
55
|
-
|
56
|
-
k = k.to_sym
|
54
|
+
current_data = current_data.to_h do |k, v|
|
55
|
+
k = k.to_sym
|
57
56
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
57
|
+
attribute = resource_class.resource_attributes[k]
|
58
|
+
if attribute.nil? && !ignore_unrecognized_attributes
|
59
|
+
raise "Unrecognized attribute for #{resource_class.name}: #{k}"
|
60
|
+
end
|
62
61
|
|
63
|
-
|
64
|
-
|
62
|
+
v = if attribute.is_a?(ResourceAttribute::Reference::One)
|
63
|
+
resource_type = resource_type_by(external_id: current_data[k])
|
64
|
+
resource_or_build(
|
65
|
+
external_id: current_data[k],
|
66
|
+
type: resource_type
|
67
|
+
)
|
68
|
+
elsif attribute.is_a?(ResourceAttribute::Reference::Many)
|
69
|
+
current_data[k].map do |many_reference|
|
65
70
|
resource_or_build(
|
66
|
-
external_id:
|
67
|
-
type: resource_type
|
71
|
+
external_id: many_reference,
|
72
|
+
type: attribute.type.resource_class.resource_type
|
68
73
|
)
|
69
|
-
elsif attribute.is_a?(ResourceAttribute::Reference::Many)
|
70
|
-
current_data[k].map do |many_reference|
|
71
|
-
resource_or_build(
|
72
|
-
external_id: many_reference,
|
73
|
-
type: attribute.type.resource_class.resource_type
|
74
|
-
)
|
75
|
-
end
|
76
|
-
elsif cast
|
77
|
-
attribute.type.cast(value: v)
|
78
|
-
else
|
79
|
-
v
|
80
74
|
end
|
75
|
+
elsif cast
|
76
|
+
attribute.type.cast(value: v)
|
77
|
+
else
|
78
|
+
v
|
79
|
+
end
|
81
80
|
|
82
|
-
|
83
|
-
|
84
|
-
]
|
81
|
+
[k, v]
|
82
|
+
end
|
85
83
|
|
86
84
|
@all_resources[resource_key(external_id: external_id, type: type)] ||= resource_class.new(
|
87
85
|
external_id: external_id,
|
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'base64'
|
4
|
+
|
3
5
|
module LedgerSync
|
4
6
|
module Util
|
5
7
|
class Signer
|
@@ -25,11 +27,11 @@ module LedgerSync
|
|
25
27
|
end
|
26
28
|
|
27
29
|
def self.escape(str:)
|
28
|
-
CGI.escape(str).gsub(
|
30
|
+
CGI.escape(str).gsub('+', '%20')
|
29
31
|
end
|
30
32
|
|
31
33
|
def self.unescape(str:)
|
32
|
-
CGI.unescape(str.gsub(
|
34
|
+
CGI.unescape(str.gsub('%20', '+'))
|
33
35
|
end
|
34
36
|
end
|
35
37
|
end
|
data/lib/ledger_sync/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ledger_sync
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Jackson
|
8
|
-
autorequire:
|
9
8
|
bindir: exe
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 2024-12-26 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: awesome_print
|
@@ -154,16 +153,16 @@ dependencies:
|
|
154
153
|
name: rubocop
|
155
154
|
requirement: !ruby/object:Gem::Requirement
|
156
155
|
requirements:
|
157
|
-
- -
|
156
|
+
- - "~>"
|
158
157
|
- !ruby/object:Gem::Version
|
159
|
-
version: 1.
|
158
|
+
version: '1.62'
|
160
159
|
type: :development
|
161
160
|
prerelease: false
|
162
161
|
version_requirements: !ruby/object:Gem::Requirement
|
163
162
|
requirements:
|
164
|
-
- -
|
163
|
+
- - "~>"
|
165
164
|
- !ruby/object:Gem::Version
|
166
|
-
version: 1.
|
165
|
+
version: '1.62'
|
167
166
|
- !ruby/object:Gem::Dependency
|
168
167
|
name: simplecov
|
169
168
|
requirement: !ruby/object:Gem::Requirement
|
@@ -776,8 +775,8 @@ files:
|
|
776
775
|
homepage: https://github.com/LedgerSync/ledger_sync
|
777
776
|
licenses:
|
778
777
|
- MIT
|
779
|
-
metadata:
|
780
|
-
|
778
|
+
metadata:
|
779
|
+
rubygems_mfa_required: 'true'
|
781
780
|
rdoc_options: []
|
782
781
|
require_paths:
|
783
782
|
- lib
|
@@ -785,15 +784,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
785
784
|
requirements:
|
786
785
|
- - ">="
|
787
786
|
- !ruby/object:Gem::Version
|
788
|
-
version:
|
787
|
+
version: '3.1'
|
789
788
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
790
789
|
requirements:
|
791
790
|
- - ">="
|
792
791
|
- !ruby/object:Gem::Version
|
793
792
|
version: '0'
|
794
793
|
requirements: []
|
795
|
-
rubygems_version: 3.2
|
796
|
-
signing_key:
|
794
|
+
rubygems_version: 3.6.2
|
797
795
|
specification_version: 4
|
798
796
|
summary: Sync common objects to accounting software.
|
799
797
|
test_files: []
|