rack-graphql 0.7.1 → 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: dbcd3782c8127b5ef54b327890ecac6e16c617960db6fff8f65983b99692d6ac
4
- data.tar.gz: 1204dc5cbf2b56e46521cf839229193177d499d72df3177ccc76d3ca378aaa62
3
+ metadata.gz: c2c44329e54404c5d84af3d21bb11ef103aa2dd6f42548e7ecd41d4306fa2d67
4
+ data.tar.gz: 0c4f66ac577a3f3de3330a7a1d044814778c541d95e811496f7e49a4fa11db61
5
5
  SHA512:
6
- metadata.gz: 170e4809bc349ccaffa5341cac7941c89569443437bebd1e440f281233151e094d7d8e41ff2e73df671c05805d5412032377a72f6904994e6a23f0b6e1270d9b
7
- data.tar.gz: c2276ce3c64d2174e55663fe5556718b3793984596d7af35306966618171346d8941181d81863e1351a634427644e756b5dcc45677082cac316f6eb4f6795bbf
6
+ metadata.gz: 1b3865eae32648b095fb43dbac0b8614af46d77585510a8c2a37aa5b5bb373ca3bd5d63fbcb7b98f2446b15b3e41e6352d3acb53f2f9465314089f9863e5be18
7
+ data.tar.gz: 512e9b7f447ecfe684bf0eebea86e1f47e1ff5d72e612082b887a147ec48886c0739f7ba6f4430d564f8c753372036ba979a310fef0c26c3efabac6eca0eb60a
data/Gemfile.lock CHANGED
@@ -1,9 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rack-graphql (0.7.1)
4
+ rack-graphql (0.8.0)
5
5
  graphql (>= 1.9.0)
6
- multi_json
6
+ oj
7
7
  rack (>= 2.0.0)
8
8
 
9
9
  GEM
@@ -12,10 +12,10 @@ GEM
12
12
  ast (2.4.0)
13
13
  coderay (1.1.2)
14
14
  diff-lcs (1.3)
15
- graphql (1.9.14)
16
- jaro_winkler (1.5.3)
15
+ graphql (1.9.15)
16
+ jaro_winkler (1.5.4)
17
17
  method_source (0.9.2)
18
- multi_json (1.14.1)
18
+ oj (3.9.2)
19
19
  parallel (1.18.0)
20
20
  parser (2.6.5.0)
21
21
  ast (~> 2.4.0)
@@ -40,7 +40,7 @@ GEM
40
40
  diff-lcs (>= 1.2.0, < 2.0)
41
41
  rspec-support (~> 3.9.0)
42
42
  rspec-support (3.9.0)
43
- rubocop (0.75.1)
43
+ rubocop (0.76.0)
44
44
  jaro_winkler (~> 1.5.1)
45
45
  parallel (~> 1.10)
46
46
  parser (>= 2.6)
data/bin/release ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ lib = File.expand_path('../lib', __dir__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+ require 'rack_graphql/version'
6
+
7
+ `bundle && git commit -am "Release #{RackGraphql::VERSION}" && bundle exec rake build release`
@@ -17,7 +17,6 @@ module RackGraphql
17
17
  run ->(env) { health_response_builder.new(app_name: app_name, env: env).build }
18
18
  end
19
19
 
20
-
21
20
  map '/' do
22
21
  run ->(env) { health_response_builder.new(app_name: app_name, env: env).build }
23
22
  end
@@ -18,7 +18,7 @@ module RackGraphql
18
18
  end
19
19
 
20
20
  def body
21
- MultiJson.dump(
21
+ JSON.generate(
22
22
  status: :ok,
23
23
  request_ip: request.ip,
24
24
  app_name: app_name,
@@ -20,7 +20,7 @@ module RackGraphql
20
20
 
21
21
  [200, response_headers(result), [response_body(result)]]
22
22
  rescue ArgumentError
23
- [400, { 'Content-Type' => 'application/json' }, [MultiJson.dump({})]]
23
+ [400, { 'Content-Type' => 'application/json' }, [Oj.dump({})]]
24
24
  ensure
25
25
  ActiveRecord::Base.clear_active_connections! if defined?(ActiveRecord::Base)
26
26
  end
@@ -34,8 +34,8 @@ module RackGraphql
34
34
  end
35
35
 
36
36
  def post_data(env)
37
- ::MultiJson.load(env['rack.input'].gets)
38
- rescue MultiJson::ParseError
37
+ ::Oj.load(env['rack.input'].gets)
38
+ rescue Oj::ParseError
39
39
  nil
40
40
  end
41
41
 
@@ -46,8 +46,8 @@ module RackGraphql
46
46
  return {} if ambiguous_param.empty?
47
47
 
48
48
  begin
49
- ensure_hash(::MultiJson.load(ambiguous_param))
50
- rescue MultiJson::ParseError
49
+ ensure_hash(Oj.load(ambiguous_param))
50
+ rescue Oj::ParseError
51
51
  raise ArgumentError, "Unexpected parameter: #{ambiguous_param}"
52
52
  end
53
53
  when Hash
@@ -103,10 +103,12 @@ module RackGraphql
103
103
  body["data"] ||= {}
104
104
  body["data"][result.query.operation_name] ||= nil
105
105
  body["data"]["subscriptionId"] = result.context[:subscription_id]
106
+ elsif result.is_a?(Array)
107
+ body = result.map(&:to_h)
106
108
  else
107
- body = result
109
+ body = result.to_h
108
110
  end
109
- MultiJson.dump(body)
111
+ Oj.dump(body)
110
112
  end
111
113
 
112
114
  def result_subscription?(result)
@@ -1,3 +1,3 @@
1
1
  module RackGraphql
2
- VERSION = '0.7.1'.freeze
2
+ VERSION = '0.8.0'.freeze
3
3
  end
data/lib/rack_graphql.rb CHANGED
@@ -1,4 +1,5 @@
1
- require 'multi_json'
1
+ require 'json'
2
+ require 'oj'
2
3
  require 'rack'
3
4
  require 'graphql'
4
5
 
data/rack-graphql.gemspec CHANGED
@@ -25,7 +25,7 @@ Gem::Specification.new do |spec|
25
25
  spec.required_ruby_version = '>= 2.5'
26
26
 
27
27
  spec.add_dependency 'graphql', '>= 1.9.0'
28
- spec.add_dependency 'multi_json'
28
+ spec.add_dependency 'oj'
29
29
  spec.add_dependency 'rack', '>= 2.0.0'
30
30
 
31
31
  spec.add_development_dependency 'bundler'
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: 0.7.1
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Krzysztof Knapik
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2019-10-16 00:00:00.000000000 Z
12
+ date: 2019-11-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: graphql
@@ -26,7 +26,7 @@ dependencies:
26
26
  - !ruby/object:Gem::Version
27
27
  version: 1.9.0
28
28
  - !ruby/object:Gem::Dependency
29
- name: multi_json
29
+ name: oj
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
32
  - - ">="
@@ -171,6 +171,7 @@ files:
171
171
  - README.md
172
172
  - Rakefile
173
173
  - bin/console
174
+ - bin/release
174
175
  - bin/setup
175
176
  - lib/rack-graphql.rb
176
177
  - lib/rack_graphql.rb