cp-sparrow 0.0.11

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.
Files changed (77) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +23 -0
  3. data/.ruby-gemset +1 -0
  4. data/.ruby-version +1 -0
  5. data/Gemfile +6 -0
  6. data/LICENSE.txt +22 -0
  7. data/README.md +66 -0
  8. data/Rakefile +32 -0
  9. data/lib/sparrow.rb +25 -0
  10. data/lib/sparrow/configuration.rb +36 -0
  11. data/lib/sparrow/core_ext/hash.rb +21 -0
  12. data/lib/sparrow/middleware.rb +99 -0
  13. data/lib/sparrow/path_normalizer.rb +10 -0
  14. data/lib/sparrow/railtie.rb +11 -0
  15. data/lib/sparrow/request_middleware.rb +11 -0
  16. data/lib/sparrow/response_middleware.rb +37 -0
  17. data/lib/sparrow/route_parser.rb +32 -0
  18. data/lib/sparrow/strategies/form_hash.rb +42 -0
  19. data/lib/sparrow/strategies/ignore.rb +42 -0
  20. data/lib/sparrow/strategies/json_format_strategies/array_strategy.rb +17 -0
  21. data/lib/sparrow/strategies/json_format_strategies/default_json_format_strategy.rb +17 -0
  22. data/lib/sparrow/strategies/json_format_strategies/json_format_strategy.rb +35 -0
  23. data/lib/sparrow/strategies/json_format_strategies/rack_body.rb +17 -0
  24. data/lib/sparrow/strategies/key_transformation/camelize_key.rb +27 -0
  25. data/lib/sparrow/strategies/key_transformation/key_normalizer.rb +9 -0
  26. data/lib/sparrow/strategies/key_transformation/underscore_key.rb +13 -0
  27. data/lib/sparrow/strategies/raw_input.rb +48 -0
  28. data/lib/sparrow/strategies/transform_params.rb +38 -0
  29. data/lib/sparrow/transformable.rb +76 -0
  30. data/lib/sparrow/version.rb +3 -0
  31. data/sparrow.gemspec +35 -0
  32. data/spec/integration/apps/rack_app/app.rb +28 -0
  33. data/spec/integration/apps/rack_app/config.ru +12 -0
  34. data/spec/integration/apps/rails_app/README.rdoc +261 -0
  35. data/spec/integration/apps/rails_app/Rakefile +7 -0
  36. data/spec/integration/apps/rails_app/app/assets/javascripts/application.js +15 -0
  37. data/spec/integration/apps/rails_app/app/assets/stylesheets/application.css +13 -0
  38. data/spec/integration/apps/rails_app/app/controllers/application_controller.rb +3 -0
  39. data/spec/integration/apps/rails_app/app/controllers/welcome_controller.rb +50 -0
  40. data/spec/integration/apps/rails_app/app/helpers/application_helper.rb +2 -0
  41. data/spec/integration/apps/rails_app/app/mailers/.gitkeep +0 -0
  42. data/spec/integration/apps/rails_app/app/models/.gitkeep +0 -0
  43. data/spec/integration/apps/rails_app/app/views/layouts/application.html.erb +14 -0
  44. data/spec/integration/apps/rails_app/config.ru +4 -0
  45. data/spec/integration/apps/rails_app/config/application.rb +72 -0
  46. data/spec/integration/apps/rails_app/config/boot.rb +10 -0
  47. data/spec/integration/apps/rails_app/config/environment.rb +5 -0
  48. data/spec/integration/apps/rails_app/config/environments/development.rb +31 -0
  49. data/spec/integration/apps/rails_app/config/environments/production.rb +64 -0
  50. data/spec/integration/apps/rails_app/config/environments/test.rb +32 -0
  51. data/spec/integration/apps/rails_app/config/initializers/backtrace_silencers.rb +7 -0
  52. data/spec/integration/apps/rails_app/config/initializers/inflections.rb +15 -0
  53. data/spec/integration/apps/rails_app/config/initializers/mime_types.rb +5 -0
  54. data/spec/integration/apps/rails_app/config/initializers/secret_token.rb +7 -0
  55. data/spec/integration/apps/rails_app/config/initializers/session_store.rb +8 -0
  56. data/spec/integration/apps/rails_app/config/initializers/wrap_parameters.rb +10 -0
  57. data/spec/integration/apps/rails_app/config/locales/en.yml +5 -0
  58. data/spec/integration/apps/rails_app/config/routes.rb +64 -0
  59. data/spec/integration/apps/rails_app/lib/assets/.gitkeep +0 -0
  60. data/spec/integration/apps/rails_app/public/404.html +26 -0
  61. data/spec/integration/apps/rails_app/public/422.html +26 -0
  62. data/spec/integration/apps/rails_app/public/500.html +25 -0
  63. data/spec/integration/apps/rails_app/public/favicon.ico +0 -0
  64. data/spec/integration/apps/rails_app/script/rails +6 -0
  65. data/spec/integration/rack/camel_caser_spec.rb +49 -0
  66. data/spec/integration/rails/camel_caser_accept_header_spec.rb +55 -0
  67. data/spec/integration/rails/camel_caser_spec.rb +207 -0
  68. data/spec/spec_helper.rb +12 -0
  69. data/spec/support/rack_app_helper.rb +19 -0
  70. data/spec/support/rails_app_helper.rb +21 -0
  71. data/spec/support/unit_spec_helper.rb +5 -0
  72. data/spec/unit/camel_caser_spec.rb +23 -0
  73. data/spec/unit/camelize_key_spec.rb +19 -0
  74. data/spec/unit/configuration_spec.rb +47 -0
  75. data/spec/unit/path_normalizer_spec.rb +23 -0
  76. data/spec/unit/route_parser_spec.rb +45 -0
  77. metadata +295 -0
@@ -0,0 +1,207 @@
1
+ require 'spec_helper'
2
+
3
+ describe "camel caser middleware for Rails", type: :rails do
4
+
5
+ let(:json_object) do
6
+ {
7
+ userName: 'dsci',
8
+ bar: { lordFüü: 12 },
9
+ "DE" => 'german'
10
+ }
11
+ end
12
+ let(:json) { MultiJson.dump(json_object) }
13
+
14
+ context "accept header is given" do
15
+
16
+ context 'path not excluded' do
17
+ before do
18
+ post '/posts', json, { 'request-json-format' => 'underscore',
19
+ 'response-json-format' => 'underscore',
20
+ 'CONTENT-TYPE' => 'application/json' }
21
+ end
22
+
23
+ subject { MultiJson.load(last_response.body) }
24
+
25
+ it "converts lower camelcase to underscore params" do
26
+ expect(last_response).to be_successful
27
+ expect(subject).to have_key("keys")
28
+ expect(subject["keys"]).to include("user_name")
29
+ expect(subject["keys"]).to include("bar")
30
+ expect(subject["keys"]).to include("lord_füü")
31
+ end
32
+ end
33
+
34
+ context 'exclude paths' do
35
+ before do
36
+ get '/ignore', json_object, { 'CONTENT-TYPE' => 'application/json',
37
+ 'request-json-format' => 'underscore',
38
+ 'response-json-format' => 'underscore' }
39
+ end
40
+
41
+ subject { MultiJson.load(last_response.body) }
42
+
43
+ it 'should not touch the input keys and the response' do
44
+ expect(subject).to have_key('camelCase')
45
+ expect(subject).to have_key('snake_case')
46
+ expect(subject).to have_key('keys')
47
+ keys = subject['keys']
48
+ %w(userName lordFüü bar).each do |key|
49
+ expect(keys).to include(key)
50
+ end
51
+ end
52
+ end
53
+
54
+ context 'converts GET url parameters' do
55
+ before do
56
+ get '/upcase_first_name?userOptions[firstName]=susi',
57
+ {},
58
+ {
59
+ 'request-json-format' => 'underscore',
60
+ 'CONTENT-TYPE' => 'application/json'
61
+ }
62
+ end
63
+ subject { MultiJson.load(last_response.body) }
64
+
65
+ it 'should return an array as root element' do
66
+ expect(subject).to_not have_key("user_options")
67
+ expect(subject).to have_key("userOptions")
68
+ expect(subject["userOptions"]).to have_key("firstName")
69
+ expect(subject["userOptions"]["firstName"]).to eq("SUSI")
70
+ end
71
+ end
72
+
73
+ end
74
+
75
+ context "accept header is not given" do
76
+ context 'convert input params' do
77
+ before do
78
+ post '/posts', json, { "CONTENT_TYPE" => 'text/x-json' }
79
+ end
80
+
81
+ subject do
82
+ MultiJson.load(last_response.body)
83
+ end
84
+
85
+
86
+ it "did not convert lower camelcase to underscore params" do
87
+ expect(subject).to have_key("keys")
88
+ expect(subject["keys"]).to include("userName")
89
+ end
90
+
91
+ it "did not convert all UPPERCASE words to underscore params" do
92
+ expect(subject).to have_key("keys")
93
+ expect(subject["keys"]).to include("DE")
94
+ end
95
+
96
+ end
97
+
98
+ context 'convert response output keys' do
99
+ before do
100
+ get '/welcome', json_object, { 'CONTENT-TYPE' => 'application/json',
101
+ 'request-json-format' => 'camelize',
102
+ 'response-json-format' => 'underscore' }
103
+ end
104
+
105
+ subject do
106
+ MultiJson.load(last_response.body)
107
+ end
108
+
109
+ it 'underscores the response' do
110
+ expect(subject).to_not have_key('fakeKey')
111
+ expect(subject).to have_key('fake_key')
112
+ expect(subject['fake_key']).to eq false
113
+ end
114
+ end
115
+
116
+ context 'convert elements if root element is an array instead of hash' do
117
+ before do
118
+ get '/array_of_elements', nil, {
119
+ 'CONTENT-TYPE' => 'application/json; charset=utf-8'
120
+ }
121
+ end
122
+ subject { MultiJson.load(last_response.body) }
123
+
124
+ it 'should return an array as root element' do
125
+ expect(subject.class).to eq Array
126
+ expect(subject.first).to_not have_key("fake_key")
127
+ expect(subject.first).to have_key("fakeKey")
128
+ end
129
+
130
+ end
131
+
132
+ context 'reaction on error responses' do
133
+ require 'action_controller/metal/exceptions'
134
+ it 'lets Rails do its RoutingError when the url is not found' do
135
+ expect do
136
+ get '/not_found_url', {}, { 'CONTENT-TYPE' => 'application/json' }
137
+ end.to raise_error ActionController::RoutingError
138
+ end
139
+
140
+ it 'does not touch the response if a server error gets triggered' do
141
+ expect {
142
+ get '/error', {}, { 'CONTENT-TYPE' => 'application/json' }
143
+ }.to raise_error ZeroDivisionError
144
+ end
145
+ end
146
+
147
+ describe 'the configuration of allowed content types' do
148
+ it 'does not process requests and responses that have disallowed content
149
+ types' do
150
+ get '/welcome', json_object, { 'CONTENT-TYPE' => 'text/html',
151
+ 'request-json-format' => 'underscore' }
152
+
153
+ last_json = MultiJson.load(last_response.body)
154
+ expect(last_json).to have_key 'fakeKey'
155
+ expect(last_json).to have_key 'keys'
156
+ end
157
+
158
+ it 'processes nothing if content-types configured contains nil and content type is sent' do
159
+ Sparrow.configure do |config|
160
+ config.allowed_content_types = [nil]
161
+ end
162
+
163
+ post '/posts', json, { 'request-json-format' => 'underscore',
164
+ 'response-json-format' => 'underscore',
165
+ 'CONTENT-TYPE' => 'something' }
166
+ last_json = MultiJson.load(last_response.body)
167
+ expect(last_json['keys']).to include('userName')
168
+ expect(last_json['keys']).to include('DE')
169
+ end
170
+
171
+ it 'processes everything if content-types configured contains nil and content-type is empty' do
172
+ Sparrow.configure do |config|
173
+ config.allowed_content_types = [nil]
174
+ end
175
+
176
+ post '/posts', json, { 'request-json-format' => 'underscore',
177
+ 'response-json-format' => 'underscore',
178
+ 'CONTENT_TYPE' => ''
179
+ }
180
+
181
+ last_json = MultiJson.load(last_response.body)
182
+ expect(last_json['keys']).to include('user_name')
183
+ expect(last_json['keys']).to include('bar')
184
+ # at the moment the "let uppercase as it is"-option only works for
185
+ # camelCase. This test implies that.
186
+ expect(last_json['keys']).to include('de')
187
+ end
188
+
189
+ it 'processes everything if content-types configured contains nil and no content-type is sent' do
190
+ Sparrow.configure do |config|
191
+ config.allowed_content_types = [nil]
192
+ end
193
+
194
+ post '/posts', json, { 'request-json-format' => 'underscore',
195
+ 'response-json-format' => 'underscore',
196
+ 'CONTENT_TYPE' => ''}
197
+
198
+ last_json = MultiJson.load(last_response.body)
199
+ expect(last_json['keys']).to include('user_name')
200
+ expect(last_json['keys']).to include('bar')
201
+ # at the moment the "let uppercase as it is"-option only works for
202
+ # camelCase. This test implies that.
203
+ expect(last_json['keys']).to include('de')
204
+ end
205
+ end
206
+ end
207
+ end
@@ -0,0 +1,12 @@
1
+ require 'rspec'
2
+ require 'rspec/its'
3
+ require 'rack/test'
4
+ require 'multi_json'
5
+
6
+ Dir[File.join(File.dirname(__FILE__),"/support/**/*.rb")].each {|f| require f}
7
+
8
+ RSpec.configure do |config|
9
+ config.include RackAppHelper, type: :rack
10
+ config.include RailsAppHelper, type: :rails
11
+ config.include UnitSpecHelper, type: :unit
12
+ end
@@ -0,0 +1,19 @@
1
+ module RackAppHelper
2
+ include Rack::Test::Methods
3
+
4
+ def app
5
+ Rack::Builder.parse_file(config_ru_path).first
6
+ end
7
+
8
+ private
9
+
10
+ def config_ru_path
11
+ File.expand_path(File.join(File.dirname(__FILE__),
12
+ '..',
13
+ 'integration',
14
+ 'apps',
15
+ 'rack_app',
16
+ 'config.ru'))
17
+ end
18
+
19
+ end
@@ -0,0 +1,21 @@
1
+ ENV["RAILS_ENV"] ||= "test"
2
+
3
+ #require File.expand_path("../../apps/rails_app/config/environment.rb", __FILE__)
4
+ module RailsAppHelper
5
+ include Rack::Test::Methods
6
+
7
+ def app
8
+ Rack::Builder.parse_file(config_ru_path).first
9
+ end
10
+
11
+ private
12
+ def config_ru_path
13
+ File.expand_path(File.join(File.dirname(__FILE__),
14
+ '..',
15
+ 'integration',
16
+ 'apps',
17
+ 'rails_app',
18
+ 'config.ru'))
19
+
20
+ end
21
+ end
@@ -0,0 +1,5 @@
1
+ ENV["RAILS_ENV"] ||= "test"
2
+
3
+ module UnitSpecHelper
4
+ require 'sparrow'
5
+ end
@@ -0,0 +1,23 @@
1
+ require 'spec_helper'
2
+
3
+ describe Sparrow do
4
+ describe 'configuration' do
5
+ it 'should return a Configuration object' do
6
+ expect(Sparrow.configuration).to(
7
+ be_an_instance_of(Sparrow::Configuration))
8
+ end
9
+ end
10
+
11
+ describe 'configure' do
12
+ it 'should yield the configuration and save it' do
13
+ Sparrow.configure do |configuration|
14
+ configuration.json_request_format_header = 'panda'
15
+ configuration.excluded_routes = ['panda']
16
+ end
17
+
18
+ configuration = Sparrow.configuration
19
+ expect(configuration.json_request_format_header).to eq 'panda'
20
+ expect(configuration.excluded_routes).to eq ['panda']
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,19 @@
1
+ require 'spec_helper'
2
+
3
+ describe Sparrow::Strategies::CamelizeKey do
4
+
5
+ subject { Sparrow::Strategies::CamelizeKey.new }
6
+
7
+ describe '#transform_key' do
8
+
9
+ it 'should camelize it´s inputs (defaulting to lower case camelizing)' do
10
+ output = subject.transform_key("wireless_configuration")
11
+ expect(output).to eq("wirelessConfiguration")
12
+ end
13
+
14
+ it 'should leave all_uppercase strings as they are' do
15
+ output = subject.transform_key("DE")
16
+ expect(output).to eq("DE")
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,47 @@
1
+ require 'spec_helper'
2
+
3
+ module Sparrow
4
+ describe Configuration, type: 'unit' do
5
+ its(:json_request_format_header) { is_expected.to eq 'request-json-format' }
6
+ its(:json_response_format_header) do
7
+ is_expected.to eq 'response-json-format'
8
+ end
9
+ its(:excluded_routes) { is_expected.to eq [] }
10
+ its(:default_json_request_key_transformation_strategy) do
11
+ is_expected.to eq :camelize
12
+ end
13
+
14
+ its(:default_json_response_key_transformation_strategy) do
15
+ is_expected.to eq :camelize
16
+ end
17
+
18
+ its(:allowed_content_types) do
19
+ is_expected.to include 'application/json'
20
+ end
21
+
22
+ describe 'json_format_header' do
23
+ specify do
24
+ actual = subject.json_format_header(:response)
25
+ expect(actual).to eq 'response-json-format'
26
+ end
27
+
28
+ specify do
29
+ actual = subject.json_format_header(:request)
30
+ expect(actual).to eq 'request-json-format'
31
+ end
32
+ end
33
+
34
+
35
+ describe 'default_json_key_transformation_strategy' do
36
+ specify do
37
+ actual = subject.default_json_key_transformation_strategy(:response)
38
+ expect(actual).to eq :camelize
39
+ end
40
+
41
+ specify do
42
+ actual = subject.default_json_key_transformation_strategy(:request)
43
+ expect(actual).to eq :camelize
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,23 @@
1
+ require 'spec_helper'
2
+
3
+ module Sparrow
4
+ describe PathNormalizer, type: :unit do
5
+ let(:clazz) do
6
+ Class.new do
7
+ include PathNormalizer
8
+ end
9
+ end
10
+
11
+ subject { clazz.new }
12
+
13
+ describe '.normalize_path' do
14
+ it 'should remove any starting slash from the path string' do
15
+ expect(subject.normalize_path('/panda')).to eq 'panda'
16
+ end
17
+
18
+ it 'should not touch any strings that do not start with a slash' do
19
+ expect(subject.normalize_path('panda')).to eq 'panda'
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,45 @@
1
+ require 'spec_helper'
2
+
3
+ module Sparrow
4
+ describe RouteParser, type: :unit do
5
+ describe '#excluded routes' do
6
+ it 'should default to the excluded routes from the configuration' do
7
+
8
+ end
9
+
10
+ it 'should be set to the value given in the constructor as regexes' do
11
+ expected = [/panda/, /bamboo/]
12
+ actual = RouteParser.new(expected).excluded_routes
13
+ expect(actual).to eq expected
14
+ end
15
+ end
16
+
17
+ describe '#exclude?' do
18
+ it 'should return true if the path is in the excluded routes' do
19
+ path = '/panda'
20
+ route_parser = RouteParser.new(['panda'])
21
+ expect(route_parser.exclude?(path)).to eq true
22
+ end
23
+
24
+ it 'should return false if the path is not in the excluded routes' do
25
+ path = '/panda'
26
+ route_parser = RouteParser.new([])
27
+ expect(route_parser.exclude?(path)).to eq false
28
+ end
29
+ end
30
+
31
+ describe '#allow?' do
32
+ it 'should return false if the path is in the excluded routes' do
33
+ path = '/panda'
34
+ route_parser = RouteParser.new(['panda'])
35
+ expect(route_parser.allow?(path)).to eq false
36
+ end
37
+
38
+ it 'should return true if the path is not in the excluded routes' do
39
+ path = '/panda'
40
+ route_parser = RouteParser.new([])
41
+ expect(route_parser.allow?(path)).to eq true
42
+ end
43
+ end
44
+ end
45
+ end
metadata ADDED
@@ -0,0 +1,295 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cp-sparrow
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.11
5
+ platform: ruby
6
+ authors:
7
+ - Daniel Schmidt
8
+ - Andreas Müller
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2015-06-10 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: activesupport
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ">="
19
+ - !ruby/object:Gem::Version
20
+ version: 3.2.17
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ version: 3.2.17
28
+ - !ruby/object:Gem::Dependency
29
+ name: pry
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ type: :development
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ - !ruby/object:Gem::Dependency
43
+ name: bundler
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - "~>"
47
+ - !ruby/object:Gem::Version
48
+ version: '1.5'
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - "~>"
54
+ - !ruby/object:Gem::Version
55
+ version: '1.5'
56
+ - !ruby/object:Gem::Dependency
57
+ name: rake
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ - !ruby/object:Gem::Dependency
71
+ name: rspec
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - "~>"
75
+ - !ruby/object:Gem::Version
76
+ version: '3'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - "~>"
82
+ - !ruby/object:Gem::Version
83
+ version: '3'
84
+ - !ruby/object:Gem::Dependency
85
+ name: rspec-its
86
+ requirement: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ type: :development
92
+ prerelease: false
93
+ version_requirements: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
98
+ - !ruby/object:Gem::Dependency
99
+ name: rack-test
100
+ requirement: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ type: :development
106
+ prerelease: false
107
+ version_requirements: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - ">="
110
+ - !ruby/object:Gem::Version
111
+ version: '0'
112
+ - !ruby/object:Gem::Dependency
113
+ name: multi_json
114
+ requirement: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - ">="
117
+ - !ruby/object:Gem::Version
118
+ version: '0'
119
+ type: :development
120
+ prerelease: false
121
+ version_requirements: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - ">="
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ - !ruby/object:Gem::Dependency
127
+ name: rails
128
+ requirement: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - '='
131
+ - !ruby/object:Gem::Version
132
+ version: 3.2.21
133
+ type: :development
134
+ prerelease: false
135
+ version_requirements: !ruby/object:Gem::Requirement
136
+ requirements:
137
+ - - '='
138
+ - !ruby/object:Gem::Version
139
+ version: 3.2.21
140
+ description: "\n A collection of 2 middlewares to convert json formats to other
141
+ formats\nsuch as camelCase and snake_case. Both converting responses and requests
142
+ are\nsupported.\n "
143
+ email:
144
+ - dsci@code79.net
145
+ - anmuel86@gmail.com
146
+ executables: []
147
+ extensions: []
148
+ extra_rdoc_files: []
149
+ files:
150
+ - ".gitignore"
151
+ - ".ruby-gemset"
152
+ - ".ruby-version"
153
+ - Gemfile
154
+ - LICENSE.txt
155
+ - README.md
156
+ - Rakefile
157
+ - lib/sparrow.rb
158
+ - lib/sparrow/configuration.rb
159
+ - lib/sparrow/core_ext/hash.rb
160
+ - lib/sparrow/middleware.rb
161
+ - lib/sparrow/path_normalizer.rb
162
+ - lib/sparrow/railtie.rb
163
+ - lib/sparrow/request_middleware.rb
164
+ - lib/sparrow/response_middleware.rb
165
+ - lib/sparrow/route_parser.rb
166
+ - lib/sparrow/strategies/form_hash.rb
167
+ - lib/sparrow/strategies/ignore.rb
168
+ - lib/sparrow/strategies/json_format_strategies/array_strategy.rb
169
+ - lib/sparrow/strategies/json_format_strategies/default_json_format_strategy.rb
170
+ - lib/sparrow/strategies/json_format_strategies/json_format_strategy.rb
171
+ - lib/sparrow/strategies/json_format_strategies/rack_body.rb
172
+ - lib/sparrow/strategies/key_transformation/camelize_key.rb
173
+ - lib/sparrow/strategies/key_transformation/key_normalizer.rb
174
+ - lib/sparrow/strategies/key_transformation/underscore_key.rb
175
+ - lib/sparrow/strategies/raw_input.rb
176
+ - lib/sparrow/strategies/transform_params.rb
177
+ - lib/sparrow/transformable.rb
178
+ - lib/sparrow/version.rb
179
+ - sparrow.gemspec
180
+ - spec/integration/apps/rack_app/app.rb
181
+ - spec/integration/apps/rack_app/config.ru
182
+ - spec/integration/apps/rails_app/README.rdoc
183
+ - spec/integration/apps/rails_app/Rakefile
184
+ - spec/integration/apps/rails_app/app/assets/javascripts/application.js
185
+ - spec/integration/apps/rails_app/app/assets/stylesheets/application.css
186
+ - spec/integration/apps/rails_app/app/controllers/application_controller.rb
187
+ - spec/integration/apps/rails_app/app/controllers/welcome_controller.rb
188
+ - spec/integration/apps/rails_app/app/helpers/application_helper.rb
189
+ - spec/integration/apps/rails_app/app/mailers/.gitkeep
190
+ - spec/integration/apps/rails_app/app/models/.gitkeep
191
+ - spec/integration/apps/rails_app/app/views/layouts/application.html.erb
192
+ - spec/integration/apps/rails_app/config.ru
193
+ - spec/integration/apps/rails_app/config/application.rb
194
+ - spec/integration/apps/rails_app/config/boot.rb
195
+ - spec/integration/apps/rails_app/config/environment.rb
196
+ - spec/integration/apps/rails_app/config/environments/development.rb
197
+ - spec/integration/apps/rails_app/config/environments/production.rb
198
+ - spec/integration/apps/rails_app/config/environments/test.rb
199
+ - spec/integration/apps/rails_app/config/initializers/backtrace_silencers.rb
200
+ - spec/integration/apps/rails_app/config/initializers/inflections.rb
201
+ - spec/integration/apps/rails_app/config/initializers/mime_types.rb
202
+ - spec/integration/apps/rails_app/config/initializers/secret_token.rb
203
+ - spec/integration/apps/rails_app/config/initializers/session_store.rb
204
+ - spec/integration/apps/rails_app/config/initializers/wrap_parameters.rb
205
+ - spec/integration/apps/rails_app/config/locales/en.yml
206
+ - spec/integration/apps/rails_app/config/routes.rb
207
+ - spec/integration/apps/rails_app/lib/assets/.gitkeep
208
+ - spec/integration/apps/rails_app/public/404.html
209
+ - spec/integration/apps/rails_app/public/422.html
210
+ - spec/integration/apps/rails_app/public/500.html
211
+ - spec/integration/apps/rails_app/public/favicon.ico
212
+ - spec/integration/apps/rails_app/script/rails
213
+ - spec/integration/rack/camel_caser_spec.rb
214
+ - spec/integration/rails/camel_caser_accept_header_spec.rb
215
+ - spec/integration/rails/camel_caser_spec.rb
216
+ - spec/spec_helper.rb
217
+ - spec/support/rack_app_helper.rb
218
+ - spec/support/rails_app_helper.rb
219
+ - spec/support/unit_spec_helper.rb
220
+ - spec/unit/camel_caser_spec.rb
221
+ - spec/unit/camelize_key_spec.rb
222
+ - spec/unit/configuration_spec.rb
223
+ - spec/unit/path_normalizer_spec.rb
224
+ - spec/unit/route_parser_spec.rb
225
+ homepage: ''
226
+ licenses:
227
+ - MIT
228
+ metadata: {}
229
+ post_install_message:
230
+ rdoc_options: []
231
+ require_paths:
232
+ - lib
233
+ required_ruby_version: !ruby/object:Gem::Requirement
234
+ requirements:
235
+ - - ">="
236
+ - !ruby/object:Gem::Version
237
+ version: '0'
238
+ required_rubygems_version: !ruby/object:Gem::Requirement
239
+ requirements:
240
+ - - ">="
241
+ - !ruby/object:Gem::Version
242
+ version: '0'
243
+ requirements: []
244
+ rubyforge_project:
245
+ rubygems_version: 2.4.3
246
+ signing_key:
247
+ specification_version: 4
248
+ summary: A POC to have a Rack middleware parsing the params keys into underscore
249
+ test_files:
250
+ - spec/integration/apps/rack_app/app.rb
251
+ - spec/integration/apps/rack_app/config.ru
252
+ - spec/integration/apps/rails_app/README.rdoc
253
+ - spec/integration/apps/rails_app/Rakefile
254
+ - spec/integration/apps/rails_app/app/assets/javascripts/application.js
255
+ - spec/integration/apps/rails_app/app/assets/stylesheets/application.css
256
+ - spec/integration/apps/rails_app/app/controllers/application_controller.rb
257
+ - spec/integration/apps/rails_app/app/controllers/welcome_controller.rb
258
+ - spec/integration/apps/rails_app/app/helpers/application_helper.rb
259
+ - spec/integration/apps/rails_app/app/mailers/.gitkeep
260
+ - spec/integration/apps/rails_app/app/models/.gitkeep
261
+ - spec/integration/apps/rails_app/app/views/layouts/application.html.erb
262
+ - spec/integration/apps/rails_app/config.ru
263
+ - spec/integration/apps/rails_app/config/application.rb
264
+ - spec/integration/apps/rails_app/config/boot.rb
265
+ - spec/integration/apps/rails_app/config/environment.rb
266
+ - spec/integration/apps/rails_app/config/environments/development.rb
267
+ - spec/integration/apps/rails_app/config/environments/production.rb
268
+ - spec/integration/apps/rails_app/config/environments/test.rb
269
+ - spec/integration/apps/rails_app/config/initializers/backtrace_silencers.rb
270
+ - spec/integration/apps/rails_app/config/initializers/inflections.rb
271
+ - spec/integration/apps/rails_app/config/initializers/mime_types.rb
272
+ - spec/integration/apps/rails_app/config/initializers/secret_token.rb
273
+ - spec/integration/apps/rails_app/config/initializers/session_store.rb
274
+ - spec/integration/apps/rails_app/config/initializers/wrap_parameters.rb
275
+ - spec/integration/apps/rails_app/config/locales/en.yml
276
+ - spec/integration/apps/rails_app/config/routes.rb
277
+ - spec/integration/apps/rails_app/lib/assets/.gitkeep
278
+ - spec/integration/apps/rails_app/public/404.html
279
+ - spec/integration/apps/rails_app/public/422.html
280
+ - spec/integration/apps/rails_app/public/500.html
281
+ - spec/integration/apps/rails_app/public/favicon.ico
282
+ - spec/integration/apps/rails_app/script/rails
283
+ - spec/integration/rack/camel_caser_spec.rb
284
+ - spec/integration/rails/camel_caser_accept_header_spec.rb
285
+ - spec/integration/rails/camel_caser_spec.rb
286
+ - spec/spec_helper.rb
287
+ - spec/support/rack_app_helper.rb
288
+ - spec/support/rails_app_helper.rb
289
+ - spec/support/unit_spec_helper.rb
290
+ - spec/unit/camel_caser_spec.rb
291
+ - spec/unit/camelize_key_spec.rb
292
+ - spec/unit/configuration_spec.rb
293
+ - spec/unit/path_normalizer_spec.rb
294
+ - spec/unit/route_parser_spec.rb
295
+ has_rdoc: