site_blog 0.7.0 → 0.8.0

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: e76714792d33e9b0a08f1fc2d643f0caccad3bb083b77662bd9bcdfa02f07709
4
- data.tar.gz: a261eec84ec7a2e8778792b49dc9e9e62bbcdeff56cd9d82b8012999b1a3e8cc
3
+ metadata.gz: a1c17bed2d9dfb9c42207ed00b2958f8d412f011a4cd0789253d0f7fd84fdb9a
4
+ data.tar.gz: 32877ba756d06b0a139a43d1f4f6e806e54430bc7131109a434bf3b0e0897371
5
5
  SHA512:
6
- metadata.gz: bc839fa55585d4b3d27aab8feeacdec64be32423bb8a94356d26b9897abc4902d0d737dacb513eee8395fcc526f9291677b7a678bd7552c881ff970612998e14
7
- data.tar.gz: a5a842079e9e679a02b45526f8068cf3e503b85c2f201dfd118117856f1a223d2a5a9a2f63c10bebf6b1e2ba8853da3f18c84c40c8d8ad82a851319c1e9389b0
6
+ metadata.gz: 155d5b8e30636d78c1dafe191d72f11dc9bb0bc4d96fc8d3d54318d20553201bbd12d72acb244ad4e9b6caf888be9408a36ff9c7614f0167c3973b331e24e4c5
7
+ data.tar.gz: fc947d550f5cd921f66571189072041915af772deebe5a4aee74947dc6822f8408c4f09272697481d4b2a20f232f0eb177fb3a577e3ccc565bd4df0c83689dc1
data/config/routes.rb CHANGED
@@ -1,8 +1,4 @@
1
1
  SiteBlog::Engine.routes.draw do
2
-
3
- mount GraphiQL::Rails::Engine, at: "/graphiql", graphql_path: '/blog/graphql'
4
-
5
- post '/graphql', to: 'graphql#execute'
6
2
  resources :tags
7
3
  resources :articles
8
4
  end
@@ -2,8 +2,6 @@ require 'carrierwave'
2
2
  require 'pg_search'
3
3
  require 'kaminari'
4
4
  require 'translit'
5
- require 'graphql'
6
- require 'graphiql/rails'
7
5
 
8
6
  module SiteBlog
9
7
  class Engine < ::Rails::Engine
@@ -1,3 +1,3 @@
1
1
  module SiteBlog
2
- VERSION = "0.7.0"
2
+ VERSION = "0.8.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: site_blog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eldar
@@ -108,7 +108,6 @@ files:
108
108
  - app/assets/stylesheets/site_blog/application.css
109
109
  - app/controllers/site_blog/application_controller.rb
110
110
  - app/controllers/site_blog/articles_controller.rb
111
- - app/controllers/site_blog/graphql_controller.rb
112
111
  - app/controllers/site_blog/tags_controller.rb
113
112
  - app/helpers/site_blog/application_helper.rb
114
113
  - app/helpers/site_blog/articles_helper.rb
@@ -1,52 +0,0 @@
1
- module SiteBlog
2
- class GraphqlController < ApplicationController
3
- # If accessing from outside this domain, nullify the session
4
- # This allows for outside API access while preventing CSRF attacks,
5
- # but you'll have to authenticate your user separately
6
- # protect_from_forgery with: :null_session
7
-
8
- def execute
9
- variables = prepare_variables(params[:variables])
10
- query = params[:query]
11
- operation_name = params[:operationName]
12
- context = {
13
- # Query context goes here, for example:
14
- # current_user: current_user,
15
- }
16
- result = Schema.execute(query, variables: variables, context: context, operation_name: operation_name)
17
- render json: result
18
- rescue StandardError => e
19
- raise e unless Rails.env.development?
20
- handle_error_in_development(e)
21
- end
22
-
23
- private
24
-
25
- # Handle variables in form data, JSON body, or a blank value
26
- def prepare_variables(variables_param)
27
- case variables_param
28
- when String
29
- if variables_param.present?
30
- JSON.parse(variables_param) || {}
31
- else
32
- {}
33
- end
34
- when Hash
35
- variables_param
36
- when ActionController::Parameters
37
- variables_param.to_unsafe_hash # GraphQL-Ruby will validate name and type of incoming variables.
38
- when nil
39
- {}
40
- else
41
- raise ArgumentError, "Unexpected parameter: #{variables_param}"
42
- end
43
- end
44
-
45
- def handle_error_in_development(e)
46
- logger.error e.message
47
- logger.error e.backtrace.join("\n")
48
-
49
- render json: { errors: [{ message: e.message, backtrace: e.backtrace }], data: {} }, status: 500
50
- end
51
- end
52
- end