jsonapi_compliable 0.10.9 → 0.11.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/Appraisals +2 -2
- data/README.md +29 -0
- data/gemfiles/rails_4.gemfile +3 -3
- data/gemfiles/rails_5.gemfile +3 -3
- data/jsonapi_compliable.gemspec +1 -1
- data/lib/jsonapi_compliable/base.rb +1 -1
- data/lib/jsonapi_compliable/util/render_options.rb +7 -0
- data/lib/jsonapi_compliable/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cdce2b040460bc3c66f0aa2a869e5be239cef593
|
4
|
+
data.tar.gz: 37e97590487dbd9eca8edc3157174f4826e79bba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0462e8f0e8745dcefafce80dd8c605254b7b28731a14d6d0c5fdd4cb2cae0575c22dc83d199b00269bbb78d77a2a22d6744b515bf05d4ad24fa0e845529d33e4
|
7
|
+
data.tar.gz: 6cbacdb485370394b01d8dd80a031b254e0712e182c833671a04c39d62037e2b61e79f9fd084b57e0ebd90cc3b279eb282ae42c0fea5e99f3dc93b817d1c9e7e
|
data/Appraisals
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
appraise "rails-4" do
|
2
2
|
gem "rails", "~> 4.1"
|
3
|
-
gem 'jsonapi-rails', '~> 0.
|
3
|
+
gem 'jsonapi-rails', '~> 0.3.1', require: 'jsonapi/rails'
|
4
4
|
gem 'rspec-rails'
|
5
5
|
end
|
6
6
|
|
7
7
|
appraise "rails-5" do
|
8
8
|
gem "rails", "~> 5.0"
|
9
|
-
gem 'jsonapi-rails', '~> 0.
|
9
|
+
gem 'jsonapi-rails', '~> 0.3.1', require: 'jsonapi/rails'
|
10
10
|
gem 'rspec-rails'
|
11
11
|
end
|
data/README.md
CHANGED
@@ -8,6 +8,35 @@
|
|
8
8
|
|
9
9
|
Supported Rails versions: >= 4.1
|
10
10
|
|
11
|
+
### Upgrading to 0.11.x
|
12
|
+
|
13
|
+
Due to a backwards-incompatibility introduced in the underlying
|
14
|
+
[jsonapi-rb](http://jsonapi-rb.org) gem, specifying custom serializers
|
15
|
+
now works slightly differently.
|
16
|
+
|
17
|
+
Before:
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
# app/serializers/serializable_post.rb
|
21
|
+
|
22
|
+
has_many :comments, class: SerializableSpecialComment
|
23
|
+
```
|
24
|
+
|
25
|
+
and/or
|
26
|
+
|
27
|
+
```ruby
|
28
|
+
render_jsonapi(post, class: SerializableSpecialPost)
|
29
|
+
```
|
30
|
+
|
31
|
+
This is now all handled at the controller level:
|
32
|
+
|
33
|
+
```ruby
|
34
|
+
render_jsonapi(post, class: {
|
35
|
+
Post: SerializableSpecialPost,
|
36
|
+
Comment: SerializableSpecialComment
|
37
|
+
})
|
38
|
+
```
|
39
|
+
|
11
40
|
### Upgrading to 0.10
|
12
41
|
|
13
42
|
`sideload_whitelist` has been moved from the resource to the controller:
|
data/gemfiles/rails_4.gemfile
CHANGED
@@ -3,15 +3,15 @@
|
|
3
3
|
source "https://rubygems.org"
|
4
4
|
|
5
5
|
gem "rails", "~> 4.1"
|
6
|
-
gem "jsonapi-rails", "~> 0.
|
6
|
+
gem "jsonapi-rails", "~> 0.3.1", require: "jsonapi/rails"
|
7
7
|
gem "rspec-rails"
|
8
8
|
|
9
9
|
group :test do
|
10
10
|
gem "pry"
|
11
|
-
gem "pry-byebug", :
|
11
|
+
gem "pry-byebug", platform: [:mri]
|
12
12
|
gem "appraisal"
|
13
13
|
gem "guard"
|
14
14
|
gem "guard-rspec"
|
15
15
|
end
|
16
16
|
|
17
|
-
gemspec :
|
17
|
+
gemspec path: "../"
|
data/gemfiles/rails_5.gemfile
CHANGED
@@ -3,15 +3,15 @@
|
|
3
3
|
source "https://rubygems.org"
|
4
4
|
|
5
5
|
gem "rails", "~> 5.0"
|
6
|
-
gem "jsonapi-rails", "~> 0.
|
6
|
+
gem "jsonapi-rails", "~> 0.3.1", require: "jsonapi/rails"
|
7
7
|
gem "rspec-rails"
|
8
8
|
|
9
9
|
group :test do
|
10
10
|
gem "pry"
|
11
|
-
gem "pry-byebug", :
|
11
|
+
gem "pry-byebug", platform: [:mri]
|
12
12
|
gem "appraisal"
|
13
13
|
gem "guard"
|
14
14
|
gem "guard-rspec"
|
15
15
|
end
|
16
16
|
|
17
|
-
gemspec :
|
17
|
+
gemspec path: "../"
|
data/jsonapi_compliable.gemspec
CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.require_paths = ["lib"]
|
19
19
|
|
20
20
|
# Pinning this version until backwards-incompatibility is addressed
|
21
|
-
spec.add_dependency 'jsonapi-serializable', '~> 0.
|
21
|
+
spec.add_dependency 'jsonapi-serializable', '~> 0.3.0'
|
22
22
|
|
23
23
|
spec.add_development_dependency "activerecord", ['>= 4.1', '< 6']
|
24
24
|
spec.add_development_dependency "kaminari", '~> 0.17'
|
@@ -6,7 +6,14 @@ module JsonapiCompliable
|
|
6
6
|
def self.generate(object, query_hash, overrides = {})
|
7
7
|
resolved = object.respond_to?(:resolve) ? object.resolve : object
|
8
8
|
|
9
|
+
inferrer = ::Hash.new do |h, k|
|
10
|
+
names = k.to_s.split('::')
|
11
|
+
klass = names.pop
|
12
|
+
h[k] = [*names, "Serializable#{klass}"].join('::').safe_constantize
|
13
|
+
end
|
14
|
+
|
9
15
|
options = {}
|
16
|
+
options[:class] = inferrer
|
10
17
|
options[:include] = query_hash[:include]
|
11
18
|
options[:jsonapi] = resolved
|
12
19
|
options[:fields] = query_hash[:fields]
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jsonapi_compliable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lee Richmond
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2018-01-
|
12
|
+
date: 2018-01-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: jsonapi-serializable
|
@@ -17,14 +17,14 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - "~>"
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: 0.
|
20
|
+
version: 0.3.0
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - "~>"
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: 0.
|
27
|
+
version: 0.3.0
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: activerecord
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|