jsonapi_mapper 0.1.4 → 0.1.7

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: 9883b69c0cc95639ba89dd3437199363426fb85a
4
- data.tar.gz: a76c19f1d15ad85f037f30d3bac31f669b2774f5
3
+ metadata.gz: c8215f3b18c5d608114f5df86dc5e76cf4c392ec
4
+ data.tar.gz: c4934e364b4f49a2fa0f7d24bd1a48d18a900051
5
5
  SHA512:
6
- metadata.gz: 304d9fb7484f3a7c405afe014cfc159bc0a3c25f94983e00de6bd9264ed2aa25b724891e46707fd01931393696dcad64162226bfe693ea0194d310b67e1bf280
7
- data.tar.gz: 7556af75805a07a6fc8acefdf303b0355d2bd1ed830169baf37695876bb1aa30be7a70c5e824d7a5f5cc624620f613a247286dfda73b29aefb3e88dcb5cb8cce
6
+ metadata.gz: 527083a845518803ee6e7275f1be9d6eda8db71cbd3413d04657c914e43b8236e849ccc36b9d35eef00d46788119b7c98e2ba0a9d065b8ae4e43131bd193e278
7
+ data.tar.gz: 33cfeff547bcee15780d1c1b6d1c87d1e559868ac92ede4a6204375c9bc6130764eaa27f45faa2233dcb786798693fc04a510a51e1037530529d1c7c992e75f1
@@ -26,13 +26,13 @@ Gem::Specification.new do |spec|
26
26
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
27
27
  spec.require_paths = ["lib"]
28
28
 
29
- spec.add_dependency "activesupport", '~> 4.2', '>= 4.2.0'
30
- spec.add_dependency "activemodel",'~> 4.2', '>= 4.2.0'
29
+ spec.add_dependency "activesupport", '~> 5.1', '>= 5.1.4'
30
+ spec.add_dependency "activemodel",'~> 5.1', '>= 5.1.4'
31
31
 
32
32
  spec.add_development_dependency "bundler", "~> 1.15"
33
33
  spec.add_development_dependency "rake", "~> 10.0"
34
34
  spec.add_development_dependency "rspec", "~> 3.0"
35
- spec.add_development_dependency "activerecord", '~> 4.2', '>= 4.2.0'
35
+ spec.add_development_dependency "activerecord", '~> 5.1', '>= 5.1.4'
36
36
  spec.add_development_dependency "sqlite3", "~> 1.0", ">= 1.0.0"
37
37
  spec.add_development_dependency "byebug", "~> 6.0", ">= 6.0.0"
38
38
  end
@@ -102,8 +102,9 @@ module JsonapiMapper
102
102
  relationships = {}
103
103
  json.fetch(:relationships, {}).each do |name, value|
104
104
  next unless type.rule.attributes.include?(name)
105
+ next if value[:data].blank?
105
106
  relationships[renamed_attr(type.name, name)] = if value[:data].is_a?(Array)
106
- value[:data].map{|v| build_id(v) }
107
+ value[:data].map{|v| build_id(v) }
107
108
  else
108
109
  build_id(value[:data])
109
110
  end
@@ -172,8 +173,7 @@ module JsonapiMapper
172
173
 
173
174
  def save_all
174
175
  return false unless all.all?(&:valid?)
175
- all.each(&:save)
176
- true
176
+ all.collect(&:save).all?
177
177
  end
178
178
 
179
179
  def all_valid?
@@ -207,7 +207,7 @@ module JsonapiMapper
207
207
  data.each_with_index do |resource, i|
208
208
  errors << serialize_errors_for("/data/#{i}", resource)
209
209
  end
210
- else
210
+ elsif data
211
211
  errors << serialize_errors_for("/data", data)
212
212
  end
213
213
 
@@ -1,3 +1,3 @@
1
1
  module JsonapiMapper
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.7"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jsonapi_mapper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - nubis
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-01-11 00:00:00.000000000 Z
11
+ date: 2018-05-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -16,40 +16,40 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '4.2'
19
+ version: '5.1'
20
20
  - - ">="
21
21
  - !ruby/object:Gem::Version
22
- version: 4.2.0
22
+ version: 5.1.4
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - "~>"
28
28
  - !ruby/object:Gem::Version
29
- version: '4.2'
29
+ version: '5.1'
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
- version: 4.2.0
32
+ version: 5.1.4
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: activemodel
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: '4.2'
39
+ version: '5.1'
40
40
  - - ">="
41
41
  - !ruby/object:Gem::Version
42
- version: 4.2.0
42
+ version: 5.1.4
43
43
  type: :runtime
44
44
  prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
46
46
  requirements:
47
47
  - - "~>"
48
48
  - !ruby/object:Gem::Version
49
- version: '4.2'
49
+ version: '5.1'
50
50
  - - ">="
51
51
  - !ruby/object:Gem::Version
52
- version: 4.2.0
52
+ version: 5.1.4
53
53
  - !ruby/object:Gem::Dependency
54
54
  name: bundler
55
55
  requirement: !ruby/object:Gem::Requirement
@@ -98,20 +98,20 @@ dependencies:
98
98
  requirements:
99
99
  - - "~>"
100
100
  - !ruby/object:Gem::Version
101
- version: '4.2'
101
+ version: '5.1'
102
102
  - - ">="
103
103
  - !ruby/object:Gem::Version
104
- version: 4.2.0
104
+ version: 5.1.4
105
105
  type: :development
106
106
  prerelease: false
107
107
  version_requirements: !ruby/object:Gem::Requirement
108
108
  requirements:
109
109
  - - "~>"
110
110
  - !ruby/object:Gem::Version
111
- version: '4.2'
111
+ version: '5.1'
112
112
  - - ">="
113
113
  - !ruby/object:Gem::Version
114
- version: 4.2.0
114
+ version: 5.1.4
115
115
  - !ruby/object:Gem::Dependency
116
116
  name: sqlite3
117
117
  requirement: !ruby/object:Gem::Requirement