souls 0.11.1 → 0.11.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ae7581dc9bdd5395bcf08caaa70221c6a16dadf92260f983b6322e69210f4ef2
4
- data.tar.gz: 9b6948571a0324e31ce4189a0c304e33ddf0d4a60cdd4f122b9a4e84ed5f8c6b
3
+ metadata.gz: e4ee7091ee3b3710a439d778f389997e2c97d9bce2a8a26bf67cd5024d365666
4
+ data.tar.gz: 0fe0a2633ffdd26a56d5b41a090917d792e4e4af742dda24106fc9e0e51c89ab
5
5
  SHA512:
6
- metadata.gz: df7192f836e9696628dcdd22d81de018cf6f9f6e5cb746f5e9cdd44d5d959e757fcbf89c57d8d7e34207f9b1180db2cac2104d79aea1198af3030d47522326c1
7
- data.tar.gz: f1a56524a566aee14ed3bd61598d839c3f495cc0d3f29db529b33a505ade6323d0fb04800df0f5622dca1aab5568d2212edd0356a6678551d70e32ca6d3a734d
6
+ metadata.gz: 442fb56b727b1e13a25b437302b81b8913c0d3498a52b8196e849a57b40149194e10159569d46dff6686df6569cc3168f8cc57f3269ba384c0b08e871f5955bc
7
+ data.tar.gz: f7d5f4fafff936beb6da5de3d083a67d377b92a841f7d74765dabfda58dd4016cf4f4bdd213d9e101aa6953add2dd43793f59c6ee80f99366a6fa3b9106ab5da
@@ -133,7 +133,7 @@ Metrics/AbcSize:
133
133
  Enabled: false
134
134
 
135
135
  Metrics/CyclomaticComplexity:
136
- Max: 30
136
+ Max: 40
137
137
 
138
138
  Metrics/PerceivedComplexity:
139
139
  Enabled: false
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- souls (0.11.0)
4
+ souls (0.11.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -460,7 +460,7 @@ module Souls
460
460
  ]
461
461
  end
462
462
 
463
- def create_query class_name: "souls"
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 create_queries class_name: "souls"
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, Integer, required: true
490
+ argument :id, String, required: true
491
491
 
492
- def resolve id:
493
- ::#{class_name.camelize}.find(id)
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.camelize}(id: 1) {
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|
@@ -1,3 +1,3 @@
1
1
  module Souls
2
- VERSION = "0.11.1"
2
+ VERSION = "0.11.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: souls
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.1
4
+ version: 0.11.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - POPPIN-FUMI