acts_as_api 0.1.4 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +4 -0
- data/lib/acts_as_api.rb +1 -1
- data/lib/acts_as_api/rendering.rb +13 -2
- metadata +3 -3
data/History.txt
CHANGED
data/lib/acts_as_api.rb
CHANGED
@@ -16,7 +16,7 @@ require "acts_as_api/array"
|
|
16
16
|
# acts_as_api uses the default serializers of your rails app and doesn't
|
17
17
|
# force you into more dependencies.
|
18
18
|
module ActsAsApi
|
19
|
-
VERSION = '0.1.
|
19
|
+
VERSION = '0.1.7'
|
20
20
|
|
21
21
|
# The accepted response formats
|
22
22
|
# Default is +[:xml, :json]+
|
@@ -27,16 +27,27 @@ module ActsAsApi
|
|
27
27
|
# set the params to render
|
28
28
|
output_params = render_options
|
29
29
|
|
30
|
+
|
30
31
|
# set the name of the root node - pluralize for arrays
|
31
32
|
if api_model.is_a?(Array)
|
32
|
-
api_root_name = api_model.respond_to?(:
|
33
|
+
api_root_name = api_model.respond_to?(:model_name) ? api_model.model_name.singular.pluralize : api_model.first.class.model_name.singular.pluralize
|
33
34
|
else
|
34
|
-
api_root_name = api_model.class.
|
35
|
+
api_root_name = api_model.class.model_name.singular
|
35
36
|
end
|
36
37
|
|
38
|
+
api_root_name.dasherize if api_format.to_s == :xml.to_s
|
39
|
+
|
40
|
+
# Does not work
|
41
|
+
#api_root_name.camelize if api_format.to_s == :json.to_s
|
37
42
|
|
38
43
|
output_params[:root] ||= api_root_name
|
39
44
|
|
45
|
+
|
46
|
+
|
47
|
+
#output_params[:root] = output_params[:root].camelize if render_options.has_key?(:camelize) && render_options[:camelize]
|
48
|
+
#output_params[:root] = output_params[:root].dasherize if !render_options.has_key?(:dasherize) || render_options[:dasherize]
|
49
|
+
|
50
|
+
|
40
51
|
api_response = api_model.as_api_response
|
41
52
|
|
42
53
|
if ActsAsApi::ADD_ROOT_NODE_FOR.include? api_format
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
8
|
+
- 7
|
9
|
+
version: 0.1.7
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- "Christian B\xC3\xA4uerlein"
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-07-
|
17
|
+
date: 2010-07-05 00:00:00 +02:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|