motion-json-api 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -0
- data/lib/motion-json-api.rb +1 -0
- data/lib/motion-json-api/resource.rb +1 -4
- data/lib/motion-json-api/resources.rb +14 -0
- data/lib/motion-json-api/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0a5d7906763025f799597eb97a2b7f543ce9888e
|
4
|
+
data.tar.gz: f8fa53dc637bb00bb6b9af5fa8211380b793b66d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 056024d385cfb90f46e8dad04a6408deaa0702fb3805fee477369fdf00a474f994d1eec576fc229d543520098d1c92288dc5bd894e4f707c36bc7605555f688d
|
7
|
+
data.tar.gz: 36a98c1fc2c5acda46dbf948410b217cc874f8be7703c9392e87f86a6d73e61cc5f1edf692e466668a2d5ea4a5ba69135369a5482b273598d371e44eedef6f42
|
data/README.md
CHANGED
data/lib/motion-json-api.rb
CHANGED
@@ -101,10 +101,7 @@ module MotionJsonApi
|
|
101
101
|
top_level = [top_level].flatten
|
102
102
|
case object["data"]
|
103
103
|
when Array
|
104
|
-
return object
|
105
|
-
resource_klass = Resource._klass_for_type(data["type"])
|
106
|
-
resource_klass.new({"data" => data}, top_level, included)
|
107
|
-
end
|
104
|
+
return Resources.new(object, top_level, included)
|
108
105
|
when Hash
|
109
106
|
resource_klass = Resource._klass_for_type(object["data"]["type"])
|
110
107
|
resource_klass.new(object, top_level, included)
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module MotionJsonApi
|
2
|
+
class Resources
|
3
|
+
attr_accessor :links
|
4
|
+
attr_accessor :data
|
5
|
+
|
6
|
+
def initialize(object, top_level, included)
|
7
|
+
@links = object.fetch("links", {})
|
8
|
+
@data = object["data"].map do |data|
|
9
|
+
resource_klass = Resource._klass_for_type(data["type"])
|
10
|
+
resource_klass.new({"data" => data}, top_level, included)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: motion-json-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joffrey Jaffeux
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-12-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -66,6 +66,7 @@ files:
|
|
66
66
|
- lib/motion-json-api/descendants.rb
|
67
67
|
- lib/motion-json-api/exceptions.rb
|
68
68
|
- lib/motion-json-api/resource.rb
|
69
|
+
- lib/motion-json-api/resources.rb
|
69
70
|
- lib/motion-json-api/version.rb
|
70
71
|
homepage: https://github.com/jjaffeux/motion-json-api
|
71
72
|
licenses:
|