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]
11 12 13 |
# File 'lib/acts_as_api/config.rb', line 11 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
51 52 53 |
# File 'lib/acts_as_api/config.rb', line 51 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.
31 32 33 |
# File 'lib/acts_as_api/config.rb', line 31 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.
45 46 47 |
# File 'lib/acts_as_api/config.rb', line 45 def allow_jsonp_callback @allow_jsonp_callback || false end |
.dasherize_for ⇒ Object
Holds formats that should be dasherized
Default is [:xml]
17 18 19 |
# File 'lib/acts_as_api/config.rb', line 17 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
39 40 41 |
# File 'lib/acts_as_api/config.rb', line 39 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
24 25 26 |
# File 'lib/acts_as_api/config.rb', line 24 def include_root_in_json_collections @include_root_in_json_collections || false end |