rest-easy 1.4.1 → 1.4.2
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 +30 -1
- data/lib/rest_easy/meta.rb +5 -0
- data/lib/rest_easy/resource.rb +6 -3
- data/lib/rest_easy/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a192d482f07dc654cae8267e3166742ee45d90c4bf960f54f632f94ca11c20a6
|
|
4
|
+
data.tar.gz: 74b41469d03fb34c19616774f9ccb97dfd3191f937dfcf2e96560986333ccf12
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b493ff7a6f39fa303665e6e09174b2f664d35960e18864dbb39e3d2cf95fe3ea13543f4384fc3a4c4656d8ada2b029f486ccf99ac6e2d9dda983c74e05717f6b
|
|
7
|
+
data.tar.gz: fdec9a5343a0bf002fe43b1532849ec7a28520ee95392e4beddcd0e11af1b3fd2ec0c9c2c11eceeafb65ea8dd640281fe521f1613022bc43f60615ca0afc1095
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,34 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [1.4.2] - 2026-09-23
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
|
|
9
|
+
- **`update` no longer discards state it should carry forward.** It rebuilt
|
|
10
|
+
the instance's metadata and its change set from scratch instead of
|
|
11
|
+
inheriting them, which broke three things at once:
|
|
12
|
+
|
|
13
|
+
- An instance that had never been saved came back marked as persisted, so
|
|
14
|
+
`save` took the update branch: a PUT to the collection path with no id in
|
|
15
|
+
it, for a record the API has never seen, instead of a POST that creates
|
|
16
|
+
one. Building a record and adjusting it before the first save is the
|
|
17
|
+
ordinary way to use an immutable resource, and it could not produce a
|
|
18
|
+
correct create request.
|
|
19
|
+
- Chained updates kept only the last call's fields. After
|
|
20
|
+
`a.update(x: 1).update(y: 2)`, `__changes__` reported just `y` while `x`
|
|
21
|
+
read back as `1` on the instance, so a partial payload built from the
|
|
22
|
+
change set left out a field the object claimed to carry, and nothing
|
|
23
|
+
raised.
|
|
24
|
+
- Metadata set by a `before_parse` hook lives on the instance, not the
|
|
25
|
+
class, and was dropped. A consumer flagging parsed instances — to mark
|
|
26
|
+
the thin records a collection endpoint returns, say — lost the flag as
|
|
27
|
+
soon as anything called `update`.
|
|
28
|
+
|
|
29
|
+
`update` now inherits the receiver's metadata and merges its change set.
|
|
30
|
+
The metadata is copied rather than shared, so mutating an updated copy's
|
|
31
|
+
metadata still cannot reach the original's.
|
|
32
|
+
|
|
5
33
|
## [1.4.1] - 2026-08-18
|
|
6
34
|
|
|
7
35
|
### Fixed
|
|
@@ -167,7 +195,8 @@
|
|
|
167
195
|
|
|
168
196
|
Initial release.
|
|
169
197
|
|
|
170
|
-
[Unreleased]: https://github.com/accodeing/rest-easy/compare/v1.4.
|
|
198
|
+
[Unreleased]: https://github.com/accodeing/rest-easy/compare/v1.4.2...HEAD
|
|
199
|
+
[1.4.2]: https://github.com/accodeing/rest-easy/compare/v1.4.1...v1.4.2
|
|
171
200
|
[1.4.1]: https://github.com/accodeing/rest-easy/compare/v1.4.0...v1.4.1
|
|
172
201
|
[1.4.0]: https://github.com/accodeing/rest-easy/compare/v1.3.1...v1.4.0
|
|
173
202
|
[1.3.1]: https://github.com/accodeing/rest-easy/compare/v1.3.0...v1.3.1
|
data/lib/rest_easy/meta.rb
CHANGED
data/lib/rest_easy/resource.rb
CHANGED
|
@@ -598,7 +598,7 @@ module RestEasy
|
|
|
598
598
|
|
|
599
599
|
new_model = @model_attributes.merge(coerced)
|
|
600
600
|
new_instance = self.class.allocate
|
|
601
|
-
new_instance.send(:init_from_update, new_model, @api_data, coerced)
|
|
601
|
+
new_instance.send(:init_from_update, new_model, @api_data, __changes__.merge(coerced), @meta)
|
|
602
602
|
new_instance
|
|
603
603
|
end
|
|
604
604
|
|
|
@@ -801,11 +801,14 @@ module RestEasy
|
|
|
801
801
|
end
|
|
802
802
|
end
|
|
803
803
|
|
|
804
|
-
def init_from_update(new_model_attrs, original_api_data, changes)
|
|
804
|
+
def init_from_update(new_model_attrs, original_api_data, changes, meta)
|
|
805
805
|
@api_data = original_api_data
|
|
806
806
|
@model_attributes = new_model_attrs
|
|
807
807
|
@changes = changes
|
|
808
|
-
|
|
808
|
+
# Carried from the receiver, not rebuilt: an instance that was never
|
|
809
|
+
# saved stays new, so `save` still POSTs it, and metadata a parse hook
|
|
810
|
+
# set (which lives on the instance, not the class) survives the update.
|
|
811
|
+
@meta = meta.dup
|
|
809
812
|
end
|
|
810
813
|
end
|
|
811
814
|
end
|
data/lib/rest_easy/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rest-easy
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.4.
|
|
4
|
+
version: 1.4.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jonas Schubert Erlandsson
|
|
@@ -10,7 +10,7 @@ authors:
|
|
|
10
10
|
autorequire:
|
|
11
11
|
bindir: bin
|
|
12
12
|
cert_chain: []
|
|
13
|
-
date: 2026-
|
|
13
|
+
date: 2026-09-23 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: dry-types
|