rack-graphql 0.6.0 → 0.7.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: eb088c288a3e2fda3f114d31b769a48869e2acb81822ca68b916a46e7702d6f6
4
- data.tar.gz: 4e24c3b8d96246abe38b41ac773dac0ca5f2a29e4fb01edb65f87364056f47ad
3
+ metadata.gz: 42c994c2e159014280cc0c3c3c39c40b66e7a4fa5d6c75acc178ed9beaeb4815
4
+ data.tar.gz: f87f1e979d402325e941c52866dfef33322b6eba6121932d0a4880581608d9ac
5
5
  SHA512:
6
- metadata.gz: 8f2ae69e4e062ecc073c26e6602c146d0a2ecc1421a4a13efc2cbd2704f29faede0c19437a4a8caf43b7f442accc2deb29823c2ca5c53e7ce8f70f53ed06954e
7
- data.tar.gz: 99f0ca2ba3a3c441475902ac41c02ff5a822e3355d0d7386b535277a5d44f7882f9979b7fb18f8adaaa57fced2c958db60110945375d0b05b80a72ffd5b2b3e4
6
+ metadata.gz: 780a783e048723070521c5033c19a912ac005035ab786ff69a3580441872a7967c735f5154548d1b74a46a25951e0987be7c5b5f1e270674b380125e658a08cf
7
+ data.tar.gz: 895c251117d6b7710acf5bb4e6d7e10367a765580d68ed76d0d4ad413ada41597fa4ca0bd231aa1a47a0c2ee901a4262b87352940cbfe6e0a82c3951276bf05b
data/.gitignore CHANGED
@@ -9,3 +9,6 @@
9
9
 
10
10
  # rspec failure tracking
11
11
  .rspec_status
12
+
13
+ # Cached rubocop config files
14
+ .rubocop-http*
data/.rubocop.yml CHANGED
@@ -1,62 +1,12 @@
1
- Gemspec/RequiredRubyVersion:
2
- Include:
3
- - 2.4
4
- - 2.5
5
- - 2.6
1
+ require:
2
+ - rubocop-performance
6
3
 
7
- Lint/UnusedBlockArgument:
8
- Enabled: false
4
+ inherit_from:
5
+ - https://raw.githubusercontent.com/RenoFi/rubocop/master/ruby.yml
9
6
 
10
- Layout/AlignHash:
11
- Enabled: false
7
+ AllCops:
8
+ TargetRubyVersion: 2.5
12
9
 
13
10
  Naming/FileName:
14
- Enabled: false
15
-
16
- Metrics/BlockLength:
17
- Max: 30
18
- Exclude:
19
- - '**/*_spec.rb'
20
-
21
- Metrics/LineLength:
22
- Max: 140
23
-
24
- Metrics/MethodLength:
25
- Max: 20
26
-
27
- Security/YAMLLoad:
28
- Enabled: false
29
-
30
- Style/BlockDelimiters:
31
- EnforcedStyle: braces_for_chaining
32
-
33
- Style/Documentation:
34
- Enabled: false
35
-
36
- Style/GuardClause:
37
- Enabled: false
38
-
39
- Style/EachWithObject:
40
- Enabled: false
41
-
42
- Style/MethodMissingSuper:
43
- Enabled: false
44
-
45
- Style/MissingRespondToMissing:
46
- Enabled: false
47
-
48
- Style/FrozenStringLiteralComment:
49
- Enabled: false
50
-
51
- Style/PercentLiteralDelimiters:
52
- Enabled: false
53
-
54
- Style/RescueStandardError:
55
11
  Exclude:
56
- - 'spec/*.rb'
57
-
58
- Style/SymbolArray:
59
- EnforcedStyle: brackets
60
-
61
- Style/TrivialAccessors:
62
- Enabled: false
12
+ - 'lib/*.rb'
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ ruby-2.6.5
data/.travis.yml CHANGED
@@ -3,7 +3,9 @@ sudo: false
3
3
  language: ruby
4
4
  cache: bundler
5
5
  rvm:
6
- - 2.4.6
7
- - 2.5.5
8
- - 2.6.3
9
- before_install: gem install bundler -v 2.0.1
6
+ - 2.5.7
7
+ - 2.6.5
8
+ before_install: gem install bundler -v 2.0.2
9
+ script:
10
+ - bundle exec rspec
11
+ - bundle exec rubocop
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rack-graphql (0.6.0)
4
+ rack-graphql (0.7.0)
5
5
  graphql (>= 1.9.0)
6
6
  multi_json
7
7
  rack (>= 2.0.0)
@@ -12,12 +12,12 @@ GEM
12
12
  ast (2.4.0)
13
13
  coderay (1.1.2)
14
14
  diff-lcs (1.3)
15
- graphql (1.9.8)
15
+ graphql (1.9.12)
16
16
  jaro_winkler (1.5.3)
17
17
  method_source (0.9.2)
18
18
  multi_json (1.13.1)
19
- parallel (1.17.0)
20
- parser (2.6.3.0)
19
+ parallel (1.18.0)
20
+ parser (2.6.5.0)
21
21
  ast (~> 2.4.0)
22
22
  pry (0.12.2)
23
23
  coderay (~> 1.1.0)
@@ -26,27 +26,29 @@ GEM
26
26
  rack-test (1.1.0)
27
27
  rack (>= 1.0, < 3)
28
28
  rainbow (3.0.0)
29
- rake (10.5.0)
29
+ rake (13.0.0)
30
30
  rspec (3.8.0)
31
31
  rspec-core (~> 3.8.0)
32
32
  rspec-expectations (~> 3.8.0)
33
33
  rspec-mocks (~> 3.8.0)
34
34
  rspec-core (3.8.2)
35
35
  rspec-support (~> 3.8.0)
36
- rspec-expectations (3.8.4)
36
+ rspec-expectations (3.8.6)
37
37
  diff-lcs (>= 1.2.0, < 2.0)
38
38
  rspec-support (~> 3.8.0)
39
- rspec-mocks (3.8.1)
39
+ rspec-mocks (3.8.2)
40
40
  diff-lcs (>= 1.2.0, < 2.0)
41
41
  rspec-support (~> 3.8.0)
42
- rspec-support (3.8.2)
43
- rubocop (0.73.0)
42
+ rspec-support (3.8.3)
43
+ rubocop (0.75.0)
44
44
  jaro_winkler (~> 1.5.1)
45
45
  parallel (~> 1.10)
46
46
  parser (>= 2.6)
47
47
  rainbow (>= 2.2.2, < 4.0)
48
48
  ruby-progressbar (~> 1.7)
49
49
  unicode-display_width (>= 1.4.0, < 1.7)
50
+ rubocop-performance (1.5.0)
51
+ rubocop (>= 0.71.0)
50
52
  ruby-progressbar (1.10.1)
51
53
  unicode-display_width (1.6.0)
52
54
 
@@ -54,13 +56,14 @@ PLATFORMS
54
56
  ruby
55
57
 
56
58
  DEPENDENCIES
57
- bundler (~> 2.0)
58
- pry (~> 0.12)
59
+ bundler
60
+ pry
59
61
  rack-graphql!
60
- rack-test (~> 1.1)
61
- rake (~> 10.0)
62
- rspec (~> 3.0)
63
- rubocop (~> 0.71)
62
+ rack-test
63
+ rake
64
+ rspec
65
+ rubocop
66
+ rubocop-performance
64
67
 
65
68
  BUNDLED WITH
66
- 2.0.1
69
+ 2.0.2
data/lib/rack-graphql.rb CHANGED
@@ -1,8 +1 @@
1
- require 'multi_json'
2
- require 'rack'
3
- require 'graphql'
4
-
5
- require 'rack_graphql/version'
6
- require 'rack_graphql/health_response_builder'
7
- require 'rack_graphql/middleware'
8
- require 'rack_graphql/application'
1
+ require 'rack_graphql'
@@ -1,10 +1,8 @@
1
1
  module RackGraphql
2
2
  class Application
3
- def self.call(schema:,
4
- app_name: 'rack-graphql-service',
5
- context_handler: nil,
6
- health_route: true,
7
- health_response_builder: RackGraphql::HealthResponseBuilder)
3
+ def self.call(schema:, app_name: 'rack-graphql-service', context_handler: nil,
4
+ health_route: true, health_response_builder: RackGraphql::HealthResponseBuilder)
5
+
8
6
  ::Rack::Builder.new do
9
7
  map '/graphql' do
10
8
  run RackGraphql::Middleware.new(schema: schema, context_handler: context_handler)
@@ -8,7 +8,10 @@ module RackGraphql
8
8
  def call(env)
9
9
  return [406, {}, []] unless post_request?(env)
10
10
 
11
- params = post_data(env)
11
+ params = post_data(env)
12
+
13
+ return [400, {}, []] unless params.is_a?(Hash)
14
+
12
15
  variables = ensure_hash(params['variables'])
13
16
  operation_name = params['operationName']
14
17
  context = context_handler.call(env)
@@ -33,7 +36,7 @@ module RackGraphql
33
36
  def post_data(env)
34
37
  ::MultiJson.load(env['rack.input'].gets)
35
38
  rescue MultiJson::ParseError
36
- {}
39
+ nil
37
40
  end
38
41
 
39
42
  # Handle form data, JSON body, or a blank value
@@ -52,7 +55,7 @@ module RackGraphql
52
55
  when nil
53
56
  {}
54
57
  else
55
- raise ArgumentError, "Unexpected parameter: #{ambiguous_param}"
58
+ fail ArgumentError, "Unexpected parameter: #{ambiguous_param}"
56
59
  end
57
60
  end
58
61
 
@@ -1,3 +1,3 @@
1
1
  module RackGraphql
2
- VERSION = '0.6.0'.freeze
2
+ VERSION = '0.7.0'.freeze
3
3
  end
data/lib/rack_graphql.rb CHANGED
@@ -1 +1,8 @@
1
- require 'rack-graphql'
1
+ require 'multi_json'
2
+ require 'rack'
3
+ require 'graphql'
4
+
5
+ require 'rack_graphql/version'
6
+ require 'rack_graphql/health_response_builder'
7
+ require 'rack_graphql/middleware'
8
+ require 'rack_graphql/application'
data/rack-graphql.gemspec CHANGED
@@ -22,16 +22,17 @@ Gem::Specification.new do |spec|
22
22
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
23
  spec.require_paths = ['lib']
24
24
 
25
- spec.required_ruby_version = '>= 2.4'
25
+ spec.required_ruby_version = '>= 2.5'
26
26
 
27
27
  spec.add_dependency 'graphql', '>= 1.9.0'
28
28
  spec.add_dependency 'multi_json'
29
29
  spec.add_dependency 'rack', '>= 2.0.0'
30
30
 
31
- spec.add_development_dependency 'bundler', '~> 2.0'
32
- spec.add_development_dependency 'pry', '~> 0.12'
33
- spec.add_development_dependency 'rack-test', '~> 1.1'
34
- spec.add_development_dependency 'rake', '~> 10.0'
35
- spec.add_development_dependency 'rspec', '~> 3.0'
36
- spec.add_development_dependency 'rubocop', '~> 0.71'
31
+ spec.add_development_dependency 'bundler'
32
+ spec.add_development_dependency 'pry'
33
+ spec.add_development_dependency 'rack-test'
34
+ spec.add_development_dependency 'rake'
35
+ spec.add_development_dependency 'rspec'
36
+ spec.add_development_dependency 'rubocop'
37
+ spec.add_development_dependency 'rubocop-performance'
37
38
  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: 0.6.0
4
+ version: 0.7.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-07-30 00:00:00.000000000 Z
12
+ date: 2019-10-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: graphql
@@ -57,86 +57,100 @@ dependencies:
57
57
  name: bundler
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
- - - "~>"
60
+ - - ">="
61
61
  - !ruby/object:Gem::Version
62
- version: '2.0'
62
+ version: '0'
63
63
  type: :development
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
- - - "~>"
67
+ - - ">="
68
68
  - !ruby/object:Gem::Version
69
- version: '2.0'
69
+ version: '0'
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: pry
72
72
  requirement: !ruby/object:Gem::Requirement
73
73
  requirements:
74
- - - "~>"
74
+ - - ">="
75
75
  - !ruby/object:Gem::Version
76
- version: '0.12'
76
+ version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
80
80
  requirements:
81
- - - "~>"
81
+ - - ">="
82
82
  - !ruby/object:Gem::Version
83
- version: '0.12'
83
+ version: '0'
84
84
  - !ruby/object:Gem::Dependency
85
85
  name: rack-test
86
86
  requirement: !ruby/object:Gem::Requirement
87
87
  requirements:
88
- - - "~>"
88
+ - - ">="
89
89
  - !ruby/object:Gem::Version
90
- version: '1.1'
90
+ version: '0'
91
91
  type: :development
92
92
  prerelease: false
93
93
  version_requirements: !ruby/object:Gem::Requirement
94
94
  requirements:
95
- - - "~>"
95
+ - - ">="
96
96
  - !ruby/object:Gem::Version
97
- version: '1.1'
97
+ version: '0'
98
98
  - !ruby/object:Gem::Dependency
99
99
  name: rake
100
100
  requirement: !ruby/object:Gem::Requirement
101
101
  requirements:
102
- - - "~>"
102
+ - - ">="
103
103
  - !ruby/object:Gem::Version
104
- version: '10.0'
104
+ version: '0'
105
105
  type: :development
106
106
  prerelease: false
107
107
  version_requirements: !ruby/object:Gem::Requirement
108
108
  requirements:
109
- - - "~>"
109
+ - - ">="
110
110
  - !ruby/object:Gem::Version
111
- version: '10.0'
111
+ version: '0'
112
112
  - !ruby/object:Gem::Dependency
113
113
  name: rspec
114
114
  requirement: !ruby/object:Gem::Requirement
115
115
  requirements:
116
- - - "~>"
116
+ - - ">="
117
117
  - !ruby/object:Gem::Version
118
- version: '3.0'
118
+ version: '0'
119
119
  type: :development
120
120
  prerelease: false
121
121
  version_requirements: !ruby/object:Gem::Requirement
122
122
  requirements:
123
- - - "~>"
123
+ - - ">="
124
124
  - !ruby/object:Gem::Version
125
- version: '3.0'
125
+ version: '0'
126
126
  - !ruby/object:Gem::Dependency
127
127
  name: rubocop
128
128
  requirement: !ruby/object:Gem::Requirement
129
129
  requirements:
130
- - - "~>"
130
+ - - ">="
131
+ - !ruby/object:Gem::Version
132
+ version: '0'
133
+ type: :development
134
+ prerelease: false
135
+ version_requirements: !ruby/object:Gem::Requirement
136
+ requirements:
137
+ - - ">="
138
+ - !ruby/object:Gem::Version
139
+ version: '0'
140
+ - !ruby/object:Gem::Dependency
141
+ name: rubocop-performance
142
+ requirement: !ruby/object:Gem::Requirement
143
+ requirements:
144
+ - - ">="
131
145
  - !ruby/object:Gem::Version
132
- version: '0.71'
146
+ version: '0'
133
147
  type: :development
134
148
  prerelease: false
135
149
  version_requirements: !ruby/object:Gem::Requirement
136
150
  requirements:
137
- - - "~>"
151
+ - - ">="
138
152
  - !ruby/object:Gem::Version
139
- version: '0.71'
153
+ version: '0'
140
154
  description:
141
155
  email:
142
156
  - knapo@knapo.net
@@ -149,6 +163,7 @@ files:
149
163
  - ".hound.yml"
150
164
  - ".rspec"
151
165
  - ".rubocop.yml"
166
+ - ".ruby-version"
152
167
  - ".travis.yml"
153
168
  - Gemfile
154
169
  - Gemfile.lock
@@ -178,14 +193,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
178
193
  requirements:
179
194
  - - ">="
180
195
  - !ruby/object:Gem::Version
181
- version: '2.4'
196
+ version: '2.5'
182
197
  required_rubygems_version: !ruby/object:Gem::Requirement
183
198
  requirements:
184
199
  - - ">="
185
200
  - !ruby/object:Gem::Version
186
201
  version: '0'
187
202
  requirements: []
188
- rubygems_version: 3.0.3
203
+ rubygems_version: 3.0.6
189
204
  signing_key:
190
205
  specification_version: 4
191
206
  summary: Rack middleware implementing graphql endpoint.