Module: ActsAsApi::Config
- Defined in:
- lib/acts_as_api/config.rb
Class Attribute Summary collapse
-
.accepted_api_formats ⇒ Object
The accepted response formats Default is
[:xml, :json]. -
.add_http_status_to_jsonp_response ⇒ Object
If true the jsonp function call will get the http status passed as a second parameter.
-
.add_root_node_for ⇒ Object
Holds references to formats that need to get added an additional root node with the name of the model.
-
.allow_jsonp_callback ⇒ Object
If true a json response will be automatically wrapped into a JavaScript function call in case a :callback param is passed.
-
.dasherize_for ⇒ Object
Holds formats that should be dasherized Default is
[:xml]. -
.default_root ⇒ Object
The default name of a root node of a response if no root paramter is passed in render_for_api and the gem is not able to determine a root name automatically.
-
.include_root_in_json_collections ⇒ Object
If true, the root node in json collections will be added so the response will look like the default Rails 3 json response.
Class Attribute Details
.accepted_api_formats ⇒ Object
The accepted response formats Default is [:xml, :json]
8 9 10 |
# File 'lib/acts_as_api/config.rb', line 8 def accepted_api_formats @accepted_api_formats || [:xml, :json] end |
.add_http_status_to_jsonp_response ⇒ Object
If true the jsonp function call will get the http status passed as a second parameter
48 49 50 |
# File 'lib/acts_as_api/config.rb', line 48 def add_http_status_to_jsonp_response @add_http_status_to_jsonp_response.nil? ? true : @add_http_status_to_jsonp_response end |
.add_root_node_for ⇒ Object
Holds references to formats that need to get added an additional root node with the name of the model.
28 29 30 |
# File 'lib/acts_as_api/config.rb', line 28 def add_root_node_for @add_root_node_for || [:json] end |
.allow_jsonp_callback ⇒ Object
If true a json response will be automatically wrapped into a JavaScript function call in case a :callback param is passed.
42 43 44 |
# File 'lib/acts_as_api/config.rb', line 42 def allow_jsonp_callback @allow_jsonp_callback || false end |
.dasherize_for ⇒ Object
Holds formats that should be dasherized Default is [:xml]
14 15 16 |
# File 'lib/acts_as_api/config.rb', line 14 def dasherize_for @dasherize_for || [:xml] end |
.default_root ⇒ Object
The default name of a root node of a response if no root paramter is passed in render_for_api and the gem is not able to determine a root name automatically
36 37 38 |
# File 'lib/acts_as_api/config.rb', line 36 def default_root @default_root || :record end |
.include_root_in_json_collections ⇒ Object
If true, the root node in json collections will be added so the response will look like the default Rails 3 json response
21 22 23 |
# File 'lib/acts_as_api/config.rb', line 21 def include_root_in_json_collections @include_root_in_json_collections || false end |