caprese 0.4.0 → 0.4.1
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 +5 -1
- data/lib/caprese/serializer/concerns/links.rb +9 -7
- data/lib/caprese/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 49d0eb87e9e10a1738d98c359dc8099eac6063bc
|
4
|
+
data.tar.gz: 799eee055e9baefbe79bdd343a1dd1a613de62a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0d547c69920b3a1ab3e2073e7c329627f65a79fbbbba83e1d6a75b715e38ad67f99e5bf7d00c49f793750df1cf58d1cfbeec16e3e5d7ebcc6f740ce441be9abf
|
7
|
+
data.tar.gz: 94cbe72dea9c672aa3730ec6c4533ca7bdaaf395cd56f329c6382578817c4710d452cb38d3be3b0f8726f0f5da961c151f5670c076c80e4d6c0dc8811faa5d60
|
data/CHANGELOG.md
CHANGED
@@ -164,4 +164,8 @@
|
|
164
164
|
* Example: `has_many :productos => ProductSerializer`
|
165
165
|
* New behavior: Relationships in serializers use the name of the relationship as an assumption about the serializer for that relationship
|
166
166
|
* Example: `has_many :productos => ProductoSerializer`
|
167
|
-
* Can override by passing any serializer: `has_many :productos, serializer: ProductSerializer`
|
167
|
+
* Can override by passing any serializer: `has_many :productos, serializer: ProductSerializer`
|
168
|
+
|
169
|
+
## 0.4.1
|
170
|
+
|
171
|
+
* Allows `:self` link to be overridden in serializers that subclass Caprese::Serializer
|
@@ -11,13 +11,15 @@ module Caprese
|
|
11
11
|
# @example
|
12
12
|
# object = Order<@token='asd27h'>
|
13
13
|
# links = { self: '/api/v1/orders/asd27hß' }
|
14
|
-
|
15
|
-
|
16
|
-
serializer.
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
14
|
+
unless self._links[:self]
|
15
|
+
link :self do
|
16
|
+
if object.persisted? && (url = serializer.class.route_for(object))
|
17
|
+
serializer.url_helpers.send(
|
18
|
+
url,
|
19
|
+
object.read_attribute(Caprese.config.resource_primary_key),
|
20
|
+
host: serializer.class.send(:caprese_default_url_options_host)
|
21
|
+
)
|
22
|
+
end
|
21
23
|
end
|
22
24
|
end
|
23
25
|
end
|
data/lib/caprese/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: caprese
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Landgrebe
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date: 2017-
|
13
|
+
date: 2017-10-19 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: active_model_serializers
|