double_entry 1.0.1 → 2.0.0.beta1
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 +5 -5
- data/CHANGELOG.md +432 -0
- data/README.md +36 -9
- data/double_entry.gemspec +20 -48
- data/lib/active_record/locking_extensions.rb +3 -3
- data/lib/active_record/locking_extensions/log_subscriber.rb +1 -1
- data/lib/double_entry/account.rb +38 -45
- data/lib/double_entry/account_balance.rb +18 -1
- data/lib/double_entry/errors.rb +13 -13
- data/lib/double_entry/line.rb +3 -2
- data/lib/double_entry/reporting.rb +26 -38
- data/lib/double_entry/reporting/aggregate.rb +43 -23
- data/lib/double_entry/reporting/aggregate_array.rb +16 -13
- data/lib/double_entry/reporting/line_aggregate.rb +3 -2
- data/lib/double_entry/reporting/line_aggregate_filter.rb +8 -10
- data/lib/double_entry/reporting/line_metadata_filter.rb +33 -0
- data/lib/double_entry/transfer.rb +33 -27
- data/lib/double_entry/validation.rb +1 -0
- data/lib/double_entry/validation/account_fixer.rb +36 -0
- data/lib/double_entry/validation/line_check.rb +22 -40
- data/lib/double_entry/version.rb +1 -1
- data/lib/generators/double_entry/install/install_generator.rb +7 -1
- data/lib/generators/double_entry/install/templates/migration.rb +27 -25
- metadata +33 -243
- data/.gitignore +0 -32
- data/.rspec +0 -2
- data/.travis.yml +0 -29
- data/.yardopts +0 -2
- data/Gemfile +0 -2
- data/Rakefile +0 -15
- data/script/jack_hammer +0 -210
- data/script/setup.sh +0 -8
- data/spec/active_record/locking_extensions_spec.rb +0 -110
- data/spec/double_entry/account_balance_spec.rb +0 -7
- data/spec/double_entry/account_spec.rb +0 -130
- data/spec/double_entry/balance_calculator_spec.rb +0 -88
- data/spec/double_entry/configuration_spec.rb +0 -50
- data/spec/double_entry/line_spec.rb +0 -80
- data/spec/double_entry/locking_spec.rb +0 -214
- data/spec/double_entry/performance/double_entry_performance_spec.rb +0 -32
- data/spec/double_entry/performance/reporting/aggregate_performance_spec.rb +0 -50
- data/spec/double_entry/reporting/aggregate_array_spec.rb +0 -123
- data/spec/double_entry/reporting/aggregate_spec.rb +0 -205
- data/spec/double_entry/reporting/line_aggregate_filter_spec.rb +0 -90
- data/spec/double_entry/reporting/line_aggregate_spec.rb +0 -39
- data/spec/double_entry/reporting/month_range_spec.rb +0 -139
- data/spec/double_entry/reporting/time_range_array_spec.rb +0 -169
- data/spec/double_entry/reporting/time_range_spec.rb +0 -45
- data/spec/double_entry/reporting/week_range_spec.rb +0 -103
- data/spec/double_entry/reporting_spec.rb +0 -181
- data/spec/double_entry/transfer_spec.rb +0 -93
- data/spec/double_entry/validation/line_check_spec.rb +0 -99
- data/spec/double_entry_spec.rb +0 -428
- data/spec/generators/double_entry/install/install_generator_spec.rb +0 -30
- data/spec/spec_helper.rb +0 -118
- data/spec/support/accounts.rb +0 -21
- data/spec/support/blueprints.rb +0 -43
- data/spec/support/database.example.yml +0 -21
- data/spec/support/database.travis.yml +0 -24
- data/spec/support/double_entry_spec_helper.rb +0 -27
- data/spec/support/gemfiles/Gemfile.rails-3.2.x +0 -8
- data/spec/support/gemfiles/Gemfile.rails-4.1.x +0 -6
- data/spec/support/gemfiles/Gemfile.rails-4.2.x +0 -5
- data/spec/support/gemfiles/Gemfile.rails-5.0.x +0 -5
- data/spec/support/performance_helper.rb +0 -26
- data/spec/support/reporting_configuration.rb +0 -6
- data/spec/support/schema.rb +0 -74
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: bd62c2e42e510db804162a1de625cc123d04c65c6183eb1e1004061eef376e46
|
4
|
+
data.tar.gz: ffde728e5768509bd391e4056971dbb63128ad46ef02a9780497facaaa31415e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c30e7b10ebeac99660c122ecedfafccbb115f36ed309e9a7c0b41bc122ea5a86d51baac92c28c0a5bcff4850b752fa7ffd356a94267812cb79fa4c7ef029bfd
|
7
|
+
data.tar.gz: 145104fb048131b5f49d075f9a8e0b94d6e5fd73c5450cad0b4bdf522ecc9f6c311571e809457017383fa4b0d4576859a3a3e4aa991ff45d672189fd9434ff46
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,432 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
All notable changes to this project will be documented in this file.
|
4
|
+
|
5
|
+
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
6
|
+
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
7
|
+
|
8
|
+
## [Unreleased]
|
9
|
+
|
10
|
+
## [2.0.0.beta1] - 2018-12-31
|
11
|
+
|
12
|
+
### Added
|
13
|
+
|
14
|
+
- Added contributor credits to README.
|
15
|
+
|
16
|
+
- Added support for Ruby 2.3, 2.4, 2.5 and 2.6.
|
17
|
+
|
18
|
+
- Added support for Rails 5.0, 5.1 and 5.2
|
19
|
+
|
20
|
+
- Support passing an array of metadata values.
|
21
|
+
|
22
|
+
```ruby
|
23
|
+
DoubleEntry.transfer(
|
24
|
+
Money.new(20_00),
|
25
|
+
:from => one_account,
|
26
|
+
:to => another_account,
|
27
|
+
:code => :a_business_code_for_this_type_of_transfer,
|
28
|
+
:metadata => { :key1 => ['value 1', 'value 2'], :key2 => 'value 3' },
|
29
|
+
)
|
30
|
+
```
|
31
|
+
|
32
|
+
- Allow partner account to be specified for aggregates.
|
33
|
+
|
34
|
+
- Allow filtering aggregates by multiple metadata key/value pairs.
|
35
|
+
|
36
|
+
- Add index on the `double_entry_line_checks` table. This covers the query to
|
37
|
+
obtain the last line check.
|
38
|
+
|
39
|
+
Add this index to your database via a migration like:
|
40
|
+
|
41
|
+
```ruby
|
42
|
+
def up
|
43
|
+
add_index "double_entry_line_checks", ["created_at", "last_line_id"], :name => "line_checks_created_at_last_line_id_idx"
|
44
|
+
end
|
45
|
+
```
|
46
|
+
|
47
|
+
- Log account balance cache errors to the database when performing the line check:
|
48
|
+
`DoubleEntry::Validation::LineCheck::perform!`
|
49
|
+
|
50
|
+
### Changed
|
51
|
+
|
52
|
+
- Replaced Machinist with Factory Bot in test suite.
|
53
|
+
|
54
|
+
- Implement `DoubleEntry::Transfer::Set` and `DoubleEntry::Account::Set` with
|
55
|
+
`Hash`es rather than `Array`s for performance.
|
56
|
+
|
57
|
+
- Reporting API now uses keyword arguments. Note these reporting classes are
|
58
|
+
marked API private: their interface is not considered stable.
|
59
|
+
- `DoubleEntry::Reporting::aggregate`
|
60
|
+
- `DoubleEntry::Reporting::aggregate_array`
|
61
|
+
- `DoubleEntry::Reporting::Aggregate::new`
|
62
|
+
- `DoubleEntry::Reporting::Aggregate::formatted_amount`
|
63
|
+
- `DoubleEntry::Reporting::AggregateArray::new`
|
64
|
+
- `DoubleEntry::Reporting::LineAggregateFilter::new`
|
65
|
+
|
66
|
+
- Loosened database string column contstraints to the default (255 characters).
|
67
|
+
Engineering teams can choose to apply this change, or apply their own column
|
68
|
+
length constraints specific to their needs. ([#152])
|
69
|
+
|
70
|
+
- Removed default values for the length checks on `code`, `account` and `scope`
|
71
|
+
([#152]). These checks will now only be performed when configured with a value:
|
72
|
+
|
73
|
+
```ruby
|
74
|
+
DoubleEntry.configure do |config|
|
75
|
+
config.code_max_length = 47
|
76
|
+
config.account_identifier_max_length = 31
|
77
|
+
config.scope_identifier_max_length = 23
|
78
|
+
end
|
79
|
+
```
|
80
|
+
- Use `bigint` for monetary values in the database to avoid integer overflow
|
81
|
+
([#154]). Apply changes via this migration:
|
82
|
+
|
83
|
+
```ruby
|
84
|
+
change_column :double_entry_account_balances, :balance, :bigint, null: false
|
85
|
+
|
86
|
+
change_column :double_entry_line_aggregates, :amount, :bigint, null: false
|
87
|
+
|
88
|
+
change_column :double_entry_lines, :amount, :bigint, null: false
|
89
|
+
change_column :double_entry_lines, :balance, :bigint, null: false
|
90
|
+
```
|
91
|
+
- On Rails version 5.1 and above, use `bigint` for foreign key values in the
|
92
|
+
database to avoid integer overflow ([#154]). Apply changes via this
|
93
|
+
migration:
|
94
|
+
|
95
|
+
```ruby
|
96
|
+
change_column :double_entry_line_checks, :last_line_id, :bigint, null: false
|
97
|
+
|
98
|
+
change_column :double_entry_line_metadata, :line_id, :bigint, null: false
|
99
|
+
|
100
|
+
change_column :double_entry_lines, :partner_id, :bigint, null: true
|
101
|
+
change_column :double_entry_lines, :detail_id, :bigint, null: true
|
102
|
+
```
|
103
|
+
|
104
|
+
- Line check validation no-longer performs corrections by default. The
|
105
|
+
`DoubleEntry::Validation::LineCheck::perform!` method will only log validation
|
106
|
+
failures in the database. To perform auto-correction pass the `fixer` option:
|
107
|
+
`LineCheck.perform!(fixer: DoubleEntry::Validation::AccountFixer.new)`
|
108
|
+
|
109
|
+
### Removed
|
110
|
+
|
111
|
+
- Removed support for Ruby 1.9, 2.0, 2.1 and 2.2.
|
112
|
+
|
113
|
+
- Removed support for Rails 3.2, 4.0, and 4.1.
|
114
|
+
|
115
|
+
- Removed unneeded development dependencies from Gemspec.
|
116
|
+
|
117
|
+
- Removed spec and script files from gem package.
|
118
|
+
|
119
|
+
- Removed the `active_record_scope_identifier` method for configuring scoped accounts.
|
120
|
+
|
121
|
+
```ruby
|
122
|
+
user_scope = accounts.active_record_scope_identifier(User)
|
123
|
+
```
|
124
|
+
|
125
|
+
As a replacement, please define your own with a lambda:
|
126
|
+
|
127
|
+
```ruby
|
128
|
+
user_scope = ->(user) do
|
129
|
+
raise 'not a User' unless user.class.name == 'User'
|
130
|
+
user.id
|
131
|
+
end
|
132
|
+
```
|
133
|
+
|
134
|
+
### Fixed
|
135
|
+
|
136
|
+
- Fixed more Ruby warnings.
|
137
|
+
|
138
|
+
- Use `double_entry` namespace when publishing to
|
139
|
+
`ActiveSupport::Notifications`.
|
140
|
+
|
141
|
+
- Fixed problem of Rails version number not being set in migration template for apps using Rails 5 or higher.
|
142
|
+
|
143
|
+
[#152]: https://github.com/envato/double_entry/pull/152
|
144
|
+
[#154]: https://github.com/envato/double_entry/pull/154
|
145
|
+
|
146
|
+
## [1.0.1] - 2018-01-06
|
147
|
+
|
148
|
+
### Removed
|
149
|
+
|
150
|
+
- Removed Rubocop checks and build step.
|
151
|
+
|
152
|
+
### Fixed
|
153
|
+
|
154
|
+
- Use `Money#positive?` and `Money#negative?` rather than comparing to zero.
|
155
|
+
Resolves issues when dealing with multiple currencies.
|
156
|
+
|
157
|
+
- Fixed typo in jack_hammer documentation.
|
158
|
+
|
159
|
+
## [1.0.0] - 2015-08-04
|
160
|
+
|
161
|
+
### Added
|
162
|
+
|
163
|
+
- Record meta-data against transfers.
|
164
|
+
|
165
|
+
```ruby
|
166
|
+
DoubleEntry.transfer(
|
167
|
+
Money.new(20_00),
|
168
|
+
:from => one_account,
|
169
|
+
:to => another_account,
|
170
|
+
:code => :a_business_code_for_this_type_of_transfer,
|
171
|
+
:metadata => { :key1 => 'value 1', :key2 => 'value 2' },
|
172
|
+
)
|
173
|
+
```
|
174
|
+
|
175
|
+
This feature requires a new DB table. Please add a migration similar to:
|
176
|
+
|
177
|
+
```ruby
|
178
|
+
class CreateDoubleEntryLineMetadata < ActiveRecord::Migration
|
179
|
+
def self.up
|
180
|
+
create_table "#{DoubleEntry.table_name_prefix}line_metadata", :force => true do |t|
|
181
|
+
t.integer "line_id", :null => false
|
182
|
+
t.string "key", :limit => 48, :null => false
|
183
|
+
t.string "value", :limit => 64, :null => false
|
184
|
+
t.timestamps :null => false
|
185
|
+
end
|
186
|
+
|
187
|
+
add_index "#{DoubleEntry.table_name_prefix}line_metadata",
|
188
|
+
["line_id", "key", "value"],
|
189
|
+
:name => "lines_meta_line_id_key_value_idx"
|
190
|
+
end
|
191
|
+
|
192
|
+
def self.down
|
193
|
+
drop_table "#{DoubleEntry.table_name_prefix}line_metadata"
|
194
|
+
end
|
195
|
+
end
|
196
|
+
```
|
197
|
+
|
198
|
+
### Changed
|
199
|
+
|
200
|
+
- Raise `DoubleEntry::Locking::LockWaitTimeout` for lock wait timeouts.
|
201
|
+
|
202
|
+
### Fixed
|
203
|
+
|
204
|
+
- Ensure that a range is specified when performing an aggregate function over
|
205
|
+
lines.
|
206
|
+
|
207
|
+
## [0.10.3] - 2015-07-15
|
208
|
+
|
209
|
+
### Added
|
210
|
+
|
211
|
+
- Check code format with Rubocop as part of the CI build.
|
212
|
+
|
213
|
+
### Fixed
|
214
|
+
|
215
|
+
- More Rubocop code formatting issues fixed.
|
216
|
+
|
217
|
+
## [0.10.2] - 2015-07-10
|
218
|
+
|
219
|
+
### Fixed
|
220
|
+
|
221
|
+
- `DoubleEntry::Reporting::AggregateArray` correctly retreives previously
|
222
|
+
calculated aggregates.
|
223
|
+
|
224
|
+
## [0.10.1] - 2015-07-06
|
225
|
+
|
226
|
+
### Added
|
227
|
+
|
228
|
+
- Run CI build against Ruby 2.2.0.
|
229
|
+
|
230
|
+
- Added Rubocop and resolved code formatting issues.
|
231
|
+
|
232
|
+
### Changed
|
233
|
+
|
234
|
+
- Reduced permutations of DB, Ruby and Rails in CI build.
|
235
|
+
|
236
|
+
- Build status badge displayed in README reports on just the master branch.
|
237
|
+
|
238
|
+
- Update RSpec configuration with latest recommended options.
|
239
|
+
|
240
|
+
### Fixed
|
241
|
+
|
242
|
+
- Addressed Ruby warnings.
|
243
|
+
|
244
|
+
- Fixed circular arg reference.
|
245
|
+
|
246
|
+
## [0.10.0] - 2015-01-09
|
247
|
+
|
248
|
+
### Added
|
249
|
+
|
250
|
+
- Define accounts that can be negative only.
|
251
|
+
|
252
|
+
```ruby
|
253
|
+
DoubleEntry.configure do |config|
|
254
|
+
config.define_accounts do |accounts|
|
255
|
+
accounts.define(
|
256
|
+
:identifier => :my_account_that_never_goes_positive,
|
257
|
+
:negative_only => true
|
258
|
+
)
|
259
|
+
end
|
260
|
+
end
|
261
|
+
```
|
262
|
+
|
263
|
+
- Run CI build against Rails 4.2
|
264
|
+
|
265
|
+
## [0.9.0] - 2014-12-08
|
266
|
+
|
267
|
+
### Changed
|
268
|
+
|
269
|
+
- `DoubleEntry::Reporting::Agregate#formated_amount` no longer accepts
|
270
|
+
`currency` argument.
|
271
|
+
|
272
|
+
## [0.8.0] - 2014-11-19
|
273
|
+
|
274
|
+
### Added
|
275
|
+
|
276
|
+
- Log when we encounter deadlocks causing restart/retry.
|
277
|
+
|
278
|
+
## [0.7.2] - 2014-11-18
|
279
|
+
|
280
|
+
### Removed
|
281
|
+
|
282
|
+
- Removed `DoubleEntry::currency` method.
|
283
|
+
|
284
|
+
## [0.7.1] - 2014-11-17
|
285
|
+
|
286
|
+
### Fixed
|
287
|
+
|
288
|
+
- `DoubleEntry::balance` and `DoubleEntry::account` now raise
|
289
|
+
`DoubleEntry::AccountScopeMismatchError` if the scope provided is not of
|
290
|
+
the same type in the account definition.
|
291
|
+
|
292
|
+
- Speed up CI build.
|
293
|
+
|
294
|
+
## [0.7.0] - 2014-11-12
|
295
|
+
|
296
|
+
### Added
|
297
|
+
|
298
|
+
- Added support for currency. :money_with_wings:
|
299
|
+
|
300
|
+
### Changed
|
301
|
+
|
302
|
+
- Require at least version 6.0 of Money gem.
|
303
|
+
|
304
|
+
## [0.6.1] - 2014-10-10
|
305
|
+
|
306
|
+
### Changed
|
307
|
+
|
308
|
+
- Removed use of Active Record callbacks in `DoubleEntry::Line`.
|
309
|
+
|
310
|
+
- Changed `DoubleEntry::Reporting::WeekRange` calculation to use
|
311
|
+
`Date#cweek`.
|
312
|
+
|
313
|
+
## [0.6.0] - 2014-08-23
|
314
|
+
|
315
|
+
### Fixed
|
316
|
+
|
317
|
+
- Fixed defect preventing locking a scoped and a non scoped account.
|
318
|
+
|
319
|
+
## [0.5.0] - 2014-08-01
|
320
|
+
|
321
|
+
### Added
|
322
|
+
|
323
|
+
- Added a convenience method for defining active record scope identifiers.
|
324
|
+
|
325
|
+
```ruby
|
326
|
+
DoubleEntry.configure do |config|
|
327
|
+
config.define_accounts do |accounts|
|
328
|
+
user_scope = accounts.active_record_scope_identifier(User)
|
329
|
+
accounts.define(:identifier => :checking, :scope_identifier => user_scope)
|
330
|
+
end
|
331
|
+
end
|
332
|
+
```
|
333
|
+
|
334
|
+
- Added support for SQLite.
|
335
|
+
|
336
|
+
### Removed
|
337
|
+
|
338
|
+
- Removed errors: `DoubleEntry::RequiredMetaMissing` and
|
339
|
+
`DoubleEntry::UserAccountNotLocked`.
|
340
|
+
|
341
|
+
### Fixed
|
342
|
+
|
343
|
+
- Fixed `Reporting::reconciled?` support for account scopes.
|
344
|
+
|
345
|
+
## [0.4.0] - 2014-07-17
|
346
|
+
|
347
|
+
### Added
|
348
|
+
|
349
|
+
- Added Yardoc documention to the `DoubleEntry::balance` method.
|
350
|
+
|
351
|
+
### Changed
|
352
|
+
|
353
|
+
- Changed `Line#debit?` to `Line#increase?` and `Line#credit?` to
|
354
|
+
`Line#decrease?`.
|
355
|
+
|
356
|
+
### Removed
|
357
|
+
|
358
|
+
- Removed the `DoubleEntry::Line#meta` attribute.
|
359
|
+
|
360
|
+
## [0.3.1] - 2014-07-11
|
361
|
+
|
362
|
+
### Fixed
|
363
|
+
|
364
|
+
- Obtain a year range array without prioviding a start date.
|
365
|
+
|
366
|
+
## [0.3.0] - 2014-07-11
|
367
|
+
|
368
|
+
### Added
|
369
|
+
|
370
|
+
- Add Yardoc to `Reporting` module.
|
371
|
+
- Allow reporting month and year time ranges without a start date.
|
372
|
+
|
373
|
+
### Changed
|
374
|
+
|
375
|
+
- Use ruby18 hash syntax for configuration example in README.
|
376
|
+
|
377
|
+
### Removed
|
378
|
+
|
379
|
+
- Removed `DoubleEntry::describe` and `DoubleEntry::Line#description`
|
380
|
+
methods.
|
381
|
+
|
382
|
+
## [0.2.0] - 2014-06-28
|
383
|
+
|
384
|
+
### Added
|
385
|
+
|
386
|
+
- Added a configuration class to define valid accounts and transfers.
|
387
|
+
|
388
|
+
```ruby
|
389
|
+
DoubleEntry.configure do |config|
|
390
|
+
config.define_accounts do |accounts|
|
391
|
+
accounts.define(identifier: :savings, positive_only: true)
|
392
|
+
accounts.define(identifier: :checking)
|
393
|
+
end
|
394
|
+
|
395
|
+
config.define_transfers do |transfers|
|
396
|
+
transfers.define(from: :checking, to: :savings, code: :deposit)
|
397
|
+
transfers.define(from: :savings, to: :checking, code: :withdraw)
|
398
|
+
end
|
399
|
+
end
|
400
|
+
```
|
401
|
+
|
402
|
+
### Changed
|
403
|
+
|
404
|
+
- Move reporting classes into the `DoubleEntry::Reporting` namespace. Mark
|
405
|
+
this module as `@api private`: internal use only.
|
406
|
+
|
407
|
+
## 0.1.0 - 2014-06-20
|
408
|
+
|
409
|
+
### Added
|
410
|
+
|
411
|
+
- Library released as Open Source!
|
412
|
+
|
413
|
+
[Unreleased]: https://github.com/envato/double_entry/compare/v2.0.0.beta1...HEAD
|
414
|
+
[2.0.0.beta1]: https://github.com/envato/double_entry/compare/v1.0.1...v2.0.0.beta1
|
415
|
+
[1.0.1]: https://github.com/envato/double_entry/compare/v1.0.0...v1.0.1
|
416
|
+
[1.0.0]: https://github.com/envato/double_entry/compare/v0.10.3...v1.0.0
|
417
|
+
[0.10.3]: https://github.com/envato/double_entry/compare/v0.10.2...v0.10.3
|
418
|
+
[0.10.2]: https://github.com/envato/double_entry/compare/v0.10.1...v0.10.2
|
419
|
+
[0.10.1]: https://github.com/envato/double_entry/compare/v0.10.0...v0.10.1
|
420
|
+
[0.10.0]: https://github.com/envato/double_entry/compare/v0.9.0...v0.10.0
|
421
|
+
[0.9.0]: https://github.com/envato/double_entry/compare/v0.8.0...v0.9.0
|
422
|
+
[0.8.0]: https://github.com/envato/double_entry/compare/v0.7.2...v0.8.0
|
423
|
+
[0.7.2]: https://github.com/envato/double_entry/compare/v0.7.1...v0.7.2
|
424
|
+
[0.7.1]: https://github.com/envato/double_entry/compare/v0.7.0...v0.7.1
|
425
|
+
[0.7.0]: https://github.com/envato/double_entry/compare/v0.6.1...v0.7.0
|
426
|
+
[0.6.1]: https://github.com/envato/double_entry/compare/v0.6.0...v0.6.1
|
427
|
+
[0.6.0]: https://github.com/envato/double_entry/compare/v0.5.0...v0.6.0
|
428
|
+
[0.5.0]: https://github.com/envato/double_entry/compare/v0.4.0...v0.5.0
|
429
|
+
[0.4.0]: https://github.com/envato/double_entry/compare/v0.3.1...v0.4.0
|
430
|
+
[0.3.1]: https://github.com/envato/double_entry/compare/v0.3.0...v0.3.1
|
431
|
+
[0.3.0]: https://github.com/envato/double_entry/compare/v0.2.0...v0.3.0
|
432
|
+
[0.2.0]: https://github.com/envato/double_entry/compare/v0.1.0...v0.2.0
|
data/README.md
CHANGED
@@ -3,8 +3,8 @@
|
|
3
3
|
|
4
4
|
[](https://github.com/envato/double_entry/blob/master/LICENSE.md)
|
5
5
|
[](http://badge.fury.io/rb/double_entry)
|
6
|
-
[](https://travis-ci.org/envato/double_entry)
|
7
|
+
[](https://codeclimate.com/github/envato/double_entry)
|
8
8
|
|
9
9
|

|
10
10
|
|
@@ -22,15 +22,16 @@ DoubleEntry uses the [Money gem](https://github.com/RubyMoney/money) to encapsul
|
|
22
22
|
DoubleEntry is tested against:
|
23
23
|
|
24
24
|
Ruby
|
25
|
-
* 2.1.x
|
26
|
-
* 2.2.x
|
27
25
|
* 2.3.x
|
26
|
+
* 2.4.x
|
27
|
+
* 2.5.x
|
28
|
+
* 2.6.x
|
28
29
|
|
29
30
|
Rails
|
30
|
-
* 3.2.x
|
31
|
-
* 4.1.x
|
32
31
|
* 4.2.x
|
33
32
|
* 5.0.x
|
33
|
+
* 5.1.x
|
34
|
+
* 5.2.x
|
34
35
|
|
35
36
|
Databases
|
36
37
|
* MySQL
|
@@ -134,7 +135,7 @@ DoubleEntry.transfer(
|
|
134
135
|
:from => one_account,
|
135
136
|
:to => another_account,
|
136
137
|
:code => :a_business_code_for_this_type_of_transfer,
|
137
|
-
:metadata => {:key1 => 'value 1', :key2 => 'value
|
138
|
+
:metadata => {:key1 => ['value 1', 'value 2'], :key2 => 'value 3'},
|
138
139
|
)
|
139
140
|
```
|
140
141
|
|
@@ -195,7 +196,10 @@ require 'double_entry'
|
|
195
196
|
|
196
197
|
DoubleEntry.configure do |config|
|
197
198
|
config.define_accounts do |accounts|
|
198
|
-
user_scope =
|
199
|
+
user_scope = ->(user) do
|
200
|
+
raise 'not a User' unless user.class.name == 'User'
|
201
|
+
user.id
|
202
|
+
end
|
199
203
|
accounts.define(:identifier => :savings, :scope_identifier => user_scope, :positive_only => true)
|
200
204
|
accounts.define(:identifier => :checking, :scope_identifier => user_scope)
|
201
205
|
end
|
@@ -215,7 +219,7 @@ Transfers between accounts of different currencies are not allowed.
|
|
215
219
|
```ruby
|
216
220
|
DoubleEntry.configure do |config|
|
217
221
|
config.define_accounts do |accounts|
|
218
|
-
accounts.define(:identifier => :savings, :scope_identifier => user_scope, :currency =>
|
222
|
+
accounts.define(:identifier => :savings, :scope_identifier => user_scope, :currency => 'AUD')
|
219
223
|
end
|
220
224
|
end
|
221
225
|
```
|
@@ -304,3 +308,26 @@ See the Github project [issues](https://github.com/envato/double_entry/issues).
|
|
304
308
|
```sh
|
305
309
|
bundle exec rake
|
306
310
|
```
|
311
|
+
|
312
|
+
## Contributors
|
313
|
+
|
314
|
+
Many thanks to those who have contributed to both this gem, and the library upon which it was based, over the years:
|
315
|
+
* Anthony Sellitti - @asellitt
|
316
|
+
* Clinton Forbes - @clinton
|
317
|
+
* Eaden McKee - @eadz
|
318
|
+
* Giancarlo Salamanca - @salamagd
|
319
|
+
* Jiexin Huang - @jiexinhuang
|
320
|
+
* Keith Pitt - @keithpitt
|
321
|
+
* Kelsey Hannan - @KelseyDH
|
322
|
+
* Mark Turnley - @rabidcarrot
|
323
|
+
* Martin Jagusch - @MJIO
|
324
|
+
* Martin Spickermann - @spickermann
|
325
|
+
* Mary-Anne Cosgrove - @macosgrove
|
326
|
+
* Orien Madgwick - @orien
|
327
|
+
* Pete Yandall - @notahat
|
328
|
+
* Rizal Muthi - @rizalmuthi
|
329
|
+
* Ryan Allen - @ryan-allen
|
330
|
+
* Samuel Cochran - @sj26
|
331
|
+
* Stephanie Staub - @stephnacios
|
332
|
+
* Trung Lê - @joneslee85
|
333
|
+
* Vahid Ta'eed - @vahid
|