restful-jsonapi 0.0.10 → 0.0.11

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: f35fb3c43cd68b559563b31892b4a3929b5b7326
4
- data.tar.gz: 1db27c7d5d17955a03c3eece8f779a2788d63e73
3
+ metadata.gz: c95b843d237e9fb6a1d54a06d9fa56b593ca139e
4
+ data.tar.gz: 2011d6e50f9ba1288388459e12d3771cf06d2504
5
5
  SHA512:
6
- metadata.gz: 8cc05db93720be70a6e664cf6318de16dd62feb71812cfee5366206ac7ad24a529860be1f3a63c8d181b7f606cd42ad1cb51a8ade0d1c792bdc0e86043685a11
7
- data.tar.gz: 1a3f64688c9b18cfb3ef8a109b36a8eb14a45ced91c9666fc4cbb1c1cfd8c5e39b6c8cb1486503f0adf5836c8ad1196166b00575cff47306181922499e0bd618
6
+ metadata.gz: 27c58c0708376897a6e22ff0cf37e7105c3ab3089e802ba3e951712417737f4f6c1cbc1099e7eae7aec2ac05960089a2f773db288d6c0c5e6bedc376710e8a31
7
+ data.tar.gz: 5e02c6952a73781270cf5e3d99e74d0c0a33b413fe0711f9f1976a7afda3e4ed90da633dc1593ec93e0eea1d65ec02c064d1d51e90b9fec8fcf0158a8ac1f435
@@ -50,18 +50,22 @@ module Restful
50
50
  end
51
51
 
52
52
  def restify_has_many(relationship_name, relationship_data)
53
- if relationship_data[:data].select(&:attributes).blank?
54
- relationship_key = relationship_name.to_s.singularize.underscore+"_ids"
55
- new_params[relationship_key] ||= []
56
- relationship_data[:data].each do |vv|
57
- new_params[relationship_key].push vv[:id]
58
- end unless relationship_data[:data].nil?
59
- else
60
- relationship_key = relationship_name.to_s.underscore+"_attributes"
61
- new_params[relationship_key] ||= []
62
- relationship_data[:data].each do |vv|
63
- new_params[relationship_key].push restify_data(relationship_name,vv[:data])
64
- end unless relationship_data[:data].nil?
53
+ if relationship_data[:data].present?
54
+ if relationship_data[:data].select{|d|d[:attributes]||d[:relationships]}.blank?
55
+ relationship_key = relationship_name.to_s.singularize.underscore+"_ids"
56
+ relationship = []
57
+ relationship_data[:data].each do |vv|
58
+ relationship.push vv[:id]
59
+ end
60
+ {relationship_key => relationship}
61
+ else
62
+ relationship_key = relationship_name.to_s.underscore+"_attributes"
63
+ relationship = []
64
+ relationship_data[:data].each do |vv|
65
+ relationship.push restify_data(relationship_name,vv)
66
+ end
67
+ {relationship_key => relationship}
68
+ end
65
69
  end
66
70
  end
67
71
 
@@ -1,5 +1,5 @@
1
1
  module Restful
2
2
  module Jsonapi
3
- VERSION = "0.0.10"
3
+ VERSION = "0.0.11"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: restful-jsonapi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zach Wentz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-06 00:00:00.000000000 Z
11
+ date: 2015-08-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler