restful-jsonapi 1.0.1 → 1.0.6
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/lib/restful/jsonapi/railtie.rb +1 -1
- data/lib/restful/jsonapi/restify_param.rb +10 -8
- data/lib/restful/jsonapi/version.rb +1 -1
- data/restful-jsonapi.gemspec +3 -3
- metadata +15 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e8c629eaa79b98d7fb7a0e267f6b3b8a1d250794
|
4
|
+
data.tar.gz: 7133eca2fcf09c8dab46ab30a892b206b5524b74
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 82e7171dbf181d4ef43eb32ab8949c82bf67586a985e40ce6139f04b8059002ad7320c96b27b838d60de34202d1be2f203257570acff5547bdc0842d422d79cc
|
7
|
+
data.tar.gz: 44d98ca953818240d2caa480d984f0ae5c86497afe6536cf351b668b99b4c916f26c7eb25a3ed7748a23b3447dc071a5fb6d3cf69dfd05e134be188b53c8aa69
|
@@ -31,21 +31,23 @@ module Restful
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def restify_relationship(relationship_name, relationship_data)
|
34
|
-
if data_is_present?(relationship_data[:data])
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
restify_belongs_to(relationship_name, relationship_data)
|
39
|
-
end
|
34
|
+
if data_is_present?(relationship_data[:data]) && relationship_data[:data].is_a?(Array)
|
35
|
+
restify_has_many(relationship_name, relationship_data)
|
36
|
+
elsif relationship_data.present? && relationship_data.has_key?(:data)
|
37
|
+
restify_belongs_to(relationship_name, relationship_data)
|
40
38
|
end
|
41
39
|
end
|
42
40
|
|
43
41
|
def restify_belongs_to(relationship_name, relationship_data)
|
44
|
-
if relationship_data[:data].values_at(:attributes,:relationships).compact.length > 0
|
42
|
+
if relationship_data[:data].present? and relationship_data[:data].values_at(:attributes,:relationships).compact.length > 0
|
45
43
|
relationship_key = relationship_name.to_s.underscore+"_attributes"
|
46
44
|
{relationship_key => restify_data(relationship_name,relationship_data[:data])}
|
47
45
|
else
|
48
|
-
|
46
|
+
if relationship_data[:data].nil? || relationship_data[:data].empty?
|
47
|
+
{"#{relationship_name.underscore}_id" => nil}
|
48
|
+
else
|
49
|
+
{"#{relationship_name.underscore}_id" => relationship_data[:data][:id]}
|
50
|
+
end
|
49
51
|
end
|
50
52
|
end
|
51
53
|
|
data/restful-jsonapi.gemspec
CHANGED
@@ -6,8 +6,8 @@ require 'restful/jsonapi/version'
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "restful-jsonapi"
|
8
8
|
spec.version = Restful::Jsonapi::VERSION
|
9
|
-
spec.authors = ["Zach Wentz", "Ryan Johnston", "David Lee"]
|
10
|
-
spec.email = ["zwentz@netflix.com", "ryanj@netflix.com", "dalee@netflix.com"]
|
9
|
+
spec.authors = ["Zach Wentz", "Ryan Johnston", "David Lee", "Adam Gross"]
|
10
|
+
spec.email = ["zwentz@netflix.com", "ryanj@netflix.com", "dalee@netflix.com", "agross@netflix.com"]
|
11
11
|
spec.summary = %q{Nice type and params for temporary JSONAPI support.}
|
12
12
|
spec.description = %q{Nice type and params for temporary JSONAPI support.}
|
13
13
|
spec.homepage = "https://github.com/Netflix/restful-jsonapi"
|
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_dependency "rails", "
|
21
|
+
spec.add_dependency "rails", [">=4", "< 6"]
|
22
22
|
|
23
23
|
spec.add_development_dependency "bundler", "~> 1.7"
|
24
24
|
spec.add_development_dependency "rake", "~> 10.0"
|
metadata
CHANGED
@@ -1,31 +1,38 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: restful-jsonapi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Zach Wentz
|
8
8
|
- Ryan Johnston
|
9
9
|
- David Lee
|
10
|
+
- Adam Gross
|
10
11
|
autorequire:
|
11
12
|
bindir: bin
|
12
13
|
cert_chain: []
|
13
|
-
date:
|
14
|
+
date: 2018-01-22 00:00:00.000000000 Z
|
14
15
|
dependencies:
|
15
16
|
- !ruby/object:Gem::Dependency
|
16
17
|
name: rails
|
17
18
|
requirement: !ruby/object:Gem::Requirement
|
18
19
|
requirements:
|
19
|
-
- - "
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '4'
|
23
|
+
- - "<"
|
20
24
|
- !ruby/object:Gem::Version
|
21
|
-
version:
|
25
|
+
version: '6'
|
22
26
|
type: :runtime
|
23
27
|
prerelease: false
|
24
28
|
version_requirements: !ruby/object:Gem::Requirement
|
25
29
|
requirements:
|
26
|
-
- - "
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '4'
|
33
|
+
- - "<"
|
27
34
|
- !ruby/object:Gem::Version
|
28
|
-
version:
|
35
|
+
version: '6'
|
29
36
|
- !ruby/object:Gem::Dependency
|
30
37
|
name: bundler
|
31
38
|
requirement: !ruby/object:Gem::Requirement
|
@@ -59,6 +66,7 @@ email:
|
|
59
66
|
- zwentz@netflix.com
|
60
67
|
- ryanj@netflix.com
|
61
68
|
- dalee@netflix.com
|
69
|
+
- agross@netflix.com
|
62
70
|
executables: []
|
63
71
|
extensions: []
|
64
72
|
extra_rdoc_files: []
|
@@ -96,7 +104,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
96
104
|
version: '0'
|
97
105
|
requirements: []
|
98
106
|
rubyforge_project:
|
99
|
-
rubygems_version: 2.
|
107
|
+
rubygems_version: 2.5.1
|
100
108
|
signing_key:
|
101
109
|
specification_version: 4
|
102
110
|
summary: Nice type and params for temporary JSONAPI support.
|