solidus_graphql_api 0.3.0 → 0.3.1

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: 7246f6167e36e87df43c53b816b7399f5eac626ac0cd875e2ca7094560eef66c
4
- data.tar.gz: e312344abf61e4adacde583b53e575899fe09bc634fa26d020bfa93bd0a4063f
3
+ metadata.gz: b70e2d5f59a6c13b84aff295c38c79dfea0766153a7bfcecc142aa85e64f9777
4
+ data.tar.gz: 4d1b6d9c8bd5a64f01e8d9aa676538b27e40baea77bb75fb17925793c94ff1d9
5
5
  SHA512:
6
- metadata.gz: '082feada4bd548357daa528ef06adf467b9f8b2018ce5ea8b1860cef3a5c686fa02b223323d3985d9cc66576f9504a7952eeb6636364bd25c460e26cb3dd8378'
7
- data.tar.gz: badb15f3d46c77154c03f5ffca2d7ac563efe0a9c0690edfbf56f7e49688f480f648d638a00cbba3946d9ed8b1a84b2bccda271fb89832a231393550f8fc8e9a
6
+ metadata.gz: 5b98e71007944b1dbb8779a411111fa5475b0b3975473b6a6bd06faa07ed1c101426f19f9a9d3bdfacca20776664a135974fbf87dd5928cd186f629484cc937d
7
+ data.tar.gz: 317033639c010dd0b072af1c79338e10794d712abc8ce7ad2fd6a2e97980a33d32702c91bb1fe567177f272c7b29fe6d621f38108a05cc4e17b0a02ac281da29
data/README.md CHANGED
@@ -26,7 +26,8 @@ bin/rails generate solidus_graphql_api:install
26
26
  ```
27
27
 
28
28
  Unlike the REST API which has a variety of endpoints, the GraphQL API has a
29
- single endpoint accessible under `/graphql`.
29
+ single endpoint accessible under `/graphql`. It will be automatically
30
+ inserted into your `routes.rb` file after running the generator.
30
31
 
31
32
  For example in development you can use:
32
33
 
data/config/routes.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- Spree::Core::Engine.routes.draw do
4
- post '/graphql', to: 'graphql#execute'
5
- end
3
+ SolidusGraphqlApi::Engine.routes.draw do
4
+ post '/', to: 'graphql#execute'
5
+ end
@@ -5,6 +5,9 @@ module SolidusGraphqlApi
5
5
  class InstallGenerator < Rails::Generators::Base
6
6
  class_option :auto_run_migrations, type: :boolean, default: false
7
7
  source_root File.expand_path('templates', __dir__)
8
+ argument :app_path, type: :string, default: Rails.root
9
+
10
+ MOUNT_GRAPHQL_ENGINE = "mount SolidusGraphqlApi::Engine, at: '/graphql'"
8
11
 
9
12
  def copy_initializer
10
13
  template 'initializer.rb', 'config/initializers/solidus_graphql_api.rb'
@@ -22,6 +25,18 @@ module SolidusGraphqlApi
22
25
  puts 'Skipping bin/rails db:migrate, don\'t forget to run it!' # rubocop:disable Rails/Output
23
26
  end
24
27
  end
28
+
29
+ def install_routes
30
+ if Pathname(app_path).join('config', 'routes.rb').read.include? MOUNT_GRAPHQL_ENGINE
31
+ say_status :route_exist, MOUNT_GRAPHQL_ENGINE, :blue
32
+ else
33
+ route <<~RUBY
34
+ # This line installs graphql's main route to execute queries
35
+
36
+ mount SolidusGraphqlApi::Engine, at: '/graphql'
37
+ RUBY
38
+ end
39
+ end
25
40
  end
26
41
  end
27
42
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SolidusGraphqlApi
4
- VERSION = '0.3.0'
4
+ VERSION = '0.3.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solidus_graphql_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christian Rimondi
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2023-08-18 00:00:00.000000000 Z
13
+ date: 2023-08-25 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: batch-loader