graphql_client 0.3.3

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.
Files changed (73) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +5 -0
  3. data/.rubocop-http---shopify-github-io-ruby-style-guide-rubocop-yml +1133 -0
  4. data/.rubocop.yml +24 -0
  5. data/.travis.yml +6 -0
  6. data/CHANGELOG.md +3 -0
  7. data/CODE_OF_CONDUCT.md +45 -0
  8. data/CONTRIBUTING.md +28 -0
  9. data/CONTRIBUTING_DEVELOPER_CERTIFICATE_OF_ORIGIN.txt +37 -0
  10. data/Gemfile +8 -0
  11. data/LICENSE.md +21 -0
  12. data/README.md +96 -0
  13. data/Rakefile +13 -0
  14. data/bin/graphql-client +79 -0
  15. data/bin/rake +17 -0
  16. data/circle.yml +3 -0
  17. data/dev.yml +7 -0
  18. data/graphql_ruby_client.gemspec +26 -0
  19. data/lib/graphql_client.rb +46 -0
  20. data/lib/graphql_client/adapters/http_adapter.rb +72 -0
  21. data/lib/graphql_client/base.rb +53 -0
  22. data/lib/graphql_client/config.rb +42 -0
  23. data/lib/graphql_client/deserialization.rb +36 -0
  24. data/lib/graphql_client/error.rb +22 -0
  25. data/lib/graphql_client/graph_connection.rb +21 -0
  26. data/lib/graphql_client/graph_node.rb +24 -0
  27. data/lib/graphql_client/graph_object.rb +56 -0
  28. data/lib/graphql_client/introspection_query.rb +80 -0
  29. data/lib/graphql_client/query/add_inline_fragment.rb +42 -0
  30. data/lib/graphql_client/query/argument.rb +30 -0
  31. data/lib/graphql_client/query/document.rb +86 -0
  32. data/lib/graphql_client/query/field.rb +91 -0
  33. data/lib/graphql_client/query/fragment.rb +41 -0
  34. data/lib/graphql_client/query/has_selection_set.rb +72 -0
  35. data/lib/graphql_client/query/inline_fragment.rb +35 -0
  36. data/lib/graphql_client/query/mutation_document.rb +20 -0
  37. data/lib/graphql_client/query/operation.rb +46 -0
  38. data/lib/graphql_client/query/operations/mutation_operation.rb +17 -0
  39. data/lib/graphql_client/query/operations/query_operation.rb +17 -0
  40. data/lib/graphql_client/query/query_document.rb +20 -0
  41. data/lib/graphql_client/query/selection_set.rb +53 -0
  42. data/lib/graphql_client/response.rb +21 -0
  43. data/lib/graphql_client/response_connection.rb +18 -0
  44. data/lib/graphql_client/response_object.rb +32 -0
  45. data/lib/graphql_client/schema_patches.rb +17 -0
  46. data/lib/graphql_client/version.rb +7 -0
  47. data/shipit.rubygems.yml +1 -0
  48. data/shipit.yml +4 -0
  49. data/test/graphql_client/adapters/http_adapter_test.rb +111 -0
  50. data/test/graphql_client/config_test.rb +68 -0
  51. data/test/graphql_client/graph_connection_test.rb +8 -0
  52. data/test/graphql_client/graph_node_test.rb +8 -0
  53. data/test/graphql_client/graph_object_query_transforming_test.rb +156 -0
  54. data/test/graphql_client/graph_object_test.rb +142 -0
  55. data/test/graphql_client/graphql_client_test.rb +41 -0
  56. data/test/graphql_client/http_client_test.rb +52 -0
  57. data/test/graphql_client/query/add_inline_fragment_test.rb +57 -0
  58. data/test/graphql_client/query/arguments_test.rb +89 -0
  59. data/test/graphql_client/query/document_test.rb +246 -0
  60. data/test/graphql_client/query/field_test.rb +163 -0
  61. data/test/graphql_client/query/fragment_test.rb +45 -0
  62. data/test/graphql_client/query/inline_fragment_test.rb +37 -0
  63. data/test/graphql_client/query/mutation_document_test.rb +30 -0
  64. data/test/graphql_client/query/mutation_operation_test.rb +89 -0
  65. data/test/graphql_client/query/query_document_test.rb +30 -0
  66. data/test/graphql_client/query/query_operation_test.rb +262 -0
  67. data/test/graphql_client/query/selection_set_test.rb +116 -0
  68. data/test/graphql_client/response_connection_test.rb +50 -0
  69. data/test/graphql_client/response_object_test.rb +109 -0
  70. data/test/graphql_client/response_test.rb +67 -0
  71. data/test/support/fixtures/schema.json +13710 -0
  72. data/test/test_helper.rb +37 -0
  73. metadata +227 -0
@@ -0,0 +1,37 @@
1
+ require 'json'
2
+ require 'graphql'
3
+ require 'pry'
4
+ require 'simplecov'
5
+ require 'webmock/minitest'
6
+
7
+ SimpleCov.start
8
+
9
+ require 'graphql_client'
10
+ require 'minitest/autorun'
11
+
12
+ def fixture_path(name)
13
+ File.join(__dir__, '/support/fixtures', name)
14
+ end
15
+
16
+ def schema_fixture(name)
17
+ JSON.parse(File.read(fixture_path(name)))
18
+ end
19
+
20
+ def schema_type(type)
21
+ @schema.type(type.unwrap.name)
22
+ end
23
+
24
+ class Minitest::Test
25
+ def assert_valid_query(query_string, schema, operation_name: nil, variables: {})
26
+ query = GraphQL::Query.new(
27
+ schema,
28
+ query_string,
29
+ max_depth: 10,
30
+ max_complexity: 1000,
31
+ operation_name: operation_name,
32
+ variables: variables,
33
+ )
34
+
35
+ assert query.valid?, "Query is not valid. Validation errors:\n" + query.validation_errors.to_s
36
+ end
37
+ end
metadata ADDED
@@ -0,0 +1,227 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: graphql_client
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.3
5
+ platform: ruby
6
+ authors:
7
+ - Shopify
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-12-07 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: graphql_schema
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 0.1.5
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 0.1.5
27
+ - !ruby/object:Gem::Dependency
28
+ name: graphql
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 1.6.4
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 1.6.4
41
+ - !ruby/object:Gem::Dependency
42
+ name: minitest
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '5.8'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '5.8'
55
+ - !ruby/object:Gem::Dependency
56
+ name: pry
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rubocop
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: simplecov
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: webmock
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: 3.1.1
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: 3.1.1
125
+ description: ''
126
+ email: developers@jadedpixel.com
127
+ executables:
128
+ - graphql-client
129
+ extensions: []
130
+ extra_rdoc_files: []
131
+ files:
132
+ - ".gitignore"
133
+ - ".rubocop-http---shopify-github-io-ruby-style-guide-rubocop-yml"
134
+ - ".rubocop.yml"
135
+ - ".travis.yml"
136
+ - CHANGELOG.md
137
+ - CODE_OF_CONDUCT.md
138
+ - CONTRIBUTING.md
139
+ - CONTRIBUTING_DEVELOPER_CERTIFICATE_OF_ORIGIN.txt
140
+ - Gemfile
141
+ - LICENSE.md
142
+ - README.md
143
+ - Rakefile
144
+ - bin/graphql-client
145
+ - bin/rake
146
+ - circle.yml
147
+ - dev.yml
148
+ - graphql_ruby_client.gemspec
149
+ - lib/graphql_client.rb
150
+ - lib/graphql_client/adapters/http_adapter.rb
151
+ - lib/graphql_client/base.rb
152
+ - lib/graphql_client/config.rb
153
+ - lib/graphql_client/deserialization.rb
154
+ - lib/graphql_client/error.rb
155
+ - lib/graphql_client/graph_connection.rb
156
+ - lib/graphql_client/graph_node.rb
157
+ - lib/graphql_client/graph_object.rb
158
+ - lib/graphql_client/introspection_query.rb
159
+ - lib/graphql_client/query/add_inline_fragment.rb
160
+ - lib/graphql_client/query/argument.rb
161
+ - lib/graphql_client/query/document.rb
162
+ - lib/graphql_client/query/field.rb
163
+ - lib/graphql_client/query/fragment.rb
164
+ - lib/graphql_client/query/has_selection_set.rb
165
+ - lib/graphql_client/query/inline_fragment.rb
166
+ - lib/graphql_client/query/mutation_document.rb
167
+ - lib/graphql_client/query/operation.rb
168
+ - lib/graphql_client/query/operations/mutation_operation.rb
169
+ - lib/graphql_client/query/operations/query_operation.rb
170
+ - lib/graphql_client/query/query_document.rb
171
+ - lib/graphql_client/query/selection_set.rb
172
+ - lib/graphql_client/response.rb
173
+ - lib/graphql_client/response_connection.rb
174
+ - lib/graphql_client/response_object.rb
175
+ - lib/graphql_client/schema_patches.rb
176
+ - lib/graphql_client/version.rb
177
+ - shipit.rubygems.yml
178
+ - shipit.yml
179
+ - test/graphql_client/adapters/http_adapter_test.rb
180
+ - test/graphql_client/config_test.rb
181
+ - test/graphql_client/graph_connection_test.rb
182
+ - test/graphql_client/graph_node_test.rb
183
+ - test/graphql_client/graph_object_query_transforming_test.rb
184
+ - test/graphql_client/graph_object_test.rb
185
+ - test/graphql_client/graphql_client_test.rb
186
+ - test/graphql_client/http_client_test.rb
187
+ - test/graphql_client/query/add_inline_fragment_test.rb
188
+ - test/graphql_client/query/arguments_test.rb
189
+ - test/graphql_client/query/document_test.rb
190
+ - test/graphql_client/query/field_test.rb
191
+ - test/graphql_client/query/fragment_test.rb
192
+ - test/graphql_client/query/inline_fragment_test.rb
193
+ - test/graphql_client/query/mutation_document_test.rb
194
+ - test/graphql_client/query/mutation_operation_test.rb
195
+ - test/graphql_client/query/query_document_test.rb
196
+ - test/graphql_client/query/query_operation_test.rb
197
+ - test/graphql_client/query/selection_set_test.rb
198
+ - test/graphql_client/response_connection_test.rb
199
+ - test/graphql_client/response_object_test.rb
200
+ - test/graphql_client/response_test.rb
201
+ - test/support/fixtures/schema.json
202
+ - test/test_helper.rb
203
+ homepage: http://www.shopify.com/partners/apps
204
+ licenses:
205
+ - MIT
206
+ metadata: {}
207
+ post_install_message:
208
+ rdoc_options: []
209
+ require_paths:
210
+ - lib
211
+ required_ruby_version: !ruby/object:Gem::Requirement
212
+ requirements:
213
+ - - ">="
214
+ - !ruby/object:Gem::Version
215
+ version: '2.3'
216
+ required_rubygems_version: !ruby/object:Gem::Requirement
217
+ requirements:
218
+ - - ">="
219
+ - !ruby/object:Gem::Version
220
+ version: '0'
221
+ requirements: []
222
+ rubyforge_project:
223
+ rubygems_version: 2.6.8
224
+ signing_key:
225
+ specification_version: 4
226
+ summary: ''
227
+ test_files: []