search_object_graphql 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9f509887b8c20f3fde861d5dc9cb0588a5d69c167a42d7348f3839ef34ed007b
4
- data.tar.gz: '08124c03eb5127693e68fd3c191aceab436eab0463bfe82151d82207acb13ef4'
3
+ metadata.gz: 4743546d8933b7412977b5b2736eca71fd8950ef016ca5e4f766a73e7f75d0dd
4
+ data.tar.gz: a9772b5cb3cfda0e8cbc334a68d24d919b964e81af00be8696a91b3bc0d60947
5
5
  SHA512:
6
- metadata.gz: a76bdb08d7b81f1ca59787ae1895fb3bef3befa60c6086204b63fdc01441f0e819e293f14aa8abcac611f6ed9455b3fc556672cb2f980c21b1a699c124297514
7
- data.tar.gz: 3dd7bdfea7fec0148d3d39db9eab1c340f1b05779b6137f71468e2fdb1ee9cb90a98339dc400f984a9f548f4ec7e3527a5d1e8cb71396e22bded52544a07047b
6
+ metadata.gz: 5c1400ac1875e40b26a1ef4c8e5180e2324cc5e671b715e61172f5dd51cce443fce19dfaa92d5783791a3d8cc06de9c6d1a238b2f9e9c3158aab35cee21c58d6
7
+ data.tar.gz: ff5bd7c05cc45cd815a8682423dee031ea720d7c3da766a8aa19e9df1d52d9013592ed4bf58255c218ab9dc0e8c1c0c2a6fd95c91e7961f04f346fe0f3a2bf1f
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## Version 1.0.2
4
+
5
+ * __[fix]__ Support GraphQL 2.0 gem (@rstankov)
6
+
3
7
  ## Version 1.0.1
4
8
 
5
9
  * __[feature]__ Added `argument_options` to `options` (@wuz)
data/README.md CHANGED
@@ -99,8 +99,8 @@ class PostResolver < GraphQL::Schema::Resolver
99
99
 
100
100
  description 'Lists all posts'
101
101
 
102
- option(:name, type: types.String, description: 'Fuzzy name matching') { ... }
103
- option(:published, type: types.Boolean, description: 'Find published/unpublished') { ... }
102
+ option(:name, type: String, description: 'Fuzzy name matching') { ... }
103
+ option(:published, type: Boolean, description: 'Find published/unpublished') { ... }
104
104
  end
105
105
  ```
106
106
 
@@ -112,7 +112,7 @@ class PostResolver < GraphQL::Schema::Resolver
112
112
 
113
113
  scope { Post.all }
114
114
 
115
- option(:published, type: types.Boolean, default: true) { |scope, value| value ? scope.published : scope.unpublished }
115
+ option(:published, type: Boolean, default: true) { |scope, value| value ? scope.published : scope.unpublished }
116
116
  end
117
117
  ```
118
118
 
@@ -126,7 +126,7 @@ class PostResolver < GraphQL::Schema::Resolver
126
126
 
127
127
  scope { Post.all }
128
128
 
129
- option(:published, type: types.Boolean, argument_options: { pundit_role: :read }) { |scope, value| value ? scope.published : scope.unpublished }
129
+ option(:published, type: Boolean, argument_options: { pundit_role: :read }) { |scope, value| value ? scope.published : scope.unpublished }
130
130
  end
131
131
  ```
132
132
 
@@ -14,8 +14,8 @@ module Resolvers
14
14
 
15
15
  scope { Category.all }
16
16
 
17
- option :id, type: types.String, with: :apply_id_filter
18
- option :name, type: types.String, with: :apply_name_filter
17
+ option :id, type: String, with: :apply_id_filter
18
+ option :name, type: String, with: :apply_name_filter
19
19
  option :order, type: OrderEnum, default: 'RECENT'
20
20
 
21
21
  def apply_id_filter(scope, value)
@@ -16,12 +16,12 @@ module Resolvers
16
16
 
17
17
  scope { object.respond_to?(:posts) ? object.posts : Post.all }
18
18
 
19
- option :id, type: types.String, with: :apply_id_filter
20
- option :title, type: types.String, with: :apply_title_filter
21
- option :body, type: types.String, with: :apply_body_filter
22
- option :categoryId, type: types.String, with: :apply_category_id_filter
23
- option :categoryName, type: types.String, with: :apply_category_name_filter
24
- option :published, type: types.Boolean, with: :apply_published_filter
19
+ option :id, type: String, with: :apply_id_filter
20
+ option :title, type: String, with: :apply_title_filter
21
+ option :body, type: String, with: :apply_body_filter
22
+ option :categoryId, type: String, with: :apply_category_id_filter
23
+ option :categoryName, type: String, with: :apply_category_name_filter
24
+ option :published, type: Boolean, with: :apply_published_filter
25
25
  option :order, type: OrderEnum, default: 'RECENT'
26
26
 
27
27
  def apply_id_filter(scope, value)
@@ -3,7 +3,7 @@
3
3
  module SearchObject
4
4
  module Plugin
5
5
  module Graphql
6
- VERSION = '1.0.2'
6
+ VERSION = '1.0.3'
7
7
  end
8
8
  end
9
9
  end
@@ -45,6 +45,7 @@ module SearchObject
45
45
  super(name, options, &block)
46
46
  end
47
47
 
48
+ # NOTE(rstankov): This is removed in GraphQL 2.0.0
48
49
  def types
49
50
  GraphQL::Define::TypeDefiner.instance
50
51
  end
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
20
20
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
21
21
  spec.require_paths = ['lib']
22
22
 
23
- spec.add_dependency 'graphql', '~> 1.8'
23
+ spec.add_dependency 'graphql', '> 1.8'
24
24
  spec.add_dependency 'search_object', '~> 1.2.2'
25
25
 
26
26
  spec.add_development_dependency 'coveralls'
@@ -92,7 +92,7 @@ describe SearchObject::Plugin::Graphql do
92
92
 
93
93
  type [post_type], null: 1
94
94
 
95
- option(:id, type: !types.ID) { |scope, value| scope.select { |p| p.id == value } }
95
+ option(:id, type: GraphQL::Types::ID) { |scope, value| scope.select { |p| p.id == value } }
96
96
  end
97
97
 
98
98
  schema = define_schema do
@@ -225,7 +225,7 @@ describe SearchObject::Plugin::Graphql do
225
225
 
226
226
  it 'accepts default type' do
227
227
  schema = define_search_class_and_return_schema do
228
- option(:id, type: types.String, default: 'default') do |_scope, value|
228
+ option(:id, type: String, default: 'default') do |_scope, value|
229
229
  [Post.new(value)]
230
230
  end
231
231
  end
@@ -243,7 +243,7 @@ describe SearchObject::Plugin::Graphql do
243
243
  schema = define_search_class_and_return_schema do
244
244
  type PostType, null: true
245
245
 
246
- option('option', type: types.String, default: 'default') { [] }
246
+ option('option', type: String, default: 'default') { [] }
247
247
  end
248
248
 
249
249
  result = schema.execute <<~GRAPHQL
@@ -277,7 +277,7 @@ describe SearchObject::Plugin::Graphql do
277
277
 
278
278
  it 'accepts "required"' do
279
279
  schema = define_search_class_and_return_schema do
280
- option(:id, type: types.String, required: true) do |_scope, value|
280
+ option(:id, type: String, required: true) do |_scope, value|
281
281
  [Post.new(value)]
282
282
  end
283
283
  end
@@ -292,7 +292,7 @@ describe SearchObject::Plugin::Graphql do
292
292
  permission: true
293
293
  }
294
294
  schema = define_search_class_and_return_schema do
295
- option(:id, type: types.String, argument_options: argument_options) do |_scope, value|
295
+ option(:id, type: String, argument_options: argument_options) do |_scope, value|
296
296
  [Post.new(value)]
297
297
  end
298
298
  end
@@ -304,14 +304,13 @@ describe SearchObject::Plugin::Graphql do
304
304
  'posts' => [Post.new('2').to_json]
305
305
  }
306
306
  )
307
-
308
307
  end
309
308
 
310
309
  it 'accepts description' do
311
310
  schema = define_search_class_and_return_schema do
312
311
  type PostType, null: true
313
312
 
314
- option('option', type: types.String, description: 'what this argument does') { [] }
313
+ option('option', type: String, description: 'what this argument does') { [] }
315
314
  end
316
315
 
317
316
  result = schema.execute <<-SQL
@@ -347,7 +346,7 @@ describe SearchObject::Plugin::Graphql do
347
346
  schema = define_search_class_and_return_schema do
348
347
  type PostType, null: true
349
348
 
350
- option('option_field', type: types.String, camelize: false)
349
+ option('option_field', type: String, camelize: false)
351
350
  end
352
351
 
353
352
  result = schema.execute <<-SQL
@@ -381,7 +380,7 @@ describe SearchObject::Plugin::Graphql do
381
380
  schema = define_search_class_and_return_schema do
382
381
  type PostType, null: true
383
382
 
384
- option('option_field', type: types.String)
383
+ option('option_field', type: String)
385
384
  end
386
385
 
387
386
  result = schema.execute <<~GRAPHQL
metadata CHANGED
@@ -1,27 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: search_object_graphql
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Radoslav Stankov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-10-29 00:00:00.000000000 Z
11
+ date: 2022-03-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: graphql
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.8'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.8'
27
27
  - !ruby/object:Gem::Dependency