graphql-client 0.11.0 → 0.11.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/graphql/client/schema/enum_type.rb +10 -2
- 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: d61e0c76bd9b0a1399a8dc46f38bdb1e1bc894fe
|
4
|
+
data.tar.gz: e4db7d3d02dbeefad9704a6dc8ae6ae951ec4753
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cc3888e41dc5d7c4881373011bbcd3d72f7b0ca929a172b59320ac5aad3648e2094279244ac1e927faa02ceca66042e07fb817c8e8f1950a4a7db0234b4a2ec6
|
7
|
+
data.tar.gz: 88175d34d57de1b9478a6e800eb2b0fffee3617d1acd4217eaa384a9b18fd941ca31a69db1172f478093ad546901107ad8fee6887a46f543a942abe16989b378
|
@@ -18,6 +18,7 @@ module GraphQL
|
|
18
18
|
end
|
19
19
|
|
20
20
|
@type = type
|
21
|
+
@values = {}
|
21
22
|
|
22
23
|
all_values = type.values.keys
|
23
24
|
|
@@ -29,14 +30,18 @@ module GraphQL
|
|
29
30
|
str.define_singleton_method("#{value.downcase}?") { true }
|
30
31
|
str.freeze
|
31
32
|
const_set(value, str)
|
33
|
+
@values[str] = str
|
32
34
|
end
|
35
|
+
|
36
|
+
@values.freeze
|
33
37
|
end
|
34
38
|
|
35
39
|
def define_class(definition, irep_node)
|
36
40
|
self
|
37
41
|
end
|
38
42
|
|
39
|
-
# Internal: Cast JSON value to
|
43
|
+
# Internal: Cast JSON value to the enumeration's corresponding constant string instance
|
44
|
+
# with the convenience predicate methods.
|
40
45
|
#
|
41
46
|
# values - JSON value
|
42
47
|
# errors - Errors instance
|
@@ -44,7 +49,10 @@ module GraphQL
|
|
44
49
|
# Returns String or nil.
|
45
50
|
def cast(value, _errors = nil)
|
46
51
|
case value
|
47
|
-
when String
|
52
|
+
when String
|
53
|
+
raise Error, "unexpected enum value #{value}" unless @values.key?(value)
|
54
|
+
@values[value]
|
55
|
+
when NilClass
|
48
56
|
value
|
49
57
|
else
|
50
58
|
raise InvariantError, "expected value to be a String, but was #{value.class}"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: graphql-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.11.
|
4
|
+
version: 0.11.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GitHub
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-05-
|
11
|
+
date: 2017-05-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|