acts_as_api 0.3.7 → 0.3.8
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/.travis.yml +4 -0
- data/History.txt +4 -0
- data/README.rdoc +6 -2
- data/Rakefile +2 -0
- data/lib/acts_as_api/config.rb +28 -13
- data/lib/acts_as_api/version.rb +1 -1
- data/spec/rails_app/config/mongoid.yml +2 -10
- metadata +5 -4
data/.travis.yml
ADDED
data/History.txt
CHANGED
data/README.rdoc
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
= acts_as_api
|
1
|
+
= acts_as_api http://travis-ci.org/fabrik42/acts_as_api.png
|
2
2
|
|
3
3
|
acts_as_api makes creating XML/JSON responses in Rails 3 easy and fun.
|
4
4
|
|
@@ -65,11 +65,15 @@ https://github.com/fabrik42/acts_as_api/wiki
|
|
65
65
|
|
66
66
|
* Wiki: https://github.com/fabrik42/acts_as_api/wiki
|
67
67
|
|
68
|
+
=== Travis CI build status http://travis-ci.org/fabrik42/acts_as_api.png
|
69
|
+
|
70
|
+
Specs run with 1.9.2, 1.8.7 and REE: http://travis-ci.org/#!/fabrik42/acts_as_api
|
71
|
+
|
68
72
|
=== Tested with:
|
69
73
|
|
70
74
|
* MRI 1.9.2-p180
|
71
75
|
* MRI 1.8.7-p334
|
72
|
-
* But it just should work fine with other versions too... :)
|
76
|
+
* But it just should work fine with other versions too... :)
|
73
77
|
|
74
78
|
=== Downwards Compatibility
|
75
79
|
|
data/Rakefile
CHANGED
data/lib/acts_as_api/config.rb
CHANGED
@@ -4,38 +4,53 @@ module ActsAsApi
|
|
4
4
|
|
5
5
|
class << self
|
6
6
|
|
7
|
+
attr_writer :accepted_api_formats, :dasherize_for, :include_root_in_json_collections, :add_root_node_for, :default_root, :allow_jsonp_callback, :add_http_status_to_jsonp_response
|
8
|
+
|
7
9
|
# The accepted response formats
|
8
10
|
# Default is <tt>[:xml, :json]</tt>
|
9
|
-
|
10
|
-
|
11
|
+
def accepted_api_formats
|
12
|
+
@accepted_api_formats || [:xml, :json]
|
13
|
+
end
|
14
|
+
|
11
15
|
# Holds formats that should be dasherized
|
12
|
-
# Default is <tt>[:xml]</tt>
|
13
|
-
|
16
|
+
# Default is <tt>[:xml]</tt>
|
17
|
+
def dasherize_for
|
18
|
+
@dasherize_for || [:xml]
|
19
|
+
end
|
14
20
|
|
15
21
|
# If true, the root node in json collections will be added
|
16
22
|
# so the response will look like the default Rails 3 json
|
17
23
|
# response
|
18
|
-
|
19
|
-
|
24
|
+
def include_root_in_json_collections
|
25
|
+
@include_root_in_json_collections || false
|
26
|
+
end
|
27
|
+
|
20
28
|
# Holds references to formats that need
|
21
29
|
# to get added an additional root node
|
22
|
-
# with the name of the model.
|
23
|
-
|
30
|
+
# with the name of the model.
|
31
|
+
def add_root_node_for
|
32
|
+
@add_root_node_for || [:json]
|
33
|
+
end
|
24
34
|
|
25
35
|
# The default name of a root node of a response
|
26
36
|
# if no root paramter is passed in render_for_api
|
27
37
|
# and the gem is not able to determine a root name
|
28
|
-
# automatically
|
29
|
-
|
38
|
+
# automatically
|
39
|
+
def default_root
|
40
|
+
@default_root || :record
|
41
|
+
end
|
30
42
|
|
31
43
|
# If true a json response will be automatically wrapped into
|
32
44
|
# a JavaScript function call in case a :callback param is passed.
|
33
|
-
|
45
|
+
def allow_jsonp_callback
|
46
|
+
@allow_jsonp_callback || false
|
47
|
+
end
|
34
48
|
|
35
49
|
# If true the jsonp function call will get the http status passed
|
36
50
|
# as a second parameter
|
37
|
-
|
38
|
-
|
51
|
+
def add_http_status_to_jsonp_response
|
52
|
+
@add_http_status_to_jsonp_response || true
|
53
|
+
end
|
39
54
|
end
|
40
55
|
|
41
56
|
end
|
data/lib/acts_as_api/version.rb
CHANGED
@@ -1,17 +1,9 @@
|
|
1
|
-
defaults: &defaults
|
2
|
-
host: localhost
|
3
|
-
# slaves:
|
4
|
-
# - host: slave1.local
|
5
|
-
# port: 27018
|
6
|
-
# - host: slave2.local
|
7
|
-
# port: 27019
|
8
|
-
|
9
1
|
development:
|
10
|
-
|
2
|
+
host: localhost
|
11
3
|
database: acts_as_api_example_development
|
12
4
|
|
13
5
|
test:
|
14
|
-
|
6
|
+
host: localhost
|
15
7
|
database: acts_as_api_example_test
|
16
8
|
|
17
9
|
# set these environment variables on your prod server
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: acts_as_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 3
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
9
|
+
- 8
|
10
|
+
version: 0.3.8
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- "Christian B\xC3\xA4uerlein"
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-06-
|
18
|
+
date: 2011-06-21 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -109,6 +109,7 @@ extra_rdoc_files:
|
|
109
109
|
- README.rdoc
|
110
110
|
files:
|
111
111
|
- .gitignore
|
112
|
+
- .travis.yml
|
112
113
|
- Gemfile
|
113
114
|
- History.txt
|
114
115
|
- README.rdoc
|