fortnox-api 1.0.0.rc14 → 1.0.0.rc16
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/CHANGELOG.md +41 -1
- data/fortnox.gemspec +1 -1
- data/lib/fortnox/types/housework.rb +57 -0
- data/lib/fortnox/types.rb +1 -12
- data/lib/fortnox/version.rb +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7350800553373489f35a73af7206ae013a6004024b53db948e2778e85c0f61b5
|
|
4
|
+
data.tar.gz: 359f4b9fb46a0b17aa67180b977021a9bcab6653a722043df93954ccc68b470d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c9f62481c8990889206483a455a6f8b6c11060c4f60aad75c8ebbe97825efa5747f7176506a1de69e66df0d0d56592b35d713154a4a033176da5646bc8c7aa2d
|
|
7
|
+
data.tar.gz: a2e684f757d98304b7ed7e08c167900abaecb027fb31b291b59d1fe57c5cc0f89753e3d0110d9f8cd01c90ce36964c09c28d7b85b8474ea9758507366e647672
|
data/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,44 @@ and this project adheres to
|
|
|
8
8
|
|
|
9
9
|
## [Unreleased]
|
|
10
10
|
|
|
11
|
+
## [1.0.0.rc16] - 2026-08-19
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
|
|
15
|
+
- **Housework types grouped by tax reduction type.**
|
|
16
|
+
`Fortnox::Types::HOUSEWORK_TYPES_BY_TAX_REDUCTION` maps `'rot'`, `'rut'`
|
|
17
|
+
and `'green'` to the housework types a document of that type may carry,
|
|
18
|
+
with `ROT_HOUSEWORK_TYPES`, `RUT_HOUSEWORK_TYPES`, `GREEN_HOUSEWORK_TYPES`
|
|
19
|
+
and `ANY_TAX_REDUCTION_HOUSEWORK_TYPES` available individually. Fortnox
|
|
20
|
+
enforces the grouping — a document declaring one reduction type is
|
|
21
|
+
rejected outright if it carries a row from another ("Dokument med
|
|
22
|
+
skattereduktionstypen 'rut' får inte innehålla rader med ...") — but the
|
|
23
|
+
gem previously exposed only the flat `CURRENT_HOUSEWORK_TYPES`, leaving
|
|
24
|
+
every consumer to hard-code the split in order to build a UI that cannot
|
|
25
|
+
produce an unsaveable document. `OTHERCOSTS` and `EMPTYHOUSEWORK` mark a
|
|
26
|
+
row as not being housework and appear under every reduction type.
|
|
27
|
+
|
|
28
|
+
## [1.0.0.rc15] - 2026-08-18
|
|
29
|
+
|
|
30
|
+
### Fixed
|
|
31
|
+
|
|
32
|
+
- **Cached resources no longer raise on the first cache hit.** The
|
|
33
|
+
`rest-easy` dependency is now `~> 1.4.1`, which stops `RestEasy::Meta`
|
|
34
|
+
claiming to implement methods it has no value for. Because it claimed
|
|
35
|
+
`marshal_dump`, marshalling a parsed resource silently wrote `nil` where
|
|
36
|
+
the meta state should be, and reading it back raised `NoMethodError:
|
|
37
|
+
undefined method '[]' for nil:NilClass`. Every parsed Fortnox resource
|
|
38
|
+
carries a `meta` — it is where the `partial` flag lives — so any consumer
|
|
39
|
+
caching resources in a store that marshals its entries (Rails'
|
|
40
|
+
`:memory_store` and `:file_store` among them) wrote an unusable entry on
|
|
41
|
+
the first request and raised on every cache hit after that.
|
|
42
|
+
|
|
43
|
+
**Upgrading with a warm cache:** entries written before this release are
|
|
44
|
+
not recoverable and now fail with `TypeError: instance of RestEasy::Meta
|
|
45
|
+
needs to have method 'marshal_load'`. Flush the cache or bump its key
|
|
46
|
+
namespace when upgrading. A process-local `:memory_store` clears itself on
|
|
47
|
+
restart and needs nothing.
|
|
48
|
+
|
|
11
49
|
## [1.0.0.rc14] - 2026-08-11
|
|
12
50
|
|
|
13
51
|
### Changed
|
|
@@ -398,7 +436,9 @@ for the full list of breaking changes.
|
|
|
398
436
|
For changes prior to the 1.0 rewrite, see the
|
|
399
437
|
[0.x changelog](https://github.com/accodeing/fortnox-api/blob/v0.9.2/CHANGELOG.md).
|
|
400
438
|
|
|
401
|
-
[Unreleased]: https://github.com/accodeing/fortnox-api/compare/v1.0.0.
|
|
439
|
+
[Unreleased]: https://github.com/accodeing/fortnox-api/compare/v1.0.0.rc16...HEAD
|
|
440
|
+
[1.0.0.rc16]: https://github.com/accodeing/fortnox-api/compare/v1.0.0.rc15...v1.0.0.rc16
|
|
441
|
+
[1.0.0.rc15]: https://github.com/accodeing/fortnox-api/compare/v1.0.0.rc14...v1.0.0.rc15
|
|
402
442
|
[1.0.0.rc14]: https://github.com/accodeing/fortnox-api/compare/v1.0.0.rc13...v1.0.0.rc14
|
|
403
443
|
[1.0.0.rc13]: https://github.com/accodeing/fortnox-api/compare/v1.0.0.rc12...v1.0.0.rc13
|
|
404
444
|
[1.0.0.rc12]: https://github.com/accodeing/fortnox-api/compare/v1.0.0.rc11...v1.0.0.rc12
|
data/fortnox.gemspec
CHANGED
|
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
|
|
|
24
24
|
spec.add_dependency 'base64', '~> 0.2'
|
|
25
25
|
spec.add_dependency 'countries', '~> 7.1'
|
|
26
26
|
spec.add_dependency 'dry-struct', '~> 1.5'
|
|
27
|
-
spec.add_dependency 'rest-easy', '~> 1.4.
|
|
27
|
+
spec.add_dependency 'rest-easy', '~> 1.4.1'
|
|
28
28
|
|
|
29
29
|
spec.metadata['rubygems_mfa_required'] = 'true'
|
|
30
30
|
end
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Fortnox
|
|
4
|
+
module Types
|
|
5
|
+
# The housework (ROT/RUT/green) categories a document row can carry.
|
|
6
|
+
#
|
|
7
|
+
# Should be included in Fortnox::Types, so every constant here is also reachable
|
|
8
|
+
# as `Fortnox::Types::CURRENT_HOUSEWORK_TYPES` and friends.
|
|
9
|
+
module Housework
|
|
10
|
+
# Which tax reduction each housework type belongs to. Fortnox enforces
|
|
11
|
+
# this: a document declaring one reduction type is rejected outright if
|
|
12
|
+
# it carries a row from another, with "Dokument med
|
|
13
|
+
# skattereduktionstypen 'rut' får inte innehålla rader med ...".
|
|
14
|
+
# Consumers building a UI need the grouping to keep users from
|
|
15
|
+
# assembling a document that cannot be saved.
|
|
16
|
+
ROT_HOUSEWORK_TYPES = [
|
|
17
|
+
'CONSTRUCTION', 'ELECTRICITY', 'GLASSMETALWORK', 'GROUNDDRAINAGEWORK',
|
|
18
|
+
'MASONRY', 'PAINTINGWALLPAPERING', 'HVAC'
|
|
19
|
+
].freeze
|
|
20
|
+
|
|
21
|
+
RUT_HOUSEWORK_TYPES = [
|
|
22
|
+
'MAJORAPPLIANCEREPAIR', 'MOVINGSERVICES', 'ITSERVICES', 'CLEANING',
|
|
23
|
+
'TEXTILECLOTHING', 'SNOWPLOWING', 'GARDENING', 'BABYSITTING',
|
|
24
|
+
'OTHERCARE', 'FURNISHING', 'HOMEMAINTENANCE', 'TRANSPORTATIONSERVICES',
|
|
25
|
+
'WASHINGANDCAREOFCLOTHING'
|
|
26
|
+
].freeze
|
|
27
|
+
|
|
28
|
+
GREEN_HOUSEWORK_TYPES = [
|
|
29
|
+
'SOLARCELLS', 'STORAGESELFPRODUCEDELECTRICITY',
|
|
30
|
+
'CHARGINGSTATIONELECTRICVEHICLE'
|
|
31
|
+
].freeze
|
|
32
|
+
|
|
33
|
+
# Accepted under any tax reduction type. Both mark a row as not being
|
|
34
|
+
# housework and must be sent with `housework` false.
|
|
35
|
+
ANY_TAX_REDUCTION_HOUSEWORK_TYPES = ['OTHERCOSTS', 'EMPTYHOUSEWORK'].freeze
|
|
36
|
+
|
|
37
|
+
# Every type Fortnox still accepts on a new document — the groups above
|
|
38
|
+
# are the definition, this is only their sum. Anything added to a group
|
|
39
|
+
# lands here, and in the HouseworkTypes enum, on its own.
|
|
40
|
+
CURRENT_HOUSEWORK_TYPES = (
|
|
41
|
+
ROT_HOUSEWORK_TYPES + RUT_HOUSEWORK_TYPES + GREEN_HOUSEWORK_TYPES +
|
|
42
|
+
ANY_TAX_REDUCTION_HOUSEWORK_TYPES
|
|
43
|
+
).freeze
|
|
44
|
+
|
|
45
|
+
# Fortnox no longer grants a reduction for these, but old documents
|
|
46
|
+
# still come back carrying them, so the enum has to accept them.
|
|
47
|
+
LEGACY_HOUSEWORK_TYPES = ['COOKING', 'TUTORING'].freeze
|
|
48
|
+
|
|
49
|
+
# The types a document may carry, keyed by its tax reduction type.
|
|
50
|
+
HOUSEWORK_TYPES_BY_TAX_REDUCTION = {
|
|
51
|
+
'rot' => (ROT_HOUSEWORK_TYPES + ANY_TAX_REDUCTION_HOUSEWORK_TYPES).freeze,
|
|
52
|
+
'rut' => (RUT_HOUSEWORK_TYPES + ANY_TAX_REDUCTION_HOUSEWORK_TYPES).freeze,
|
|
53
|
+
'green' => (GREEN_HOUSEWORK_TYPES + ANY_TAX_REDUCTION_HOUSEWORK_TYPES).freeze
|
|
54
|
+
}.freeze
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
data/lib/fortnox/types.rb
CHANGED
|
@@ -6,6 +6,7 @@ require 'dry-types'
|
|
|
6
6
|
module Fortnox
|
|
7
7
|
module Types
|
|
8
8
|
include Dry.Types()
|
|
9
|
+
include Housework
|
|
9
10
|
|
|
10
11
|
# Booleans reach us as strings whenever the caller is a Rails app passing
|
|
11
12
|
# controller params through. Resource attributes already coerce those:
|
|
@@ -23,18 +24,6 @@ module Fortnox
|
|
|
23
24
|
'AMOUNT', 'PERCENT'
|
|
24
25
|
)
|
|
25
26
|
|
|
26
|
-
CURRENT_HOUSEWORK_TYPES = [
|
|
27
|
-
'CONSTRUCTION', 'ELECTRICITY', 'GLASSMETALWORK', 'GROUNDDRAINAGEWORK',
|
|
28
|
-
'MASONRY', 'PAINTINGWALLPAPERING', 'HVAC', 'MAJORAPPLIANCEREPAIR',
|
|
29
|
-
'MOVINGSERVICES', 'ITSERVICES', 'CLEANING', 'TEXTILECLOTHING',
|
|
30
|
-
'SNOWPLOWING', 'GARDENING', 'BABYSITTING', 'OTHERCARE', 'OTHERCOSTS',
|
|
31
|
-
'FURNISHING', 'HOMEMAINTENANCE', 'TRANSPORTATIONSERVICES',
|
|
32
|
-
'WASHINGANDCAREOFCLOTHING', 'SOLARCELLS', 'STORAGESELFPRODUCEDELECTRICITY',
|
|
33
|
-
'CHARGINGSTATIONELECTRICVEHICLE', 'EMPTYHOUSEWORK'
|
|
34
|
-
].freeze
|
|
35
|
-
|
|
36
|
-
LEGACY_HOUSEWORK_TYPES = ['COOKING', 'TUTORING'].freeze
|
|
37
|
-
|
|
38
27
|
HouseworkTypes = Types::Strict::String.enum(
|
|
39
28
|
*(CURRENT_HOUSEWORK_TYPES + LEGACY_HOUSEWORK_TYPES)
|
|
40
29
|
)
|
data/lib/fortnox/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: fortnox-api
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.0.
|
|
4
|
+
version: 1.0.0.rc16
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jonas Schubert Erlandsson
|
|
@@ -11,7 +11,7 @@ authors:
|
|
|
11
11
|
autorequire:
|
|
12
12
|
bindir: bin
|
|
13
13
|
cert_chain: []
|
|
14
|
-
date: 2026-08-
|
|
14
|
+
date: 2026-08-19 00:00:00.000000000 Z
|
|
15
15
|
dependencies:
|
|
16
16
|
- !ruby/object:Gem::Dependency
|
|
17
17
|
name: base64
|
|
@@ -61,14 +61,14 @@ dependencies:
|
|
|
61
61
|
requirements:
|
|
62
62
|
- - "~>"
|
|
63
63
|
- !ruby/object:Gem::Version
|
|
64
|
-
version: 1.4.
|
|
64
|
+
version: 1.4.1
|
|
65
65
|
type: :runtime
|
|
66
66
|
prerelease: false
|
|
67
67
|
version_requirements: !ruby/object:Gem::Requirement
|
|
68
68
|
requirements:
|
|
69
69
|
- - "~>"
|
|
70
70
|
- !ruby/object:Gem::Version
|
|
71
|
-
version: 1.4.
|
|
71
|
+
version: 1.4.1
|
|
72
72
|
description: Fortnox F3 REST API library, based on rest-easy.
|
|
73
73
|
email:
|
|
74
74
|
- info@accodeing.com
|
|
@@ -120,6 +120,7 @@ files:
|
|
|
120
120
|
- lib/fortnox/structs/invoice_row.rb
|
|
121
121
|
- lib/fortnox/structs/order_row.rb
|
|
122
122
|
- lib/fortnox/types.rb
|
|
123
|
+
- lib/fortnox/types/housework.rb
|
|
123
124
|
- lib/fortnox/version.rb
|
|
124
125
|
homepage: https://github.com/accodeing/fortnox
|
|
125
126
|
licenses:
|