restful-jsonapi 1.0.1 → 1.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c972daf4852a92faf8f7065e643ad06a0f667e5c
4
- data.tar.gz: bc4b308e1593f246371cd17b611395a97edc7ea7
3
+ metadata.gz: e8c629eaa79b98d7fb7a0e267f6b3b8a1d250794
4
+ data.tar.gz: 7133eca2fcf09c8dab46ab30a892b206b5524b74
5
5
  SHA512:
6
- metadata.gz: c3528828b80677b3c42499ce08f273c4bc102b3f2549d275d87864e0001abeccdbaaa04310e54ab95b0182b56e850ba2291ebddfe56da5315895c59daa6b7678
7
- data.tar.gz: b22d3bee7537de9c427c639c348aa1acef628096bc7acb53242f011bb04e3fa20b36e1b38f5797265f64b391041a47a62bc4bfceb093456533352d859fd9e735
6
+ metadata.gz: 82e7171dbf181d4ef43eb32ab8949c82bf67586a985e40ce6139f04b8059002ad7320c96b27b838d60de34202d1be2f203257570acff5547bdc0842d422d79cc
7
+ data.tar.gz: 44d98ca953818240d2caa480d984f0ae5c86497afe6536cf351b668b99b4c916f26c7eb25a3ed7748a23b3447dc071a5fb6d3cf69dfd05e134be188b53c8aa69
@@ -16,7 +16,7 @@ module Restful
16
16
  puts "Extending #{self} with Restful::Jsonapi::ActiveModelSerializer"
17
17
  include Restful::Jsonapi::ActiveModelSerializer
18
18
  end
19
- end
19
+ end if defined? ActiveModel::Serializer
20
20
  end
21
21
  end
22
22
  end
@@ -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
- if relationship_data[:data].is_a? Array
36
- restify_has_many(relationship_name, relationship_data)
37
- else
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
- {"#{relationship_name.underscore}_id" => relationship_data[:data][:id]}
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
 
@@ -1,5 +1,5 @@
1
1
  module Restful
2
2
  module Jsonapi
3
- VERSION = "1.0.1"
3
+ VERSION = "1.0.6"
4
4
  end
5
5
  end
@@ -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", "~>5.0.0"
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.1
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: 2016-08-26 00:00:00.000000000 Z
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: 5.0.0
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: 5.0.0
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.6.6
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.