transit-rails 0.8.2 → 0.8.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/transit/rails/railtie.rb +13 -1
- data/lib/transit/rails/reader.rb +14 -0
- data/lib/transit/rails/renderer.rb +2 -2
- data/lib/transit/rails/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ace36664ed8c88e8c9529819446e2732c70b4f81
|
4
|
+
data.tar.gz: f8d1807e3f1a7d18bbf2d2c75d115ac814a938d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 80ef4691970d1de180e6e8a66f0bfa06939806b9090d5d40d1cb68920efd2e521fa63f82c9f1928bff5b4181975a38f50652174120e435558e7ffa2b7b3ff696
|
7
|
+
data.tar.gz: 575a453e336cb2a7e982d4852a8f979e7a77bb686b5707c6a87abd0fb5cfcbc9566b50d33b97729d4bd34692dc875deef80e3395e011a90fe1f71c9afab9aa14
|
@@ -3,7 +3,7 @@ require 'rails/railtie'
|
|
3
3
|
module Transit
|
4
4
|
module Rails
|
5
5
|
class Railtie < ::Rails::Railtie
|
6
|
-
config.
|
6
|
+
config.before_initialize do
|
7
7
|
require 'transit/rails/renderer'
|
8
8
|
require 'action_controller/metal/renderers'
|
9
9
|
|
@@ -11,10 +11,22 @@ module Transit
|
|
11
11
|
Mime::Type.register_alias "application/transit+json", :transit_verbose
|
12
12
|
Mime::Type.register "application/transit+msgpack", :transit_msgpack
|
13
13
|
|
14
|
+
end
|
15
|
+
|
16
|
+
config.after_initialize do
|
14
17
|
ActionController.add_renderer :transit do |obj, options|
|
15
18
|
Transit::Rails::Renderer.new(obj, options).render
|
16
19
|
end
|
17
20
|
end
|
21
|
+
|
22
|
+
initializer "transit.configure_rails_initialization" do |app|
|
23
|
+
require 'transit/rails/reader'
|
24
|
+
app.middleware.swap("ActionDispatch::ParamsParser",
|
25
|
+
"ActionDispatch::ParamsParser", {
|
26
|
+
Mime::TRANSIT => Transit::Rails::Reader.make_reader(:json),
|
27
|
+
Mime::TRANSIT_MSGPACK => Transit::Rails::Reader.make_reader(:msgpack)
|
28
|
+
})
|
29
|
+
end
|
18
30
|
end
|
19
31
|
end
|
20
32
|
end
|
@@ -35,8 +35,8 @@ module Transit
|
|
35
35
|
private
|
36
36
|
def serialize_for_transit(obj)
|
37
37
|
return obj if String === obj
|
38
|
-
if obj.respond_to?(:
|
39
|
-
obj.
|
38
|
+
if obj.respond_to?(:as_transit)
|
39
|
+
obj.as_transit
|
40
40
|
elsif obj.respond_to?(:serializable_hash)
|
41
41
|
if @symbolize_keys
|
42
42
|
obj.serializable_hash.symbolize_keys
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: transit-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joshua Davey
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-10-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: transit-ruby
|
@@ -64,6 +64,7 @@ files:
|
|
64
64
|
- lib/transit/rails.rb
|
65
65
|
- lib/transit/rails/handlers.rb
|
66
66
|
- lib/transit/rails/railtie.rb
|
67
|
+
- lib/transit/rails/reader.rb
|
67
68
|
- lib/transit/rails/renderer.rb
|
68
69
|
- lib/transit/rails/version.rb
|
69
70
|
- spec/spec_helper.rb
|