simple_rest 0.0.4 → 0.0.5
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.
- data/README.rdoc +1 -0
- data/lib/simple_rest/action_controller_responder_methods.rb +15 -0
- data/lib/simple_rest/railtie.rb +7 -0
- data/lib/simple_rest.rb +3 -4
- data/test/log/development.log +14 -0
- data/test/simple_rest_test.rb +6 -6
- metadata +4 -2
data/README.rdoc
CHANGED
@@ -1,5 +1,16 @@
|
|
1
1
|
module SimpleRest
|
2
2
|
module ActionControllerResponderMethods
|
3
|
+
def self.included(base)
|
4
|
+
default_to_html = base.instance_method(:to_html)
|
5
|
+
base.send :define_method, :to_html do
|
6
|
+
begin
|
7
|
+
to_html_with_opts
|
8
|
+
rescue ActionView::MissingTemplate
|
9
|
+
default_to_html.bind(base).call
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
3
14
|
def to_js
|
4
15
|
status = options[:status] || :ok
|
5
16
|
render :json => resource.to_json(options[:serialize_opts] || {}), :status => status
|
@@ -24,6 +35,10 @@ module SimpleRest
|
|
24
35
|
render ({:content_type => :js, :text => text}.merge(options.merge(:status=>:ok)))
|
25
36
|
end
|
26
37
|
|
38
|
+
def to_html_with_opts
|
39
|
+
render options
|
40
|
+
end
|
41
|
+
|
27
42
|
def build_jsonp_message(data, options)
|
28
43
|
message = {:status=>options[:status] || 200, :data=>data}
|
29
44
|
json = message.to_json(options)
|
data/lib/simple_rest.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
$:.unshift(File.dirname(__FILE__)) unless
|
2
2
|
$:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
|
3
3
|
module SimpleRest
|
4
|
-
VERSION = '0.0.
|
4
|
+
VERSION = '0.0.5'
|
5
5
|
autoload :ActionControllerMethods, 'simple_rest/action_controller_methods'
|
6
6
|
autoload :ActionControllerResponderMethods, 'simple_rest/action_controller_responder_methods'
|
7
7
|
class << self
|
@@ -22,6 +22,5 @@ module SimpleRest
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
-
|
26
|
-
|
27
|
-
end
|
25
|
+
require "rails/railtie"
|
26
|
+
require "simple_rest/railtie"
|
@@ -0,0 +1,14 @@
|
|
1
|
+
DEPRECATION WARNING: simple_rest is deprecated. Please use respond_with instead. (called from simple_rest at /home/bondarev/projects/simple_rest/lib/simple_rest/action_controller_methods.rb:27)
|
2
|
+
DEPRECATION WARNING: simple_rest is deprecated. Please use respond_with instead. (called from simple_rest at /home/bondarev/projects/simple_rest/lib/simple_rest/action_controller_methods.rb:27)
|
3
|
+
DEPRECATION WARNING: simple_rest is deprecated. Please use respond_with instead. (called from simple_rest at /home/bondarev/projects/simple_rest/lib/simple_rest/action_controller_methods.rb:27)
|
4
|
+
DEPRECATION WARNING: simple_rest is deprecated. Please use respond_with instead. (called from simple_rest at /home/bondarev/projects/simple_rest/lib/simple_rest/action_controller_methods.rb:27)
|
5
|
+
DEPRECATION WARNING: simple_rest is deprecated. Please use respond_with instead. (called from simple_rest at /home/bondarev/projects/simple_rest/lib/simple_rest/action_controller_methods.rb:27)
|
6
|
+
DEPRECATION WARNING: simple_rest is deprecated. Please use respond_with instead. (called from simple_rest at /home/bondarev/projects/simple_rest/lib/simple_rest/action_controller_methods.rb:27)
|
7
|
+
DEPRECATION WARNING: simple_rest is deprecated. Please use respond_with instead. (called from simple_rest at /home/bondarev/projects/simple_rest/lib/simple_rest/action_controller_methods.rb:27)
|
8
|
+
DEPRECATION WARNING: simple_rest is deprecated. Please use respond_with instead. (called from simple_rest at /home/bondarev/projects/simple_rest/lib/simple_rest/action_controller_methods.rb:27)
|
9
|
+
DEPRECATION WARNING: simple_rest is deprecated. Please use respond_with instead. (called from simple_rest at /home/bondarev/projects/simple_rest/lib/simple_rest/action_controller_methods.rb:27)
|
10
|
+
DEPRECATION WARNING: simple_rest is deprecated. Please use respond_with instead. (called from simple_rest at /home/bondarev/projects/simple_rest/lib/simple_rest/action_controller_methods.rb:27)
|
11
|
+
DEPRECATION WARNING: simple_rest is deprecated. Please use respond_with instead. (called from simple_rest at /home/bondarev/projects/simple_rest/lib/simple_rest/action_controller_methods.rb:27)
|
12
|
+
DEPRECATION WARNING: simple_rest is deprecated. Please use respond_with instead. (called from simple_rest at /home/bondarev/projects/simple_rest/lib/simple_rest/action_controller_methods.rb:27)
|
13
|
+
DEPRECATION WARNING: simple_rest is deprecated. Please use respond_with instead. (called from simple_rest at /home/bondarev/projects/simple_rest/lib/simple_rest/action_controller_methods.rb:27)
|
14
|
+
DEPRECATION WARNING: simple_rest is deprecated. Please use respond_with instead. (called from simple_rest at /home/bondarev/projects/simple_rest/lib/simple_rest/action_controller_methods.rb:27)
|
data/test/simple_rest_test.rb
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + '/test_helper.rb')
|
2
2
|
|
3
|
+
class TestApp < Rails::Application
|
4
|
+
|
5
|
+
end
|
6
|
+
|
7
|
+
TestApp.initialize!
|
8
|
+
|
3
9
|
class MyController < ActionController::Base
|
4
10
|
rescue_exceptions_restfully
|
5
11
|
|
@@ -28,12 +34,6 @@ class MyController < ActionController::Base
|
|
28
34
|
end
|
29
35
|
end
|
30
36
|
|
31
|
-
class TestApp < Rails::Application
|
32
|
-
|
33
|
-
end
|
34
|
-
|
35
|
-
TestApp.initialize!
|
36
|
-
|
37
37
|
class MyControllerTest < ActionController::TestCase
|
38
38
|
def setup
|
39
39
|
@routes = ActionDispatch::Routing::RouteSet.new
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 5
|
9
|
+
version: 0.0.5
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- niquola,smecsia,mirasrael
|
@@ -42,10 +42,12 @@ extra_rdoc_files:
|
|
42
42
|
files:
|
43
43
|
- README.rdoc
|
44
44
|
- Rakefile
|
45
|
+
- lib/simple_rest/railtie.rb
|
45
46
|
- lib/simple_rest/action_controller_methods.rb
|
46
47
|
- lib/simple_rest/action_controller_responder_methods.rb
|
47
48
|
- lib/simple_rest.rb
|
48
49
|
- test/simple_rest_test.rb
|
50
|
+
- test/log/development.log
|
49
51
|
- test/test_helper.rb
|
50
52
|
has_rdoc: true
|
51
53
|
homepage:
|