rack-graphql 1.1.0 → 1.2.0

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: 9dd40d40ed2382e719c6800b9df0f155a3007d9c28cac18c56df5b31e48632c0
4
- data.tar.gz: c98f7a2d5d9964436db365c1c5209e4cefb08f56010fb674023adac01f3128c9
3
+ metadata.gz: fa676bb1795a98e7072837c677ce6b1dbd2cecf63bbf09ec1da762ac93826f01
4
+ data.tar.gz: baaeac57d1febfa1b30dee33c589d08ebc9e2258d9d5b4fac87a047e023e023f
5
5
  SHA512:
6
- metadata.gz: 36ef93a32e777d2c9a56c92670eecc0453868063c0521f281ac2910a71dc7a1148d2242ba3feeed9df951c233964a989b23fcf9fd0bc8a66a011836a6c2a01dd
7
- data.tar.gz: cc2758913de2a10cf0f36dfd6c5beb4a06b516a72401c145a8fd0463332b35cfa4038c00787eaba46be7cce3b8b82d90de97c7e58405c33a628b1274724cb768
6
+ metadata.gz: fe96ed09318ad1d487a2437596e5150f28e1a721a7127eeff1bd615898831f1365097b8dce89aa40ed46584eadaff2f5baf31d0ae413230158a7af4ab52380ed
7
+ data.tar.gz: 3c97c70827c54268518ec6e4552a962e140bd1742f3cc0e20a83900a4b3dc820afdf933ec79a90cd37622c2a8d44ffd6a732dc83115fcadeb339af927c3b324e
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rack-graphql (1.1.0)
4
+ rack-graphql (1.2.0)
5
5
  graphql (>= 1.9.0)
6
6
  oj
7
7
  rack (>= 2.0.0)
data/lib/rack_graphql.rb CHANGED
@@ -1,9 +1,9 @@
1
- require 'json'
2
1
  require 'oj'
3
2
  require 'rack'
4
3
  require 'graphql'
5
4
 
6
5
  require 'rack_graphql/version'
6
+ require 'rack_graphql/exceptions'
7
7
  require 'rack_graphql/health_response_builder'
8
8
  require 'rack_graphql/middleware'
9
9
  require 'rack_graphql/application'
@@ -0,0 +1,3 @@
1
+ module RackGraphql
2
+ AmbiguousParamError = Class.new(ArgumentError)
3
+ end
@@ -18,13 +18,13 @@ module RackGraphql
18
18
  end
19
19
 
20
20
  def body
21
- JSON.generate(
22
- status: :ok,
23
- request_ip: request.ip,
24
- app_name: app_name,
25
- app_env: ENV['RACK_ENV'],
26
- host: ENV['HOSTNAME'],
27
- revision: ENV['REVISION']
21
+ Oj.dump(
22
+ 'status' => 'ok',
23
+ 'request_ip' => request.ip,
24
+ 'app_name' => app_name,
25
+ 'app_env' => ENV['RACK_ENV'],
26
+ 'host' => ENV['HOSTNAME'],
27
+ 'revision' => ENV['REVISION']
28
28
  )
29
29
  end
30
30
  end
@@ -21,7 +21,7 @@ module RackGraphql
21
21
  result = execute(params: params, operation_name: operation_name, variables: variables, context: context)
22
22
 
23
23
  [200, response_headers(result), [response_body(result)]]
24
- rescue ArgumentError => e
24
+ rescue AmbiguousParamError => e
25
25
  log("Responded with #{e.class} because of #{e.message}")
26
26
  [400, { 'Content-Type' => 'application/json' }, [Oj.dump({})]]
27
27
  ensure
@@ -51,14 +51,14 @@ module RackGraphql
51
51
  begin
52
52
  ensure_hash(Oj.load(ambiguous_param))
53
53
  rescue Oj::ParseError
54
- raise ArgumentError, "Unexpected parameter: #{ambiguous_param}"
54
+ raise AmbiguousParamError, "Unexpected parameter: #{ambiguous_param}"
55
55
  end
56
56
  when Hash
57
57
  ambiguous_param
58
58
  when nil
59
59
  {}
60
60
  else
61
- fail ArgumentError, "Unexpected parameter: #{ambiguous_param}"
61
+ fail AmbiguousParamError, "Unexpected parameter: #{ambiguous_param}"
62
62
  end
63
63
  end
64
64
 
@@ -1,3 +1,3 @@
1
1
  module RackGraphql
2
- VERSION = '1.1.0'.freeze
2
+ VERSION = '1.2.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-graphql
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Krzysztof Knapik
@@ -170,6 +170,7 @@ files:
170
170
  - lib/rack-graphql.rb
171
171
  - lib/rack_graphql.rb
172
172
  - lib/rack_graphql/application.rb
173
+ - lib/rack_graphql/exceptions.rb
173
174
  - lib/rack_graphql/health_response_builder.rb
174
175
  - lib/rack_graphql/middleware.rb
175
176
  - lib/rack_graphql/version.rb