graphql-rails-resolver 0.2.4 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/graphql/rails/resolver.rb +16 -3
- 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: bd138790cf8944a77acea1535d813421e37cdfdd
|
4
|
+
data.tar.gz: a61fbe2035032bf6dc0acd09ce6786635732f178
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5c0fe031a810c3368921b2e215da435a47a33f3694c060e91f5ca037577c5d23a3e2e1ffb78a3080446aa12b3b7e66271e42ac392803e4237e00a2fb88ba3fdf
|
7
|
+
data.tar.gz: ec1191eb7e4f9601f5eef38e59ea941615f2adf4d28a84f53a62c48230b8e69ac3dece258fd54cc03543216e68eb53cd245177633ade16cfec1dacee5a06f466
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,11 @@
|
|
1
1
|
# GraphQL::Rails::Resolver
|
2
2
|
## CHANGELOG
|
3
3
|
|
4
|
+
### Version 0.2.5
|
5
|
+
Adds heirarchal resolution strategy
|
6
|
+
|
7
|
+
The base resolver will now check for the field's resolver method on the object. If resolving `Child` on `Parent` it will now default to `Parent.child` instead of `Child.all`
|
8
|
+
|
4
9
|
### Version 0.2.4
|
5
10
|
Adds ID resolution for non-primary ID field arguments
|
6
11
|
Adds `get_field_args` to get type declarations for arguments
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module GraphQL
|
2
2
|
module Rails
|
3
3
|
class Resolver
|
4
|
-
VERSION = '0.2.
|
4
|
+
VERSION = '0.2.5'
|
5
5
|
|
6
6
|
attr_accessor :resolvers
|
7
7
|
|
@@ -10,7 +10,20 @@ module GraphQL
|
|
10
10
|
raise ArgumentError, "Resolver requires a callable type or nil" unless callable.respond_to? :call
|
11
11
|
end
|
12
12
|
|
13
|
-
@callable =
|
13
|
+
@callable =
|
14
|
+
if callable.present?
|
15
|
+
callable
|
16
|
+
else
|
17
|
+
Proc.new { |obj|
|
18
|
+
subfield = model.name.underscore.pluralize
|
19
|
+
if obj.respond_to? subfield
|
20
|
+
obj.send(subfield)
|
21
|
+
else
|
22
|
+
model.all
|
23
|
+
end
|
24
|
+
}
|
25
|
+
end
|
26
|
+
|
14
27
|
@obj = nil
|
15
28
|
@args = nil
|
16
29
|
@ctx = nil
|
@@ -41,7 +54,7 @@ module GraphQL
|
|
41
54
|
scope_name = scope_name.call(value) if scope_name.respond_to? :call
|
42
55
|
|
43
56
|
scope_args = []
|
44
|
-
scope_args.push(value) if params.key? :with_value
|
57
|
+
scope_args.push(value) if params.key? :with_value and params[:with_value] == true
|
45
58
|
|
46
59
|
@result = @result.send(scope_name, *scope_args) unless scope_name.nil?
|
47
60
|
# Match custom methods
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: graphql-rails-resolver
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cole Turner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-10-
|
11
|
+
date: 2016-10-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: graphql
|