normalizr_ruby 0.1.0 → 0.1.1
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/README.md +2 -1
- data/lib/normalizr_ruby/converter.rb +2 -2
- data/lib/normalizr_ruby/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a9776c9f983df19c4e592d470d9447afc908bc29
|
|
4
|
+
data.tar.gz: 0998cbfe62dd88e856914a366de8aed0509c6729
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6f49d83f93e6da7e0bba8a95c631108cf3d5b36b5758fc6c6101b703e27792eeea88ca07dc20e76ee41c4c48f86288433ce930fa6976ecb768fee756d4bb3697
|
|
7
|
+
data.tar.gz: 756aa78c442b552287a9f31043f8476f9da362ce8c9d2d51c2497e8cbe696fe782fd7693141e23c711681dc318ffbf947fe38b1f2e751baf31d299d166cde27e
|
data/README.md
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
# NormalizrRuby
|
|
2
|
+
[](https://badge.fury.io/rb/normalizr_ruby)
|
|
2
3
|
[](https://travis-ci.org/oreshinya/normalizr_ruby)
|
|
3
4
|
|
|
4
|
-
[Normalizr](https://github.com/paularmstrong/normalizr) format JSON generator.
|
|
5
|
+
[Normalizr](https://github.com/paularmstrong/normalizr) format JSON generator for API server.
|
|
5
6
|
|
|
6
7
|
## Installation
|
|
7
8
|
|
|
@@ -3,7 +3,7 @@ module NormalizrRuby
|
|
|
3
3
|
class SchemaNotFound < StandardError; end
|
|
4
4
|
|
|
5
5
|
def self.get_schema_class(resource)
|
|
6
|
-
resource_class_name = resource.class.name
|
|
6
|
+
resource_class_name = resource.class.base_class.name
|
|
7
7
|
schema_class = "#{resource_class_name}Schema".safe_constantize
|
|
8
8
|
if schema_class.nil?
|
|
9
9
|
raise SchemaNotFound, "#{resource_class_name} is not found."
|
|
@@ -35,7 +35,7 @@ module NormalizrRuby
|
|
|
35
35
|
schema_class = options[:schema].presence || self.class.get_schema_class(resource)
|
|
36
36
|
schema = schema_class.new(resource, @context, options.except(:schema))
|
|
37
37
|
result = schema.object.id
|
|
38
|
-
entity_key = schema.object.class.name.pluralize.to_sym
|
|
38
|
+
entity_key = schema.object.class.base_class.name.pluralize.to_sym
|
|
39
39
|
hash = schema.attributes
|
|
40
40
|
schema.associations.each do |association, assoc_options|
|
|
41
41
|
association_result = walk(schema.object.send(association), assoc_options)
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: normalizr_ruby
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- shinya takahashi
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2016-08-
|
|
11
|
+
date: 2016-08-27 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|