souls 0.11.1 → 0.11.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -1
- data/Gemfile.lock +1 -1
- data/lib/souls/init.rb +16 -6
- data/lib/souls/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e4ee7091ee3b3710a439d778f389997e2c97d9bce2a8a26bf67cd5024d365666
|
4
|
+
data.tar.gz: 0fe0a2633ffdd26a56d5b41a090917d792e4e4af742dda24106fc9e0e51c89ab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 442fb56b727b1e13a25b437302b81b8913c0d3498a52b8196e849a57b40149194e10159569d46dff6686df6569cc3168f8cc57f3269ba384c0b08e871f5955bc
|
7
|
+
data.tar.gz: f7d5f4fafff936beb6da5de3d083a67d377b92a841f7d74765dabfda58dd4016cf4f4bdd213d9e101aa6953add2dd43793f59c6ee80f99366a6fa3b9106ab5da
|
data/.rubocop.yml
CHANGED
data/Gemfile.lock
CHANGED
data/lib/souls/init.rb
CHANGED
@@ -460,7 +460,7 @@ module Souls
|
|
460
460
|
]
|
461
461
|
end
|
462
462
|
|
463
|
-
def
|
463
|
+
def create_queries class_name: "souls"
|
464
464
|
file_path = "./app/graphql/queries/#{class_name.pluralize}.rb"
|
465
465
|
File.open(file_path, "w") do |f|
|
466
466
|
f.write <<~EOS
|
@@ -480,17 +480,18 @@ module Souls
|
|
480
480
|
file_path
|
481
481
|
end
|
482
482
|
|
483
|
-
def
|
483
|
+
def create_query class_name: "souls"
|
484
484
|
file_path = "./app/graphql/queries/#{class_name}.rb"
|
485
485
|
File.open(file_path, "w") do |f|
|
486
486
|
f.write <<~EOS
|
487
487
|
module Queries
|
488
488
|
class #{class_name.camelize} < Queries::BaseQuery
|
489
489
|
type Types::#{class_name.camelize}Type, null: false
|
490
|
-
argument :id,
|
490
|
+
argument :id, String, required: true
|
491
491
|
|
492
|
-
def resolve
|
493
|
-
|
492
|
+
def resolve **args
|
493
|
+
_, #{class_name.singularize.underscore}_id = SoulsApiSchema.from_global_id args[:id]
|
494
|
+
::#{class_name.camelize}.find(#{class_name.singularize.underscore}_id)
|
494
495
|
rescue StandardError => error
|
495
496
|
GraphQL::ExecutionError.new error
|
496
497
|
end
|
@@ -777,10 +778,11 @@ end
|
|
777
778
|
RSpec.describe \"#{class_name.camelize} Query テスト\" do
|
778
779
|
describe "#{class_name.camelize} データを取得する" do
|
779
780
|
let!(:#{class_name.singularize.underscore}) { FactoryBot.create(:#{class_name.singularize.underscore}) }
|
781
|
+
let!(:#{class_name.singularize.underscore}_id) { Base64.encode64 "User:\#{user.id}" }
|
780
782
|
|
781
783
|
let(:query) do
|
782
784
|
%(query {
|
783
|
-
#{class_name.
|
785
|
+
#{class_name.singularize.underscore}(id: \#{#{class_name.singularize.underscore}_id}) {
|
784
786
|
id
|
785
787
|
EOS
|
786
788
|
end
|
@@ -916,6 +918,7 @@ end
|
|
916
918
|
rspec_factory_paths = rspec_factory class_name: singularized_class_name
|
917
919
|
rspec_model_paths = rspec_model class_name: singularized_class_name
|
918
920
|
rspec_mutation_paths = rspec_mutation class_name: singularized_class_name
|
921
|
+
rspec_query_paths = rspec_query class_name: singularized_class_name
|
919
922
|
query_path = query class_name: singularized_class_name
|
920
923
|
mutation_path = mutation class_name: singularized_class_name
|
921
924
|
[
|
@@ -924,6 +927,7 @@ end
|
|
924
927
|
rspec_factory: rspec_factory_paths,
|
925
928
|
rspec_model: rspec_model_paths,
|
926
929
|
rspec_mutation: rspec_mutation_paths,
|
930
|
+
rspec_query: rspec_query_paths,
|
927
931
|
query: query_path,
|
928
932
|
mutation: mutation_path,
|
929
933
|
add_query_type: [
|
@@ -974,6 +978,12 @@ end
|
|
974
978
|
path[:rspec_mutation].each { |line| puts line }
|
975
979
|
end
|
976
980
|
end
|
981
|
+
puts "\n============== RspecQuery =================\n\n"
|
982
|
+
paths.each do |class_name|
|
983
|
+
class_name.each do |path|
|
984
|
+
path[:rspec_query].each { |line| puts line }
|
985
|
+
end
|
986
|
+
end
|
977
987
|
puts "\n============== Query ======================\n\n"
|
978
988
|
paths.each do |class_name|
|
979
989
|
class_name.each do |path|
|
data/lib/souls/version.rb
CHANGED