gqli 0.6.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +3 -3
  3. data/CHANGELOG.md +17 -0
  4. data/Gemfile.lock +103 -82
  5. data/README.md +0 -5
  6. data/coverage/.last_run.json +1 -1
  7. data/coverage/.resultset.json +1774 -1205
  8. data/coverage/assets/0.12.3/DataTables-1.10.20/images/sort_asc.png +0 -0
  9. data/coverage/assets/0.12.3/DataTables-1.10.20/images/sort_asc_disabled.png +0 -0
  10. data/coverage/assets/0.12.3/DataTables-1.10.20/images/sort_both.png +0 -0
  11. data/coverage/assets/0.12.3/DataTables-1.10.20/images/sort_desc.png +0 -0
  12. data/coverage/assets/0.12.3/DataTables-1.10.20/images/sort_desc_disabled.png +0 -0
  13. data/coverage/assets/0.12.3/application.css +1 -0
  14. data/coverage/assets/0.12.3/application.js +7 -0
  15. data/coverage/assets/{0.10.2 → 0.12.3}/colorbox/border.png +0 -0
  16. data/coverage/assets/{0.10.2 → 0.12.3}/colorbox/controls.png +0 -0
  17. data/coverage/assets/{0.10.2 → 0.12.3}/colorbox/loading.gif +0 -0
  18. data/coverage/assets/{0.10.2 → 0.12.3}/colorbox/loading_background.png +0 -0
  19. data/coverage/assets/{0.10.2 → 0.12.3}/favicon_green.png +0 -0
  20. data/coverage/assets/{0.10.2 → 0.12.3}/favicon_red.png +0 -0
  21. data/coverage/assets/{0.10.2 → 0.12.3}/favicon_yellow.png +0 -0
  22. data/coverage/assets/{0.10.2/smoothness → 0.12.3}/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  23. data/coverage/assets/{0.10.2/smoothness → 0.12.3}/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  24. data/coverage/assets/{0.10.2/smoothness → 0.12.3}/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  25. data/coverage/assets/{0.10.2/smoothness → 0.12.3}/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  26. data/coverage/assets/{0.10.2/smoothness → 0.12.3}/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  27. data/coverage/assets/{0.10.2/smoothness → 0.12.3}/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  28. data/coverage/assets/{0.10.2/smoothness → 0.12.3}/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  29. data/coverage/assets/{0.10.2/smoothness → 0.12.3}/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  30. data/coverage/assets/{0.10.2/smoothness → 0.12.3}/images/ui-icons_222222_256x240.png +0 -0
  31. data/coverage/assets/{0.10.2/smoothness → 0.12.3}/images/ui-icons_2e83ff_256x240.png +0 -0
  32. data/coverage/assets/{0.10.2/smoothness → 0.12.3}/images/ui-icons_454545_256x240.png +0 -0
  33. data/coverage/assets/{0.10.2/smoothness → 0.12.3}/images/ui-icons_888888_256x240.png +0 -0
  34. data/coverage/assets/{0.10.2/smoothness → 0.12.3}/images/ui-icons_cd0a0a_256x240.png +0 -0
  35. data/coverage/assets/{0.10.2 → 0.12.3}/loading.gif +0 -0
  36. data/coverage/assets/{0.10.2 → 0.12.3}/magnify.png +0 -0
  37. data/coverage/index.html +19376 -7403
  38. data/doc/GQLi/Base.html +11 -11
  39. data/doc/GQLi/Client.html +175 -41
  40. data/doc/GQLi/Contentful.html +13 -11
  41. data/doc/GQLi/DSL.html +298 -30
  42. data/doc/GQLi/EnumValue.html +8 -8
  43. data/doc/GQLi/Fragment.html +8 -8
  44. data/doc/GQLi/Github.html +6 -6
  45. data/doc/GQLi/Introspection.html +46 -48
  46. data/doc/GQLi/Mutation.html +390 -0
  47. data/doc/GQLi/Node.html +8 -8
  48. data/doc/GQLi/Query.html +6 -6
  49. data/doc/GQLi/Response.html +87 -13
  50. data/doc/GQLi/Subscription.html +390 -0
  51. data/doc/GQLi/Validation.html +20 -20
  52. data/doc/GQLi.html +9 -9
  53. data/doc/_index.html +37 -7
  54. data/doc/class_list.html +3 -3
  55. data/doc/css/style.css +3 -2
  56. data/doc/file.CHANGELOG.html +43 -13
  57. data/doc/file.LICENSE.html +6 -6
  58. data/doc/file.README.html +31 -84
  59. data/doc/file_list.html +2 -2
  60. data/doc/frames.html +2 -2
  61. data/doc/index.html +31 -84
  62. data/doc/js/app.js +25 -3
  63. data/doc/method_list.html +147 -43
  64. data/doc/top-level-namespace.html +6 -6
  65. data/gqli.gemspec +5 -6
  66. data/lib/gqli/client.rb +25 -5
  67. data/lib/gqli/clients/contentful.rb +3 -2
  68. data/lib/gqli/dsl.rb +16 -1
  69. data/lib/gqli/introspection.rb +1 -3
  70. data/lib/gqli/mutation.rb +27 -0
  71. data/lib/gqli/response.rb +15 -2
  72. data/lib/gqli/subscription.rb +1 -1
  73. data/lib/gqli/validation.rb +15 -12
  74. data/lib/gqli/version.rb +1 -1
  75. data/spec/fixtures/vcr_cassettes/client.yml +98 -27
  76. data/spec/fixtures/vcr_cassettes/mutation_client.yml +4364 -0
  77. data/spec/lib/gqli/client_spec.rb +53 -0
  78. data/spec/lib/gqli/dsl_spec.rb +72 -2
  79. data/spec/lib/gqli/introspection_spec.rb +54 -0
  80. data/spec/lib/gqli/response_spec.rb +51 -0
  81. metadata +64 -73
  82. data/coverage/assets/0.10.2/application.css +0 -799
  83. data/coverage/assets/0.10.2/application.js +0 -1707
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GQLi
4
- # Query node
4
+ # Subscription node
5
5
  class Subscription < Base
6
6
  # Serializes to a GraphQL string
7
7
  def to_gql
@@ -3,11 +3,11 @@
3
3
  module GQLi
4
4
  # Validations
5
5
  class Validation
6
- attr_reader :schema, :query, :errors
6
+ attr_reader :schema, :root, :errors
7
7
 
8
- def initialize(schema, query)
8
+ def initialize(schema, root)
9
9
  @schema = schema
10
- @query = query
10
+ @root = root
11
11
  @errors = []
12
12
 
13
13
  validate
@@ -21,24 +21,27 @@ module GQLi
21
21
  protected
22
22
 
23
23
  def validate
24
- fail 'Not a Query object' unless query.is_a?(Query)
24
+ @errors = []
25
+
26
+ type_name = root.class.name.split('::').last
27
+ validate_type(type_name)
28
+ end
29
+
30
+ private
25
31
 
26
- query_type = types.find { |t| t.name.casecmp('query').zero? }
27
- query.__nodes.each do |node|
32
+ def validate_type(type)
33
+ root_type = types.find { |t| t.name.casecmp(type).zero? }
34
+ root.__nodes.each do |node|
28
35
  begin
29
- validate_node(query_type, node)
36
+ validate_node(root_type, node)
30
37
  rescue StandardError => e
31
38
  errors << e
32
39
  end
33
40
  end
34
41
 
35
- true
36
- rescue StandardError => e
37
- errors << e
42
+ valid?
38
43
  end
39
44
 
40
- private
41
-
42
45
  def remove_alias(name)
43
46
  return name unless name.include?(':')
44
47
 
data/lib/gqli/version.rb CHANGED
@@ -3,5 +3,5 @@
3
3
  # GraphQL Client and DSL library
4
4
  module GQLi
5
5
  # Gem version
6
- VERSION = '0.6.0'
6
+ VERSION = '1.2.0'
7
7
  end