ballast 2.2.4 → 2.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +6 -1
- data/.travis-gemfile +2 -2
- data/.travis.yml +5 -3
- data/.yardopts +1 -1
- data/CHANGELOG.md +9 -0
- data/Gemfile +1 -1
- data/LICENSE.md +21 -0
- data/README.md +22 -17
- data/Rakefile +1 -1
- data/ballast.gemspec +1 -1
- data/{doc → docs}/Ballast.html +19 -21
- data/docs/Ballast/AjaxResponse.html +1470 -0
- data/{doc → docs}/Ballast/Concerns.html +3 -3
- data/{doc → docs}/Ballast/Concerns/AjaxHandling.html +33 -38
- data/{doc → docs}/Ballast/Concerns/Common.html +45 -52
- data/{doc → docs}/Ballast/Concerns/ErrorsHandling.html +13 -14
- data/docs/Ballast/Concerns/JSONApi.html +127 -0
- data/docs/Ballast/Concerns/JSONApi/PaginationHandling.html +617 -0
- data/docs/Ballast/Concerns/JSONApi/RequestHandling.html +775 -0
- data/docs/Ballast/Concerns/JSONApi/ResponseHandling.html +917 -0
- data/{doc → docs}/Ballast/Concerns/View.html +35 -42
- data/{doc → docs}/Ballast/Configuration.html +19 -22
- data/{doc → docs}/Ballast/Emoji.html +1 -1
- data/{doc → docs}/Ballast/Emoji/Character.html +15 -18
- data/docs/Ballast/Emoji/Utils.html +794 -0
- data/{doc → docs}/Ballast/Errors.html +1 -1
- data/{doc → docs}/Ballast/Errors/Base.html +16 -18
- data/{doc → docs}/Ballast/Errors/Failure.html +1 -1
- data/{doc → docs}/Ballast/Errors/InvalidDomain.html +1 -1
- data/{doc → docs}/Ballast/Errors/ValidationFailure.html +1 -1
- data/{doc → docs}/Ballast/Middlewares.html +1 -1
- data/{doc → docs}/Ballast/Middlewares/DefaultHost.html +16 -18
- data/docs/Ballast/RequestDomainMatcher.html +917 -0
- data/docs/Ballast/Service.html +1513 -0
- data/docs/Ballast/Service/Response.html +1270 -0
- data/{doc → docs}/Ballast/Version.html +5 -9
- data/{doc → docs}/_index.html +45 -1
- data/docs/class_list.html +58 -0
- data/{doc → docs}/css/common.css +0 -0
- data/{doc → docs}/css/full_list.css +0 -0
- data/{doc → docs}/css/style.css +0 -0
- data/{doc → docs}/file.README.html +7 -5
- data/{doc → docs}/file_list.html +0 -0
- data/{doc → docs}/frames.html +0 -0
- data/{doc → docs}/index.html +7 -5
- data/{doc → docs}/js/app.js +0 -0
- data/{doc → docs}/js/full_list.js +0 -0
- data/{doc → docs}/js/jquery.js +0 -0
- data/{doc → docs}/method_list.html +150 -36
- data/docs/top-level-namespace.html +149 -0
- data/lib/ballast.rb +1 -1
- data/lib/ballast/ajax_response.rb +1 -1
- data/lib/ballast/concerns/ajax_handling.rb +1 -1
- data/lib/ballast/concerns/common.rb +1 -1
- data/lib/ballast/concerns/errors_handling.rb +1 -1
- data/lib/ballast/concerns/json_api/pagination_handling.rb +83 -0
- data/lib/ballast/concerns/json_api/request_handling.rb +235 -0
- data/lib/ballast/concerns/json_api/response_handling.rb +70 -0
- data/lib/ballast/concerns/view.rb +1 -1
- data/lib/ballast/configuration.rb +1 -1
- data/lib/ballast/emoji.rb +1 -1
- data/lib/ballast/errors.rb +1 -1
- data/lib/ballast/middlewares/default_host.rb +1 -1
- data/lib/ballast/request_domain_matcher.rb +1 -1
- data/lib/ballast/service.rb +1 -1
- data/lib/ballast/version.rb +2 -2
- data/spec/ballast/ajax_response_spec.rb +1 -1
- data/spec/ballast/concerns/ajax_handling_spec.rb +1 -1
- data/spec/ballast/concerns/common_spec.rb +1 -1
- data/spec/ballast/concerns/errors_handling_spec.rb +1 -1
- data/spec/ballast/concerns/view_spec.rb +1 -1
- data/spec/ballast/configuration_spec.rb +1 -1
- data/spec/ballast/errors_spec.rb +1 -1
- data/spec/ballast/middlewares/default_host_spec.rb +1 -1
- data/spec/ballast/request_domain_matcher_spec.rb +1 -1
- data/spec/ballast_spec.rb +1 -1
- data/spec/spec_helper.rb +1 -1
- metadata +47 -39
- data/doc/Ballast/AjaxResponse.html +0 -1478
- data/doc/Ballast/Emoji/Utils.html +0 -799
- data/doc/Ballast/RequestDomainMatcher.html +0 -923
- data/doc/Ballast/Service.html +0 -1522
- data/doc/Ballast/Service/Response.html +0 -1278
- data/doc/class_list.html +0 -58
- data/doc/top-level-namespace.html +0 -112
@@ -0,0 +1,70 @@
|
|
1
|
+
module Ballast
|
2
|
+
module Concerns
|
3
|
+
module JSONApi
|
4
|
+
# A concern to handle JSON API responses.
|
5
|
+
module ResponseHandling
|
6
|
+
attr_accessor :included
|
7
|
+
|
8
|
+
# Returns the template for a object. It can overriden by setting the `@object_template` variable.
|
9
|
+
#
|
10
|
+
# @return [String] The template for a object.
|
11
|
+
def response_template_for(object)
|
12
|
+
return @object_template if @object_template
|
13
|
+
object = object.first if object.respond_to?(:first)
|
14
|
+
object.class.name.underscore.gsub("/", "_")
|
15
|
+
end
|
16
|
+
|
17
|
+
# Returns the metadata for the current response.
|
18
|
+
#
|
19
|
+
# @param default [Object|NilClass] The default metadata to return if nothing is set.
|
20
|
+
# @return [HashWithIndifferentAccess] The metadata for the current response.
|
21
|
+
def response_meta(default = nil)
|
22
|
+
@meta || default || HashWithIndifferentAccess.new
|
23
|
+
end
|
24
|
+
|
25
|
+
# Returns the data for the current response.
|
26
|
+
#
|
27
|
+
# @param default [Object|NilClass] The default data to return if nothing is set.
|
28
|
+
# @return [HashWithIndifferentAccess] The data for the current response.
|
29
|
+
def response_data(default = nil)
|
30
|
+
@data || default || HashWithIndifferentAccess.new
|
31
|
+
end
|
32
|
+
|
33
|
+
# Returns the links for the current response.
|
34
|
+
#
|
35
|
+
# @param default [Object|NilClass] The default links to return if nothing is set.
|
36
|
+
# @return [HashWithIndifferentAccess] The links for the current response.
|
37
|
+
def response_links(default = nil)
|
38
|
+
@links || default || HashWithIndifferentAccess.new
|
39
|
+
end
|
40
|
+
|
41
|
+
# Returns the additionally included objects for the current response.
|
42
|
+
#
|
43
|
+
# @param default [Object|NilClass] The default included objects to return if nothing is set.
|
44
|
+
# @return [HashWithIndifferentAccess] The additionally included objects for the current response.
|
45
|
+
def response_included(default = nil)
|
46
|
+
controller.included || default || HashWithIndifferentAccess.new
|
47
|
+
end
|
48
|
+
|
49
|
+
# Adds a object to the set of included objects.
|
50
|
+
#
|
51
|
+
# @param object [Object] The object to include.
|
52
|
+
# @param template [String|Nilclass] The template to use for rendering. If not set, it's guessed from object class.
|
53
|
+
# @return [HashWithIndifferentAccess] The new set of included objects.
|
54
|
+
def response_include(object, template = nil)
|
55
|
+
controller.included ||= HashWithIndifferentAccess.new
|
56
|
+
controller.included[sprintf("%s:%s", response_template_for(object), object.to_param)] = [object, template]
|
57
|
+
controller.included
|
58
|
+
end
|
59
|
+
|
60
|
+
# Formats a timestamp in ISO 8601 format.
|
61
|
+
#
|
62
|
+
# @param timestamp [DateTime|Time|Date] The timestamp to format.
|
63
|
+
# @return [String] The timestamp in ISO 8601 format.
|
64
|
+
def response_timestamp(timestamp)
|
65
|
+
timestamp.safe_send(:strftime, "%FT%T.%L%z")
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# This file is part of the ballast gem. Copyright (C) 2013 and above Shogun <shogun@cowtech.it>.
|
3
|
-
# Licensed under the MIT license, which can be found at
|
3
|
+
# Licensed under the MIT license, which can be found at https://choosealicense.com/licenses/mit.
|
4
4
|
#
|
5
5
|
|
6
6
|
module Ballast
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# This file is part of the ballast gem. Copyright (C) 2013 and above Shogun <shogun@cowtech.it>.
|
3
|
-
# Licensed under the MIT license, which can be found at
|
3
|
+
# Licensed under the MIT license, which can be found at https://choosealicense.com/licenses/mit.
|
4
4
|
#
|
5
5
|
|
6
6
|
module Ballast
|
data/lib/ballast/emoji.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# This file is part of the ballast gem. Copyright (C) 2013 and above Shogun <shogun@cowtech.it>.
|
3
|
-
# Licensed under the MIT license, which can be found at
|
3
|
+
# Licensed under the MIT license, which can be found at https://choosealicense.com/licenses/mit.
|
4
4
|
#
|
5
5
|
|
6
6
|
module Ballast
|
data/lib/ballast/errors.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# This file is part of the ballast gem. Copyright (C) 2013 and above Shogun <shogun@cowtech.it>.
|
3
|
-
# Licensed under the MIT license, which can be found at
|
3
|
+
# Licensed under the MIT license, which can be found at https://choosealicense.com/licenses/mit.
|
4
4
|
#
|
5
5
|
|
6
6
|
module Ballast
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# This file is part of the ballast gem. Copyright (C) 2013 and above Shogun <shogun@cowtech.it>.
|
3
|
-
# Licensed under the MIT license, which can be found at
|
3
|
+
# Licensed under the MIT license, which can be found at https://choosealicense.com/licenses/mit.
|
4
4
|
#
|
5
5
|
|
6
6
|
module Ballast
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# This file is part of the ballast gem. Copyright (C) 2013 and above Shogun <shogun@cowtech.it>.
|
3
|
-
# Licensed under the MIT license, which can be found at
|
3
|
+
# Licensed under the MIT license, which can be found at https://choosealicense.com/licenses/mit.
|
4
4
|
#
|
5
5
|
|
6
6
|
module Ballast
|
data/lib/ballast/service.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# This file is part of the ballast gem. Copyright (C) 2013 and above Shogun <shogun@cowtech.it>.
|
3
|
-
# Licensed under the MIT license, which can be found at
|
3
|
+
# Licensed under the MIT license, which can be found at https://choosealicense.com/licenses/mit.
|
4
4
|
#
|
5
5
|
|
6
6
|
module Ballast
|
data/lib/ballast/version.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# This file is part of the ballast gem. Copyright (C) 2013 and above Shogun <shogun@cowtech.it>.
|
3
|
-
# Licensed under the MIT license, which can be found at
|
3
|
+
# Licensed under the MIT license, which can be found at https://choosealicense.com/licenses/mit.
|
4
4
|
#
|
5
5
|
|
6
6
|
# A collection of base utilities for web frameworks.
|
@@ -16,7 +16,7 @@ module Ballast
|
|
16
16
|
MINOR = 2
|
17
17
|
|
18
18
|
# The patch version.
|
19
|
-
PATCH =
|
19
|
+
PATCH = 5
|
20
20
|
|
21
21
|
# The current version of ballast.
|
22
22
|
STRING = [MAJOR, MINOR, PATCH].compact.join(".")
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# This file is part of the ballast gem. Copyright (C) 2013 and above Shogun <shogun@cowtech.it>.
|
3
|
-
# Licensed under the MIT license, which can be found at
|
3
|
+
# Licensed under the MIT license, which can be found at https://choosealicense.com/licenses/mit.
|
4
4
|
#
|
5
5
|
|
6
6
|
require "spec_helper"
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# This file is part of the ballast gem. Copyright (C) 2013 and above Shogun <shogun@cowtech.it>.
|
3
|
-
# Licensed under the MIT license, which can be found at
|
3
|
+
# Licensed under the MIT license, which can be found at https://choosealicense.com/licenses/mit.
|
4
4
|
#
|
5
5
|
|
6
6
|
require "spec_helper"
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# This file is part of the ballast gem. Copyright (C) 2013 and above Shogun <shogun@cowtech.it>.
|
3
|
-
# Licensed under the MIT license, which can be found at
|
3
|
+
# Licensed under the MIT license, which can be found at https://choosealicense.com/licenses/mit.
|
4
4
|
#
|
5
5
|
|
6
6
|
require "spec_helper"
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# This file is part of the ballast gem. Copyright (C) 2013 and above Shogun <shogun@cowtech.it>.
|
3
|
-
# Licensed under the MIT license, which can be found at
|
3
|
+
# Licensed under the MIT license, which can be found at https://choosealicense.com/licenses/mit.
|
4
4
|
#
|
5
5
|
|
6
6
|
require "spec_helper"
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# This file is part of the ballast gem. Copyright (C) 2013 and above Shogun <shogun@cowtech.it>.
|
3
|
-
# Licensed under the MIT license, which can be found at
|
3
|
+
# Licensed under the MIT license, which can be found at https://choosealicense.com/licenses/mit.
|
4
4
|
#
|
5
5
|
|
6
6
|
require "spec_helper"
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# This file is part of the ballast gem. Copyright (C) 2013 and above Shogun <shogun@cowtech.it>.
|
3
|
-
# Licensed under the MIT license, which can be found at
|
3
|
+
# Licensed under the MIT license, which can be found at https://choosealicense.com/licenses/mit.
|
4
4
|
#
|
5
5
|
|
6
6
|
require "spec_helper"
|
data/spec/ballast/errors_spec.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# This file is part of the ballast gem. Copyright (C) 2013 and above Shogun <shogun@cowtech.it>.
|
3
|
-
# Licensed under the MIT license, which can be found at
|
3
|
+
# Licensed under the MIT license, which can be found at https://choosealicense.com/licenses/mit.
|
4
4
|
#
|
5
5
|
|
6
6
|
require "spec_helper"
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# This file is part of the ballast gem. Copyright (C) 2013 and above Shogun <shogun@cowtech.it>.
|
3
|
-
# Licensed under the MIT license, which can be found at
|
3
|
+
# Licensed under the MIT license, which can be found at https://choosealicense.com/licenses/mit.
|
4
4
|
#
|
5
5
|
|
6
6
|
require "spec_helper"
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# This file is part of the ballast gem. Copyright (C) 2013 and above Shogun <shogun@cowtech.it>.
|
3
|
-
# Licensed under the MIT license, which can be found at
|
3
|
+
# Licensed under the MIT license, which can be found at https://choosealicense.com/licenses/mit.
|
4
4
|
#
|
5
5
|
|
6
6
|
require "spec_helper"
|
data/spec/ballast_spec.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# This file is part of the ballast gem. Copyright (C) 2013 and above Shogun <shogun@cowtech.it>.
|
3
|
-
# Licensed under the MIT license, which can be found at
|
3
|
+
# Licensed under the MIT license, which can be found at https://choosealicense.com/licenses/mit.
|
4
4
|
#
|
5
5
|
|
6
6
|
require "spec_helper"
|
data/spec/spec_helper.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# This file is part of the ballast gem. Copyright (C) 2013 and above Shogun <shogun@cowtech.it>.
|
3
|
-
# Licensed under the MIT license, which can be found at
|
3
|
+
# Licensed under the MIT license, which can be found at https://choosealicense.com/licenses/mit.
|
4
4
|
#
|
5
5
|
|
6
6
|
require "bundler/setup"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ballast
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shogun
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-06-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionpack
|
@@ -95,50 +95,58 @@ files:
|
|
95
95
|
- ".yardopts"
|
96
96
|
- CHANGELOG.md
|
97
97
|
- Gemfile
|
98
|
+
- LICENSE.md
|
98
99
|
- README.md
|
99
100
|
- Rakefile
|
100
101
|
- ballast.gemspec
|
101
|
-
-
|
102
|
-
-
|
103
|
-
-
|
104
|
-
-
|
105
|
-
-
|
106
|
-
-
|
107
|
-
-
|
108
|
-
-
|
109
|
-
-
|
110
|
-
-
|
111
|
-
-
|
112
|
-
-
|
113
|
-
-
|
114
|
-
-
|
115
|
-
-
|
116
|
-
-
|
117
|
-
-
|
118
|
-
-
|
119
|
-
-
|
120
|
-
-
|
121
|
-
-
|
122
|
-
-
|
123
|
-
-
|
124
|
-
-
|
125
|
-
-
|
126
|
-
-
|
127
|
-
-
|
128
|
-
-
|
129
|
-
-
|
130
|
-
-
|
131
|
-
-
|
132
|
-
-
|
133
|
-
-
|
134
|
-
-
|
135
|
-
-
|
136
|
-
-
|
102
|
+
- docs/Ballast.html
|
103
|
+
- docs/Ballast/AjaxResponse.html
|
104
|
+
- docs/Ballast/Concerns.html
|
105
|
+
- docs/Ballast/Concerns/AjaxHandling.html
|
106
|
+
- docs/Ballast/Concerns/Common.html
|
107
|
+
- docs/Ballast/Concerns/ErrorsHandling.html
|
108
|
+
- docs/Ballast/Concerns/JSONApi.html
|
109
|
+
- docs/Ballast/Concerns/JSONApi/PaginationHandling.html
|
110
|
+
- docs/Ballast/Concerns/JSONApi/RequestHandling.html
|
111
|
+
- docs/Ballast/Concerns/JSONApi/ResponseHandling.html
|
112
|
+
- docs/Ballast/Concerns/View.html
|
113
|
+
- docs/Ballast/Configuration.html
|
114
|
+
- docs/Ballast/Emoji.html
|
115
|
+
- docs/Ballast/Emoji/Character.html
|
116
|
+
- docs/Ballast/Emoji/Utils.html
|
117
|
+
- docs/Ballast/Errors.html
|
118
|
+
- docs/Ballast/Errors/Base.html
|
119
|
+
- docs/Ballast/Errors/Failure.html
|
120
|
+
- docs/Ballast/Errors/InvalidDomain.html
|
121
|
+
- docs/Ballast/Errors/ValidationFailure.html
|
122
|
+
- docs/Ballast/Middlewares.html
|
123
|
+
- docs/Ballast/Middlewares/DefaultHost.html
|
124
|
+
- docs/Ballast/RequestDomainMatcher.html
|
125
|
+
- docs/Ballast/Service.html
|
126
|
+
- docs/Ballast/Service/Response.html
|
127
|
+
- docs/Ballast/Version.html
|
128
|
+
- docs/_index.html
|
129
|
+
- docs/class_list.html
|
130
|
+
- docs/css/common.css
|
131
|
+
- docs/css/full_list.css
|
132
|
+
- docs/css/style.css
|
133
|
+
- docs/file.README.html
|
134
|
+
- docs/file_list.html
|
135
|
+
- docs/frames.html
|
136
|
+
- docs/index.html
|
137
|
+
- docs/js/app.js
|
138
|
+
- docs/js/full_list.js
|
139
|
+
- docs/js/jquery.js
|
140
|
+
- docs/method_list.html
|
141
|
+
- docs/top-level-namespace.html
|
137
142
|
- lib/ballast.rb
|
138
143
|
- lib/ballast/ajax_response.rb
|
139
144
|
- lib/ballast/concerns/ajax_handling.rb
|
140
145
|
- lib/ballast/concerns/common.rb
|
141
146
|
- lib/ballast/concerns/errors_handling.rb
|
147
|
+
- lib/ballast/concerns/json_api/pagination_handling.rb
|
148
|
+
- lib/ballast/concerns/json_api/request_handling.rb
|
149
|
+
- lib/ballast/concerns/json_api/response_handling.rb
|
142
150
|
- lib/ballast/concerns/view.rb
|
143
151
|
- lib/ballast/configuration.rb
|
144
152
|
- lib/ballast/emoji.rb
|
@@ -180,7 +188,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
180
188
|
version: '0'
|
181
189
|
requirements: []
|
182
190
|
rubyforge_project: ballast
|
183
|
-
rubygems_version: 2.
|
191
|
+
rubygems_version: 2.6.8
|
184
192
|
signing_key:
|
185
193
|
specification_version: 4
|
186
194
|
summary: A collection of base utilities for web frameworks.
|
@@ -1,1478 +0,0 @@
|
|
1
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
-
<head>
|
5
|
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
-
<title>
|
7
|
-
Class: Ballast::AjaxResponse
|
8
|
-
|
9
|
-
— Documentation by YARD 0.8.7.6
|
10
|
-
|
11
|
-
</title>
|
12
|
-
|
13
|
-
<link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />
|
14
|
-
|
15
|
-
<link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />
|
16
|
-
|
17
|
-
<script type="text/javascript" charset="utf-8">
|
18
|
-
hasFrames = window.top.frames.main ? true : false;
|
19
|
-
relpath = '../';
|
20
|
-
framesUrl = "../frames.html#!Ballast/AjaxResponse.html";
|
21
|
-
</script>
|
22
|
-
|
23
|
-
|
24
|
-
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
25
|
-
|
26
|
-
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
27
|
-
|
28
|
-
|
29
|
-
</head>
|
30
|
-
<body>
|
31
|
-
<div id="header">
|
32
|
-
<div id="menu">
|
33
|
-
|
34
|
-
<a href="../_index.html">Index (A)</a> »
|
35
|
-
<span class='title'><span class='object_link'><a href="../Ballast.html" title="Ballast (module)">Ballast</a></span></span>
|
36
|
-
»
|
37
|
-
<span class="title">AjaxResponse</span>
|
38
|
-
|
39
|
-
|
40
|
-
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
41
|
-
</div>
|
42
|
-
|
43
|
-
<div id="search">
|
44
|
-
|
45
|
-
<a class="full_list_link" id="class_list_link"
|
46
|
-
href="../class_list.html">
|
47
|
-
Class List
|
48
|
-
</a>
|
49
|
-
|
50
|
-
<a class="full_list_link" id="method_list_link"
|
51
|
-
href="../method_list.html">
|
52
|
-
Method List
|
53
|
-
</a>
|
54
|
-
|
55
|
-
<a class="full_list_link" id="file_list_link"
|
56
|
-
href="../file_list.html">
|
57
|
-
File List
|
58
|
-
</a>
|
59
|
-
|
60
|
-
</div>
|
61
|
-
<div class="clear"></div>
|
62
|
-
</div>
|
63
|
-
|
64
|
-
<iframe id="search_frame"></iframe>
|
65
|
-
|
66
|
-
<div id="content"><h1>Class: Ballast::AjaxResponse
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
</h1>
|
71
|
-
|
72
|
-
<dl class="box">
|
73
|
-
|
74
|
-
<dt class="r1">Inherits:</dt>
|
75
|
-
<dd class="r1">
|
76
|
-
<span class="inheritName">Object</span>
|
77
|
-
|
78
|
-
<ul class="fullTree">
|
79
|
-
<li>Object</li>
|
80
|
-
|
81
|
-
<li class="next">Ballast::AjaxResponse</li>
|
82
|
-
|
83
|
-
</ul>
|
84
|
-
<a href="#" class="inheritanceTree">show all</a>
|
85
|
-
|
86
|
-
</dd>
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
<dt class="r2 last">Defined in:</dt>
|
97
|
-
<dd class="r2 last">lib/ballast/ajax_response.rb</dd>
|
98
|
-
|
99
|
-
</dl>
|
100
|
-
<div class="clear"></div>
|
101
|
-
|
102
|
-
<h2>Overview</h2><div class="docstring">
|
103
|
-
<div class="discussion">
|
104
|
-
<p>An AJAX response.</p>
|
105
|
-
|
106
|
-
|
107
|
-
</div>
|
108
|
-
</div>
|
109
|
-
<div class="tags">
|
110
|
-
|
111
|
-
|
112
|
-
</div>
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
<h2>Instance Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
|
117
|
-
<ul class="summary">
|
118
|
-
|
119
|
-
<li class="public ">
|
120
|
-
<span class="summary_signature">
|
121
|
-
|
122
|
-
<a href="#data-instance_method" title="#data (instance method)">- (Object|Hash|NilClass) <strong>data</strong> </a>
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
</span>
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
<span class="summary_desc"><div class='inline'><p>The data to send to the client.</p>
|
140
|
-
</div></span>
|
141
|
-
|
142
|
-
</li>
|
143
|
-
|
144
|
-
|
145
|
-
<li class="public ">
|
146
|
-
<span class="summary_signature">
|
147
|
-
|
148
|
-
<a href="#error-instance_method" title="#error (instance method)">- (Object|NilClass) <strong>error</strong> </a>
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
</span>
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
<span class="summary_desc"><div class='inline'><p>A error message.</p>
|
166
|
-
</div></span>
|
167
|
-
|
168
|
-
</li>
|
169
|
-
|
170
|
-
|
171
|
-
<li class="public ">
|
172
|
-
<span class="summary_signature">
|
173
|
-
|
174
|
-
<a href="#status-instance_method" title="#status (instance method)">- (Symbol|Fixnum) <strong>status</strong> </a>
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
</span>
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
<span class="summary_desc"><div class='inline'><p>The HTTP status of the response.</p>
|
192
|
-
</div></span>
|
193
|
-
|
194
|
-
</li>
|
195
|
-
|
196
|
-
|
197
|
-
<li class="public ">
|
198
|
-
<span class="summary_signature">
|
199
|
-
|
200
|
-
<a href="#transport-instance_method" title="#transport (instance method)">- (Object|NilClass) <strong>transport</strong> </a>
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
</span>
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
<span class="summary_desc"><div class='inline'><p>The transport to use for sending.</p>
|
218
|
-
</div></span>
|
219
|
-
|
220
|
-
</li>
|
221
|
-
|
222
|
-
|
223
|
-
</ul>
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
<h2>
|
230
|
-
Instance Method Summary
|
231
|
-
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
232
|
-
</h2>
|
233
|
-
|
234
|
-
<ul class="summary">
|
235
|
-
|
236
|
-
<li class="public ">
|
237
|
-
<span class="summary_signature">
|
238
|
-
|
239
|
-
<a href="#as_json-instance_method" title="#as_json (instance method)">- (Hash) <strong>as_json</strong>(options = {}) </a>
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
</span>
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
<span class="summary_desc"><div class='inline'><p>Returns a JSON representation of the response.</p>
|
254
|
-
</div></span>
|
255
|
-
|
256
|
-
</li>
|
257
|
-
|
258
|
-
|
259
|
-
<li class="public ">
|
260
|
-
<span class="summary_signature">
|
261
|
-
|
262
|
-
<a href="#initialize-instance_method" title="#initialize (instance method)">- (AjaxResponse) <strong>initialize</strong>(status: :ok, data: {}, error: nil, transport: nil) </a>
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
</span>
|
267
|
-
|
268
|
-
|
269
|
-
<span class="note title constructor">constructor</span>
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
<span class="summary_desc"><div class='inline'><p>Creates an AJAX response.</p>
|
279
|
-
</div></span>
|
280
|
-
|
281
|
-
</li>
|
282
|
-
|
283
|
-
|
284
|
-
<li class="public ">
|
285
|
-
<span class="summary_signature">
|
286
|
-
|
287
|
-
<a href="#numeric_status-instance_method" title="#numeric_status (instance method)">- (Fixnum) <strong>numeric_status</strong> </a>
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
</span>
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
<span class="summary_desc"><div class='inline'><p>Returns the status as a number.</p>
|
302
|
-
</div></span>
|
303
|
-
|
304
|
-
</li>
|
305
|
-
|
306
|
-
|
307
|
-
<li class="public ">
|
308
|
-
<span class="summary_signature">
|
309
|
-
|
310
|
-
<a href="#reply-instance_method" title="#reply (instance method)">- (Object) <strong>reply</strong>(format: :json, pretty_json: false) </a>
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
</span>
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
<span class="summary_desc"><div class='inline'><p>Sends the response using the transport.</p>
|
325
|
-
</div></span>
|
326
|
-
|
327
|
-
</li>
|
328
|
-
|
329
|
-
|
330
|
-
</ul>
|
331
|
-
|
332
|
-
|
333
|
-
<div id="constructor_details" class="method_details_list">
|
334
|
-
<h2>Constructor Details</h2>
|
335
|
-
|
336
|
-
<div class="method_details first">
|
337
|
-
<h3 class="signature first" id="initialize-instance_method">
|
338
|
-
|
339
|
-
- (<tt><span class='object_link'><a href="" title="Ballast::AjaxResponse (class)">AjaxResponse</a></span></tt>) <strong>initialize</strong>(status: :ok, data: {}, error: nil, transport: nil)
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
</h3><div class="docstring">
|
346
|
-
<div class="discussion">
|
347
|
-
<p>Creates an AJAX response.</p>
|
348
|
-
|
349
|
-
|
350
|
-
</div>
|
351
|
-
</div>
|
352
|
-
<div class="tags">
|
353
|
-
<p class="tag_title">Parameters:</p>
|
354
|
-
<ul class="param">
|
355
|
-
|
356
|
-
<li>
|
357
|
-
|
358
|
-
<span class='name'>status</span>
|
359
|
-
|
360
|
-
|
361
|
-
<span class='type'>(<tt>Symbol|Fixnum</tt>)</span>
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
—
|
366
|
-
<div class='inline'><p>The HTTP status of the response.</p>
|
367
|
-
</div>
|
368
|
-
|
369
|
-
</li>
|
370
|
-
|
371
|
-
<li>
|
372
|
-
|
373
|
-
<span class='name'>data</span>
|
374
|
-
|
375
|
-
|
376
|
-
<span class='type'>(<tt>Object|Hash|NilClass</tt>)</span>
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
—
|
381
|
-
<div class='inline'><p>Additional data to append to the response.</p>
|
382
|
-
</div>
|
383
|
-
|
384
|
-
</li>
|
385
|
-
|
386
|
-
<li>
|
387
|
-
|
388
|
-
<span class='name'>error</span>
|
389
|
-
|
390
|
-
|
391
|
-
<span class='type'>(<tt>Object|NilClass</tt>)</span>
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
—
|
396
|
-
<div class='inline'><p>A error to append to the response.</p>
|
397
|
-
</div>
|
398
|
-
|
399
|
-
</li>
|
400
|
-
|
401
|
-
<li>
|
402
|
-
|
403
|
-
<span class='name'>transport</span>
|
404
|
-
|
405
|
-
|
406
|
-
<span class='type'>(<tt>Object|NilClass</tt>)</span>
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
—
|
411
|
-
<div class='inline'><p>The transport to use for sending. Must respond to <code>render</code>, <code>params</code>, <code>request.format</code> and <code>performed?</code>.</p>
|
412
|
-
</div>
|
413
|
-
|
414
|
-
</li>
|
415
|
-
|
416
|
-
</ul>
|
417
|
-
|
418
|
-
|
419
|
-
</div><table class="source_code">
|
420
|
-
<tr>
|
421
|
-
<td>
|
422
|
-
<pre class="lines">
|
423
|
-
|
424
|
-
|
425
|
-
26
|
426
|
-
27
|
427
|
-
28
|
428
|
-
29
|
429
|
-
30
|
430
|
-
31</pre>
|
431
|
-
</td>
|
432
|
-
<td>
|
433
|
-
<pre class="code"><span class="info file"># File 'lib/ballast/ajax_response.rb', line 26</span>
|
434
|
-
|
435
|
-
<span class='rubyid_def def kw'>def</span> <span class='rubyid_initialize identifier id'>initialize</span><span class='lparen token'>(</span><span class='label val'>status:</span> <span class='symbol val'>:ok</span><span class='comma token'>,</span> <span class='label val'>data:</span> <span class='lbrace token'>{</span><span class='rbrace token'>}</span><span class='comma token'>,</span> <span class='label val'>error:</span> <span class='rubyid_nil nil kw'>nil</span><span class='comma token'>,</span> <span class='label val'>transport:</span> <span class='rubyid_nil nil kw'>nil</span><span class='rparen token'>)</span>
|
436
|
-
<span class='rubyid_@status ivar id'>@status</span> <span class='assign token'>=</span> <span class='rubyid_status identifier id'>status</span>
|
437
|
-
<span class='rubyid_@data ivar id'>@data</span> <span class='assign token'>=</span> <span class='rubyid_data identifier id'>data</span>
|
438
|
-
<span class='rubyid_@error ivar id'>@error</span> <span class='assign token'>=</span> <span class='rubyid_error identifier id'>error</span>
|
439
|
-
<span class='rubyid_@transport ivar id'>@transport</span> <span class='assign token'>=</span> <span class='rubyid_transport identifier id'>transport</span>
|
440
|
-
<span class='rubyid_end end kw'>end</span>
|
441
|
-
</pre>
|
442
|
-
</td>
|
443
|
-
</tr>
|
444
|
-
</table>
|
445
|
-
</div>
|
446
|
-
|
447
|
-
</div>
|
448
|
-
|
449
|
-
<div id="instance_attr_details" class="attr_details">
|
450
|
-
<h2>Instance Attribute Details</h2>
|
451
|
-
|
452
|
-
|
453
|
-
<span id="data=-instance_method"></span>
|
454
|
-
<div class="method_details first">
|
455
|
-
<h3 class="signature first" id="data-instance_method">
|
456
|
-
|
457
|
-
- (<tt>Object|Hash|NilClass</tt>) <strong>data</strong>
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
</h3><div class="docstring">
|
464
|
-
<div class="discussion">
|
465
|
-
<p>Returns The data to send to the client.</p>
|
466
|
-
|
467
|
-
|
468
|
-
</div>
|
469
|
-
</div>
|
470
|
-
<div class="tags">
|
471
|
-
|
472
|
-
<p class="tag_title">Returns:</p>
|
473
|
-
<ul class="return">
|
474
|
-
|
475
|
-
<li>
|
476
|
-
|
477
|
-
|
478
|
-
<span class='type'>(<tt>Object|Hash|NilClass</tt>)</span>
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
—
|
483
|
-
<div class='inline'><p>The data to send to the client.</p>
|
484
|
-
</div>
|
485
|
-
|
486
|
-
</li>
|
487
|
-
|
488
|
-
</ul>
|
489
|
-
|
490
|
-
</div><table class="source_code">
|
491
|
-
<tr>
|
492
|
-
<td>
|
493
|
-
<pre class="lines">
|
494
|
-
|
495
|
-
|
496
|
-
17
|
497
|
-
18
|
498
|
-
19
|
499
|
-
20
|
500
|
-
21
|
501
|
-
22
|
502
|
-
23
|
503
|
-
24
|
504
|
-
25
|
505
|
-
26
|
506
|
-
27
|
507
|
-
28
|
508
|
-
29
|
509
|
-
30
|
510
|
-
31
|
511
|
-
32
|
512
|
-
33
|
513
|
-
34
|
514
|
-
35
|
515
|
-
36
|
516
|
-
37
|
517
|
-
38
|
518
|
-
39
|
519
|
-
40
|
520
|
-
41
|
521
|
-
42
|
522
|
-
43
|
523
|
-
44
|
524
|
-
45
|
525
|
-
46
|
526
|
-
47
|
527
|
-
48
|
528
|
-
49
|
529
|
-
50
|
530
|
-
51
|
531
|
-
52
|
532
|
-
53
|
533
|
-
54
|
534
|
-
55
|
535
|
-
56
|
536
|
-
57
|
537
|
-
58
|
538
|
-
59
|
539
|
-
60
|
540
|
-
61
|
541
|
-
62
|
542
|
-
63
|
543
|
-
64
|
544
|
-
65
|
545
|
-
66
|
546
|
-
67
|
547
|
-
68
|
548
|
-
69
|
549
|
-
70
|
550
|
-
71
|
551
|
-
72
|
552
|
-
73
|
553
|
-
74
|
554
|
-
75
|
555
|
-
76
|
556
|
-
77
|
557
|
-
78
|
558
|
-
79
|
559
|
-
80
|
560
|
-
81
|
561
|
-
82
|
562
|
-
83
|
563
|
-
84
|
564
|
-
85
|
565
|
-
86</pre>
|
566
|
-
</td>
|
567
|
-
<td>
|
568
|
-
<pre class="code"><span class="info file"># File 'lib/ballast/ajax_response.rb', line 17</span>
|
569
|
-
|
570
|
-
<span class='rubyid_class class kw'>class</span> <span class='rubyid_AjaxResponse constant id'>AjaxResponse</span>
|
571
|
-
<span class='rubyid_attr_accessor identifier id'>attr_accessor</span> <span class='symbol val'>:status</span><span class='comma token'>,</span> <span class='symbol val'>:data</span><span class='comma token'>,</span> <span class='symbol val'>:error</span><span class='comma token'>,</span> <span class='symbol val'>:transport</span>
|
572
|
-
|
573
|
-
<span class='comment val'># Creates an AJAX response.</span>
|
574
|
-
<span class='comment val'>#</span>
|
575
|
-
<span class='comment val'># @param status [Symbol|Fixnum] The HTTP status of the response.</span>
|
576
|
-
<span class='comment val'># @param data [Object|Hash|NilClass] Additional data to append to the response.</span>
|
577
|
-
<span class='comment val'># @param error [Object|NilClass] A error to append to the response.</span>
|
578
|
-
<span class='comment val'># @param transport [Object|NilClass] The transport to use for sending. Must respond to `render`, `params`, `request.format` and `performed?`.</span>
|
579
|
-
<span class='rubyid_def def kw'>def</span> <span class='rubyid_initialize identifier id'>initialize</span><span class='lparen token'>(</span><span class='label val'>status:</span> <span class='symbol val'>:ok</span><span class='comma token'>,</span> <span class='label val'>data:</span> <span class='lbrace token'>{</span><span class='rbrace token'>}</span><span class='comma token'>,</span> <span class='label val'>error:</span> <span class='rubyid_nil nil kw'>nil</span><span class='comma token'>,</span> <span class='label val'>transport:</span> <span class='rubyid_nil nil kw'>nil</span><span class='rparen token'>)</span>
|
580
|
-
<span class='rubyid_@status ivar id'>@status</span> <span class='assign token'>=</span> <span class='rubyid_status identifier id'>status</span>
|
581
|
-
<span class='rubyid_@data ivar id'>@data</span> <span class='assign token'>=</span> <span class='rubyid_data identifier id'>data</span>
|
582
|
-
<span class='rubyid_@error ivar id'>@error</span> <span class='assign token'>=</span> <span class='rubyid_error identifier id'>error</span>
|
583
|
-
<span class='rubyid_@transport ivar id'>@transport</span> <span class='assign token'>=</span> <span class='rubyid_transport identifier id'>transport</span>
|
584
|
-
<span class='rubyid_end end kw'>end</span>
|
585
|
-
|
586
|
-
<span class='comment val'># Returns the status as a number.</span>
|
587
|
-
<span class='comment val'>#</span>
|
588
|
-
<span class='comment val'># @return [Fixnum] The status as a number.</span>
|
589
|
-
<span class='rubyid_def def kw'>def</span> <span class='rubyid_numeric_status identifier id'>numeric_status</span>
|
590
|
-
<span class='rubyid_status identifier id'>status</span><span class='dot token'>.</span><span class='rubyid_is_a? fid id'>is_a?</span><span class='lparen token'>(</span><span class='rubyid_Fixnum constant id'>Fixnum</span><span class='rparen token'>)</span> <span class='question op'>?</span> <span class='rubyid_status identifier id'>status</span> <span class='colon op'>:</span> <span class='rubyid_Rack constant id'>Rack</span><span class='colon2 op'>::</span><span class='rubyid_Utils constant id'>Utils</span><span class='dot token'>.</span><span class='rubyid_status_code identifier id'>status_code</span><span class='lparen token'>(</span><span class='rubyid_status identifier id'>status</span><span class='dot token'>.</span><span class='rubyid_ensure_string identifier id'>ensure_string</span><span class='dot token'>.</span><span class='rubyid_to_sym identifier id'>to_sym</span><span class='rparen token'>)</span>
|
591
|
-
<span class='rubyid_end end kw'>end</span>
|
592
|
-
|
593
|
-
<span class='comment val'># Returns a JSON representation of the response.</span>
|
594
|
-
<span class='comment val'>#</span>
|
595
|
-
<span class='comment val'># @param options [Hash] The options to use for serializing. Currently only `original_status` is supported.</span>
|
596
|
-
<span class='comment val'># @return [Hash] A JSON representation of the response.</span>
|
597
|
-
<span class='rubyid_def def kw'>def</span> <span class='rubyid_as_json identifier id'>as_json</span><span class='lparen token'>(</span><span class='rubyid_options identifier id'>options</span> <span class='assign token'>=</span> <span class='lbrace token'>{</span><span class='rbrace token'>}</span><span class='rparen token'>)</span>
|
598
|
-
<span class='lbrace token'>{</span>
|
599
|
-
<span class='label val'>status:</span> <span class='rubyid_options identifier id'>options</span><span class='lbrack token'>[</span><span class='symbol val'>:original_status</span><span class='rbrack token'>]</span> <span class='question op'>?</span> <span class='rubyid_status identifier id'>status</span> <span class='colon op'>:</span> <span class='rubyid_numeric_status identifier id'>numeric_status</span><span class='comma token'>,</span>
|
600
|
-
<span class='label val'>data:</span> <span class='rubyid_data identifier id'>data</span><span class='comma token'>,</span>
|
601
|
-
<span class='label val'>error:</span> <span class='rubyid_error identifier id'>error</span>
|
602
|
-
<span class='rbrace token'>}</span>
|
603
|
-
<span class='rubyid_end end kw'>end</span>
|
604
|
-
|
605
|
-
<span class='comment val'># Sends the response using the transport.</span>
|
606
|
-
<span class='comment val'>#</span>
|
607
|
-
<span class='comment val'># @param format [Symbol] The content type of the response.</span>
|
608
|
-
<span class='comment val'># @param pretty_json [Boolean] If JSON response must be pretty formatted.</span>
|
609
|
-
<span class='rubyid_def def kw'>def</span> <span class='rubyid_reply identifier id'>reply</span><span class='lparen token'>(</span><span class='label val'>format:</span> <span class='symbol val'>:json</span><span class='comma token'>,</span> <span class='label val'>pretty_json:</span> <span class='rubyid_false false kw'>false</span><span class='rparen token'>)</span>
|
610
|
-
<span class='rubyid_return return kw'>return</span> <span class='rubyid_if if_mod kw'>if</span> <span class='rubyid_transport identifier id'>transport</span><span class='dot token'>.</span><span class='rubyid_performed? fid id'>performed?</span>
|
611
|
-
|
612
|
-
<span class='rubyid_format identifier id'>format</span><span class='comma token'>,</span> <span class='rubyid_callback identifier id'>callback</span><span class='comma token'>,</span> <span class='rubyid_content_type identifier id'>content_type</span> <span class='assign token'>=</span> <span class='rubyid_format_reply identifier id'>format_reply</span><span class='lparen token'>(</span><span class='rubyid_format identifier id'>format</span><span class='rparen token'>)</span>
|
613
|
-
<span class='rubyid_content identifier id'>content</span> <span class='assign token'>=</span> <span class='rubyid_prepare_content identifier id'>prepare_content</span>
|
614
|
-
<span class='rubyid_content identifier id'>content</span> <span class='assign token'>=</span> <span class='lparen token'>(</span><span class='rubyid_pretty_json identifier id'>pretty_json</span> <span class='integer val'>? </span><span class='rubyid_Oj constant id'>Oj</span><span class='dot token'>.</span><span class='rubyid_dump identifier id'>dump</span><span class='lparen token'>(</span><span class='rubyid_content identifier id'>content</span><span class='rparen token'>)</span> <span class='colon op'>:</span> <span class='rubyid_ActiveSupport constant id'>ActiveSupport</span><span class='colon2 op'>::</span><span class='rubyid_JSON constant id'>JSON</span><span class='dot token'>.</span><span class='rubyid_encode identifier id'>encode</span><span class='lparen token'>(</span><span class='rubyid_content identifier id'>content</span><span class='rparen token'>)</span><span class='rparen token'>)</span> <span class='rubyid_if if_mod kw'>if</span> <span class='lbrack token'>[</span><span class='symbol val'>:json</span><span class='comma token'>,</span> <span class='symbol val'>:jsonp</span><span class='comma token'>,</span> <span class='symbol val'>:text</span><span class='rbrack token'>]</span><span class='dot token'>.</span><span class='rubyid_include? fid id'>include?</span><span class='lparen token'>(</span><span class='rubyid_format identifier id'>format</span><span class='rparen token'>)</span>
|
615
|
-
|
616
|
-
<span class='rubyid_transport identifier id'>transport</span><span class='dot token'>.</span><span class='rubyid_render identifier id'>render</span><span class='lparen token'>(</span><span class='rubyid_format identifier id'>format</span> <span class='assign token'>=</span><span class='gt op'>></span> <span class='rubyid_content identifier id'>content</span><span class='comma token'>,</span> <span class='label val'>status:</span> <span class='rubyid_numeric_status identifier id'>numeric_status</span><span class='comma token'>,</span> <span class='label val'>callback:</span> <span class='rubyid_callback identifier id'>callback</span><span class='comma token'>,</span> <span class='label val'>content_type:</span> <span class='rubyid_content_type identifier id'>content_type</span><span class='rparen token'>)</span>
|
617
|
-
<span class='rubyid_end end kw'>end</span>
|
618
|
-
|
619
|
-
<span class='rubyid_private identifier id'>private</span>
|
620
|
-
|
621
|
-
<span class='comment val'># :nodoc:</span>
|
622
|
-
<span class='rubyid_def def kw'>def</span> <span class='rubyid_format_reply identifier id'>format_reply</span><span class='lparen token'>(</span><span class='rubyid_format identifier id'>format</span><span class='rparen token'>)</span>
|
623
|
-
<span class='rubyid_format identifier id'>format</span> <span class='assign token'>=</span> <span class='rubyid_choose_format identifier id'>choose_format</span><span class='lparen token'>(</span><span class='rubyid_format identifier id'>format</span><span class='rparen token'>)</span>
|
624
|
-
<span class='rubyid_callback identifier id'>callback</span> <span class='assign token'>=</span> <span class='lbrack token'>[</span><span class='symbol val'>:jsonp</span><span class='comma token'>,</span> <span class='symbol val'>:pretty_jsonp</span><span class='rbrack token'>]</span><span class='dot token'>.</span><span class='rubyid_include? fid id'>include?</span><span class='lparen token'>(</span><span class='rubyid_format identifier id'>format</span><span class='rparen token'>)</span> <span class='question op'>?</span> <span class='lparen token'>(</span><span class='rubyid_transport identifier id'>transport</span><span class='dot token'>.</span><span class='rubyid_params identifier id'>params</span><span class='lbrack token'>[</span><span class='symbol val'>:callback</span><span class='rbrack token'>]</span> <span class='orop op'>||</span> <span class='dstring node'>"jsonp#{Time.now.to_i}"</span><span class='rparen token'>)</span> <span class='colon op'>:</span> <span class='rubyid_nil nil kw'>nil</span>
|
625
|
-
<span class='rubyid_content_type identifier id'>content_type</span> <span class='assign token'>=</span> <span class='lparen token'>(</span><span class='rubyid_format identifier id'>format</span> <span class='eq op'>==</span> <span class='symbol val'>:text</span><span class='rparen token'>)</span> <span class='question op'>?</span> <span class='string val'>"text/plain"</span> <span class='colon op'>:</span> <span class='rubyid_nil nil kw'>nil</span>
|
626
|
-
|
627
|
-
<span class='lbrack token'>[</span><span class='rubyid_format identifier id'>format</span><span class='comma token'>,</span> <span class='rubyid_callback identifier id'>callback</span><span class='comma token'>,</span> <span class='rubyid_content_type identifier id'>content_type</span><span class='rbrack token'>]</span>
|
628
|
-
<span class='rubyid_end end kw'>end</span>
|
629
|
-
|
630
|
-
<span class='comment val'># :nodoc:</span>
|
631
|
-
<span class='rubyid_def def kw'>def</span> <span class='rubyid_choose_format identifier id'>choose_format</span><span class='lparen token'>(</span><span class='rubyid_format identifier id'>format</span><span class='rparen token'>)</span>
|
632
|
-
<span class='lparen token'>(</span><span class='rubyid_format identifier id'>format</span> <span class='orop op'>||</span> <span class='rubyid_transport identifier id'>transport</span><span class='dot token'>.</span><span class='rubyid_params identifier id'>params</span><span class='lbrack token'>[</span><span class='symbol val'>:format</span><span class='rbrack token'>]</span> <span class='orop op'>||</span> <span class='rubyid_transport identifier id'>transport</span><span class='dot token'>.</span><span class='rubyid_request identifier id'>request</span><span class='dot token'>.</span><span class='rubyid_format identifier id'>format</span> <span class='orop op'>||</span> <span class='string val'>"json"</span><span class='rparen token'>)</span><span class='dot token'>.</span><span class='rubyid_to_sym identifier id'>to_sym</span> <span class='orop op'>||</span> <span class='symbol val'>:html</span>
|
633
|
-
<span class='rubyid_end end kw'>end</span>
|
634
|
-
|
635
|
-
<span class='comment val'># :nodoc:</span>
|
636
|
-
<span class='rubyid_def def kw'>def</span> <span class='rubyid_prepare_content identifier id'>prepare_content</span>
|
637
|
-
<span class='lbrace token'>{</span><span class='label val'>status:</span> <span class='rubyid_Rack constant id'>Rack</span><span class='colon2 op'>::</span><span class='rubyid_Utils constant id'>Utils</span><span class='dot token'>.</span><span class='rubyid_status_code identifier id'>status_code</span><span class='lparen token'>(</span><span class='rubyid_status identifier id'>status</span><span class='rparen token'>)</span><span class='comma token'>,</span> <span class='label val'>data:</span> <span class='rubyid_data identifier id'>data</span><span class='comma token'>,</span> <span class='label val'>error:</span> <span class='rubyid_error identifier id'>error</span><span class='rbrace token'>}</span>
|
638
|
-
<span class='rubyid_end end kw'>end</span>
|
639
|
-
<span class='rubyid_end end kw'>end</span>
|
640
|
-
</pre>
|
641
|
-
</td>
|
642
|
-
</tr>
|
643
|
-
</table>
|
644
|
-
</div>
|
645
|
-
|
646
|
-
|
647
|
-
<span id="error=-instance_method"></span>
|
648
|
-
<div class="method_details ">
|
649
|
-
<h3 class="signature " id="error-instance_method">
|
650
|
-
|
651
|
-
- (<tt>Object|NilClass</tt>) <strong>error</strong>
|
652
|
-
|
653
|
-
|
654
|
-
|
655
|
-
|
656
|
-
|
657
|
-
</h3><div class="docstring">
|
658
|
-
<div class="discussion">
|
659
|
-
<p>Returns A error message.</p>
|
660
|
-
|
661
|
-
|
662
|
-
</div>
|
663
|
-
</div>
|
664
|
-
<div class="tags">
|
665
|
-
|
666
|
-
<p class="tag_title">Returns:</p>
|
667
|
-
<ul class="return">
|
668
|
-
|
669
|
-
<li>
|
670
|
-
|
671
|
-
|
672
|
-
<span class='type'>(<tt>Object|NilClass</tt>)</span>
|
673
|
-
|
674
|
-
|
675
|
-
|
676
|
-
—
|
677
|
-
<div class='inline'><p>A error message.</p>
|
678
|
-
</div>
|
679
|
-
|
680
|
-
</li>
|
681
|
-
|
682
|
-
</ul>
|
683
|
-
|
684
|
-
</div><table class="source_code">
|
685
|
-
<tr>
|
686
|
-
<td>
|
687
|
-
<pre class="lines">
|
688
|
-
|
689
|
-
|
690
|
-
17
|
691
|
-
18
|
692
|
-
19
|
693
|
-
20
|
694
|
-
21
|
695
|
-
22
|
696
|
-
23
|
697
|
-
24
|
698
|
-
25
|
699
|
-
26
|
700
|
-
27
|
701
|
-
28
|
702
|
-
29
|
703
|
-
30
|
704
|
-
31
|
705
|
-
32
|
706
|
-
33
|
707
|
-
34
|
708
|
-
35
|
709
|
-
36
|
710
|
-
37
|
711
|
-
38
|
712
|
-
39
|
713
|
-
40
|
714
|
-
41
|
715
|
-
42
|
716
|
-
43
|
717
|
-
44
|
718
|
-
45
|
719
|
-
46
|
720
|
-
47
|
721
|
-
48
|
722
|
-
49
|
723
|
-
50
|
724
|
-
51
|
725
|
-
52
|
726
|
-
53
|
727
|
-
54
|
728
|
-
55
|
729
|
-
56
|
730
|
-
57
|
731
|
-
58
|
732
|
-
59
|
733
|
-
60
|
734
|
-
61
|
735
|
-
62
|
736
|
-
63
|
737
|
-
64
|
738
|
-
65
|
739
|
-
66
|
740
|
-
67
|
741
|
-
68
|
742
|
-
69
|
743
|
-
70
|
744
|
-
71
|
745
|
-
72
|
746
|
-
73
|
747
|
-
74
|
748
|
-
75
|
749
|
-
76
|
750
|
-
77
|
751
|
-
78
|
752
|
-
79
|
753
|
-
80
|
754
|
-
81
|
755
|
-
82
|
756
|
-
83
|
757
|
-
84
|
758
|
-
85
|
759
|
-
86</pre>
|
760
|
-
</td>
|
761
|
-
<td>
|
762
|
-
<pre class="code"><span class="info file"># File 'lib/ballast/ajax_response.rb', line 17</span>
|
763
|
-
|
764
|
-
<span class='rubyid_class class kw'>class</span> <span class='rubyid_AjaxResponse constant id'>AjaxResponse</span>
|
765
|
-
<span class='rubyid_attr_accessor identifier id'>attr_accessor</span> <span class='symbol val'>:status</span><span class='comma token'>,</span> <span class='symbol val'>:data</span><span class='comma token'>,</span> <span class='symbol val'>:error</span><span class='comma token'>,</span> <span class='symbol val'>:transport</span>
|
766
|
-
|
767
|
-
<span class='comment val'># Creates an AJAX response.</span>
|
768
|
-
<span class='comment val'>#</span>
|
769
|
-
<span class='comment val'># @param status [Symbol|Fixnum] The HTTP status of the response.</span>
|
770
|
-
<span class='comment val'># @param data [Object|Hash|NilClass] Additional data to append to the response.</span>
|
771
|
-
<span class='comment val'># @param error [Object|NilClass] A error to append to the response.</span>
|
772
|
-
<span class='comment val'># @param transport [Object|NilClass] The transport to use for sending. Must respond to `render`, `params`, `request.format` and `performed?`.</span>
|
773
|
-
<span class='rubyid_def def kw'>def</span> <span class='rubyid_initialize identifier id'>initialize</span><span class='lparen token'>(</span><span class='label val'>status:</span> <span class='symbol val'>:ok</span><span class='comma token'>,</span> <span class='label val'>data:</span> <span class='lbrace token'>{</span><span class='rbrace token'>}</span><span class='comma token'>,</span> <span class='label val'>error:</span> <span class='rubyid_nil nil kw'>nil</span><span class='comma token'>,</span> <span class='label val'>transport:</span> <span class='rubyid_nil nil kw'>nil</span><span class='rparen token'>)</span>
|
774
|
-
<span class='rubyid_@status ivar id'>@status</span> <span class='assign token'>=</span> <span class='rubyid_status identifier id'>status</span>
|
775
|
-
<span class='rubyid_@data ivar id'>@data</span> <span class='assign token'>=</span> <span class='rubyid_data identifier id'>data</span>
|
776
|
-
<span class='rubyid_@error ivar id'>@error</span> <span class='assign token'>=</span> <span class='rubyid_error identifier id'>error</span>
|
777
|
-
<span class='rubyid_@transport ivar id'>@transport</span> <span class='assign token'>=</span> <span class='rubyid_transport identifier id'>transport</span>
|
778
|
-
<span class='rubyid_end end kw'>end</span>
|
779
|
-
|
780
|
-
<span class='comment val'># Returns the status as a number.</span>
|
781
|
-
<span class='comment val'>#</span>
|
782
|
-
<span class='comment val'># @return [Fixnum] The status as a number.</span>
|
783
|
-
<span class='rubyid_def def kw'>def</span> <span class='rubyid_numeric_status identifier id'>numeric_status</span>
|
784
|
-
<span class='rubyid_status identifier id'>status</span><span class='dot token'>.</span><span class='rubyid_is_a? fid id'>is_a?</span><span class='lparen token'>(</span><span class='rubyid_Fixnum constant id'>Fixnum</span><span class='rparen token'>)</span> <span class='question op'>?</span> <span class='rubyid_status identifier id'>status</span> <span class='colon op'>:</span> <span class='rubyid_Rack constant id'>Rack</span><span class='colon2 op'>::</span><span class='rubyid_Utils constant id'>Utils</span><span class='dot token'>.</span><span class='rubyid_status_code identifier id'>status_code</span><span class='lparen token'>(</span><span class='rubyid_status identifier id'>status</span><span class='dot token'>.</span><span class='rubyid_ensure_string identifier id'>ensure_string</span><span class='dot token'>.</span><span class='rubyid_to_sym identifier id'>to_sym</span><span class='rparen token'>)</span>
|
785
|
-
<span class='rubyid_end end kw'>end</span>
|
786
|
-
|
787
|
-
<span class='comment val'># Returns a JSON representation of the response.</span>
|
788
|
-
<span class='comment val'>#</span>
|
789
|
-
<span class='comment val'># @param options [Hash] The options to use for serializing. Currently only `original_status` is supported.</span>
|
790
|
-
<span class='comment val'># @return [Hash] A JSON representation of the response.</span>
|
791
|
-
<span class='rubyid_def def kw'>def</span> <span class='rubyid_as_json identifier id'>as_json</span><span class='lparen token'>(</span><span class='rubyid_options identifier id'>options</span> <span class='assign token'>=</span> <span class='lbrace token'>{</span><span class='rbrace token'>}</span><span class='rparen token'>)</span>
|
792
|
-
<span class='lbrace token'>{</span>
|
793
|
-
<span class='label val'>status:</span> <span class='rubyid_options identifier id'>options</span><span class='lbrack token'>[</span><span class='symbol val'>:original_status</span><span class='rbrack token'>]</span> <span class='question op'>?</span> <span class='rubyid_status identifier id'>status</span> <span class='colon op'>:</span> <span class='rubyid_numeric_status identifier id'>numeric_status</span><span class='comma token'>,</span>
|
794
|
-
<span class='label val'>data:</span> <span class='rubyid_data identifier id'>data</span><span class='comma token'>,</span>
|
795
|
-
<span class='label val'>error:</span> <span class='rubyid_error identifier id'>error</span>
|
796
|
-
<span class='rbrace token'>}</span>
|
797
|
-
<span class='rubyid_end end kw'>end</span>
|
798
|
-
|
799
|
-
<span class='comment val'># Sends the response using the transport.</span>
|
800
|
-
<span class='comment val'>#</span>
|
801
|
-
<span class='comment val'># @param format [Symbol] The content type of the response.</span>
|
802
|
-
<span class='comment val'># @param pretty_json [Boolean] If JSON response must be pretty formatted.</span>
|
803
|
-
<span class='rubyid_def def kw'>def</span> <span class='rubyid_reply identifier id'>reply</span><span class='lparen token'>(</span><span class='label val'>format:</span> <span class='symbol val'>:json</span><span class='comma token'>,</span> <span class='label val'>pretty_json:</span> <span class='rubyid_false false kw'>false</span><span class='rparen token'>)</span>
|
804
|
-
<span class='rubyid_return return kw'>return</span> <span class='rubyid_if if_mod kw'>if</span> <span class='rubyid_transport identifier id'>transport</span><span class='dot token'>.</span><span class='rubyid_performed? fid id'>performed?</span>
|
805
|
-
|
806
|
-
<span class='rubyid_format identifier id'>format</span><span class='comma token'>,</span> <span class='rubyid_callback identifier id'>callback</span><span class='comma token'>,</span> <span class='rubyid_content_type identifier id'>content_type</span> <span class='assign token'>=</span> <span class='rubyid_format_reply identifier id'>format_reply</span><span class='lparen token'>(</span><span class='rubyid_format identifier id'>format</span><span class='rparen token'>)</span>
|
807
|
-
<span class='rubyid_content identifier id'>content</span> <span class='assign token'>=</span> <span class='rubyid_prepare_content identifier id'>prepare_content</span>
|
808
|
-
<span class='rubyid_content identifier id'>content</span> <span class='assign token'>=</span> <span class='lparen token'>(</span><span class='rubyid_pretty_json identifier id'>pretty_json</span> <span class='integer val'>? </span><span class='rubyid_Oj constant id'>Oj</span><span class='dot token'>.</span><span class='rubyid_dump identifier id'>dump</span><span class='lparen token'>(</span><span class='rubyid_content identifier id'>content</span><span class='rparen token'>)</span> <span class='colon op'>:</span> <span class='rubyid_ActiveSupport constant id'>ActiveSupport</span><span class='colon2 op'>::</span><span class='rubyid_JSON constant id'>JSON</span><span class='dot token'>.</span><span class='rubyid_encode identifier id'>encode</span><span class='lparen token'>(</span><span class='rubyid_content identifier id'>content</span><span class='rparen token'>)</span><span class='rparen token'>)</span> <span class='rubyid_if if_mod kw'>if</span> <span class='lbrack token'>[</span><span class='symbol val'>:json</span><span class='comma token'>,</span> <span class='symbol val'>:jsonp</span><span class='comma token'>,</span> <span class='symbol val'>:text</span><span class='rbrack token'>]</span><span class='dot token'>.</span><span class='rubyid_include? fid id'>include?</span><span class='lparen token'>(</span><span class='rubyid_format identifier id'>format</span><span class='rparen token'>)</span>
|
809
|
-
|
810
|
-
<span class='rubyid_transport identifier id'>transport</span><span class='dot token'>.</span><span class='rubyid_render identifier id'>render</span><span class='lparen token'>(</span><span class='rubyid_format identifier id'>format</span> <span class='assign token'>=</span><span class='gt op'>></span> <span class='rubyid_content identifier id'>content</span><span class='comma token'>,</span> <span class='label val'>status:</span> <span class='rubyid_numeric_status identifier id'>numeric_status</span><span class='comma token'>,</span> <span class='label val'>callback:</span> <span class='rubyid_callback identifier id'>callback</span><span class='comma token'>,</span> <span class='label val'>content_type:</span> <span class='rubyid_content_type identifier id'>content_type</span><span class='rparen token'>)</span>
|
811
|
-
<span class='rubyid_end end kw'>end</span>
|
812
|
-
|
813
|
-
<span class='rubyid_private identifier id'>private</span>
|
814
|
-
|
815
|
-
<span class='comment val'># :nodoc:</span>
|
816
|
-
<span class='rubyid_def def kw'>def</span> <span class='rubyid_format_reply identifier id'>format_reply</span><span class='lparen token'>(</span><span class='rubyid_format identifier id'>format</span><span class='rparen token'>)</span>
|
817
|
-
<span class='rubyid_format identifier id'>format</span> <span class='assign token'>=</span> <span class='rubyid_choose_format identifier id'>choose_format</span><span class='lparen token'>(</span><span class='rubyid_format identifier id'>format</span><span class='rparen token'>)</span>
|
818
|
-
<span class='rubyid_callback identifier id'>callback</span> <span class='assign token'>=</span> <span class='lbrack token'>[</span><span class='symbol val'>:jsonp</span><span class='comma token'>,</span> <span class='symbol val'>:pretty_jsonp</span><span class='rbrack token'>]</span><span class='dot token'>.</span><span class='rubyid_include? fid id'>include?</span><span class='lparen token'>(</span><span class='rubyid_format identifier id'>format</span><span class='rparen token'>)</span> <span class='question op'>?</span> <span class='lparen token'>(</span><span class='rubyid_transport identifier id'>transport</span><span class='dot token'>.</span><span class='rubyid_params identifier id'>params</span><span class='lbrack token'>[</span><span class='symbol val'>:callback</span><span class='rbrack token'>]</span> <span class='orop op'>||</span> <span class='dstring node'>"jsonp#{Time.now.to_i}"</span><span class='rparen token'>)</span> <span class='colon op'>:</span> <span class='rubyid_nil nil kw'>nil</span>
|
819
|
-
<span class='rubyid_content_type identifier id'>content_type</span> <span class='assign token'>=</span> <span class='lparen token'>(</span><span class='rubyid_format identifier id'>format</span> <span class='eq op'>==</span> <span class='symbol val'>:text</span><span class='rparen token'>)</span> <span class='question op'>?</span> <span class='string val'>"text/plain"</span> <span class='colon op'>:</span> <span class='rubyid_nil nil kw'>nil</span>
|
820
|
-
|
821
|
-
<span class='lbrack token'>[</span><span class='rubyid_format identifier id'>format</span><span class='comma token'>,</span> <span class='rubyid_callback identifier id'>callback</span><span class='comma token'>,</span> <span class='rubyid_content_type identifier id'>content_type</span><span class='rbrack token'>]</span>
|
822
|
-
<span class='rubyid_end end kw'>end</span>
|
823
|
-
|
824
|
-
<span class='comment val'># :nodoc:</span>
|
825
|
-
<span class='rubyid_def def kw'>def</span> <span class='rubyid_choose_format identifier id'>choose_format</span><span class='lparen token'>(</span><span class='rubyid_format identifier id'>format</span><span class='rparen token'>)</span>
|
826
|
-
<span class='lparen token'>(</span><span class='rubyid_format identifier id'>format</span> <span class='orop op'>||</span> <span class='rubyid_transport identifier id'>transport</span><span class='dot token'>.</span><span class='rubyid_params identifier id'>params</span><span class='lbrack token'>[</span><span class='symbol val'>:format</span><span class='rbrack token'>]</span> <span class='orop op'>||</span> <span class='rubyid_transport identifier id'>transport</span><span class='dot token'>.</span><span class='rubyid_request identifier id'>request</span><span class='dot token'>.</span><span class='rubyid_format identifier id'>format</span> <span class='orop op'>||</span> <span class='string val'>"json"</span><span class='rparen token'>)</span><span class='dot token'>.</span><span class='rubyid_to_sym identifier id'>to_sym</span> <span class='orop op'>||</span> <span class='symbol val'>:html</span>
|
827
|
-
<span class='rubyid_end end kw'>end</span>
|
828
|
-
|
829
|
-
<span class='comment val'># :nodoc:</span>
|
830
|
-
<span class='rubyid_def def kw'>def</span> <span class='rubyid_prepare_content identifier id'>prepare_content</span>
|
831
|
-
<span class='lbrace token'>{</span><span class='label val'>status:</span> <span class='rubyid_Rack constant id'>Rack</span><span class='colon2 op'>::</span><span class='rubyid_Utils constant id'>Utils</span><span class='dot token'>.</span><span class='rubyid_status_code identifier id'>status_code</span><span class='lparen token'>(</span><span class='rubyid_status identifier id'>status</span><span class='rparen token'>)</span><span class='comma token'>,</span> <span class='label val'>data:</span> <span class='rubyid_data identifier id'>data</span><span class='comma token'>,</span> <span class='label val'>error:</span> <span class='rubyid_error identifier id'>error</span><span class='rbrace token'>}</span>
|
832
|
-
<span class='rubyid_end end kw'>end</span>
|
833
|
-
<span class='rubyid_end end kw'>end</span>
|
834
|
-
</pre>
|
835
|
-
</td>
|
836
|
-
</tr>
|
837
|
-
</table>
|
838
|
-
</div>
|
839
|
-
|
840
|
-
|
841
|
-
<span id="status=-instance_method"></span>
|
842
|
-
<div class="method_details ">
|
843
|
-
<h3 class="signature " id="status-instance_method">
|
844
|
-
|
845
|
-
- (<tt>Symbol|Fixnum</tt>) <strong>status</strong>
|
846
|
-
|
847
|
-
|
848
|
-
|
849
|
-
|
850
|
-
|
851
|
-
</h3><div class="docstring">
|
852
|
-
<div class="discussion">
|
853
|
-
<p>Returns The HTTP status of the response.</p>
|
854
|
-
|
855
|
-
|
856
|
-
</div>
|
857
|
-
</div>
|
858
|
-
<div class="tags">
|
859
|
-
|
860
|
-
<p class="tag_title">Returns:</p>
|
861
|
-
<ul class="return">
|
862
|
-
|
863
|
-
<li>
|
864
|
-
|
865
|
-
|
866
|
-
<span class='type'>(<tt>Symbol|Fixnum</tt>)</span>
|
867
|
-
|
868
|
-
|
869
|
-
|
870
|
-
—
|
871
|
-
<div class='inline'><p>The HTTP status of the response.</p>
|
872
|
-
</div>
|
873
|
-
|
874
|
-
</li>
|
875
|
-
|
876
|
-
</ul>
|
877
|
-
|
878
|
-
</div><table class="source_code">
|
879
|
-
<tr>
|
880
|
-
<td>
|
881
|
-
<pre class="lines">
|
882
|
-
|
883
|
-
|
884
|
-
17
|
885
|
-
18
|
886
|
-
19
|
887
|
-
20
|
888
|
-
21
|
889
|
-
22
|
890
|
-
23
|
891
|
-
24
|
892
|
-
25
|
893
|
-
26
|
894
|
-
27
|
895
|
-
28
|
896
|
-
29
|
897
|
-
30
|
898
|
-
31
|
899
|
-
32
|
900
|
-
33
|
901
|
-
34
|
902
|
-
35
|
903
|
-
36
|
904
|
-
37
|
905
|
-
38
|
906
|
-
39
|
907
|
-
40
|
908
|
-
41
|
909
|
-
42
|
910
|
-
43
|
911
|
-
44
|
912
|
-
45
|
913
|
-
46
|
914
|
-
47
|
915
|
-
48
|
916
|
-
49
|
917
|
-
50
|
918
|
-
51
|
919
|
-
52
|
920
|
-
53
|
921
|
-
54
|
922
|
-
55
|
923
|
-
56
|
924
|
-
57
|
925
|
-
58
|
926
|
-
59
|
927
|
-
60
|
928
|
-
61
|
929
|
-
62
|
930
|
-
63
|
931
|
-
64
|
932
|
-
65
|
933
|
-
66
|
934
|
-
67
|
935
|
-
68
|
936
|
-
69
|
937
|
-
70
|
938
|
-
71
|
939
|
-
72
|
940
|
-
73
|
941
|
-
74
|
942
|
-
75
|
943
|
-
76
|
944
|
-
77
|
945
|
-
78
|
946
|
-
79
|
947
|
-
80
|
948
|
-
81
|
949
|
-
82
|
950
|
-
83
|
951
|
-
84
|
952
|
-
85
|
953
|
-
86</pre>
|
954
|
-
</td>
|
955
|
-
<td>
|
956
|
-
<pre class="code"><span class="info file"># File 'lib/ballast/ajax_response.rb', line 17</span>
|
957
|
-
|
958
|
-
<span class='rubyid_class class kw'>class</span> <span class='rubyid_AjaxResponse constant id'>AjaxResponse</span>
|
959
|
-
<span class='rubyid_attr_accessor identifier id'>attr_accessor</span> <span class='symbol val'>:status</span><span class='comma token'>,</span> <span class='symbol val'>:data</span><span class='comma token'>,</span> <span class='symbol val'>:error</span><span class='comma token'>,</span> <span class='symbol val'>:transport</span>
|
960
|
-
|
961
|
-
<span class='comment val'># Creates an AJAX response.</span>
|
962
|
-
<span class='comment val'>#</span>
|
963
|
-
<span class='comment val'># @param status [Symbol|Fixnum] The HTTP status of the response.</span>
|
964
|
-
<span class='comment val'># @param data [Object|Hash|NilClass] Additional data to append to the response.</span>
|
965
|
-
<span class='comment val'># @param error [Object|NilClass] A error to append to the response.</span>
|
966
|
-
<span class='comment val'># @param transport [Object|NilClass] The transport to use for sending. Must respond to `render`, `params`, `request.format` and `performed?`.</span>
|
967
|
-
<span class='rubyid_def def kw'>def</span> <span class='rubyid_initialize identifier id'>initialize</span><span class='lparen token'>(</span><span class='label val'>status:</span> <span class='symbol val'>:ok</span><span class='comma token'>,</span> <span class='label val'>data:</span> <span class='lbrace token'>{</span><span class='rbrace token'>}</span><span class='comma token'>,</span> <span class='label val'>error:</span> <span class='rubyid_nil nil kw'>nil</span><span class='comma token'>,</span> <span class='label val'>transport:</span> <span class='rubyid_nil nil kw'>nil</span><span class='rparen token'>)</span>
|
968
|
-
<span class='rubyid_@status ivar id'>@status</span> <span class='assign token'>=</span> <span class='rubyid_status identifier id'>status</span>
|
969
|
-
<span class='rubyid_@data ivar id'>@data</span> <span class='assign token'>=</span> <span class='rubyid_data identifier id'>data</span>
|
970
|
-
<span class='rubyid_@error ivar id'>@error</span> <span class='assign token'>=</span> <span class='rubyid_error identifier id'>error</span>
|
971
|
-
<span class='rubyid_@transport ivar id'>@transport</span> <span class='assign token'>=</span> <span class='rubyid_transport identifier id'>transport</span>
|
972
|
-
<span class='rubyid_end end kw'>end</span>
|
973
|
-
|
974
|
-
<span class='comment val'># Returns the status as a number.</span>
|
975
|
-
<span class='comment val'>#</span>
|
976
|
-
<span class='comment val'># @return [Fixnum] The status as a number.</span>
|
977
|
-
<span class='rubyid_def def kw'>def</span> <span class='rubyid_numeric_status identifier id'>numeric_status</span>
|
978
|
-
<span class='rubyid_status identifier id'>status</span><span class='dot token'>.</span><span class='rubyid_is_a? fid id'>is_a?</span><span class='lparen token'>(</span><span class='rubyid_Fixnum constant id'>Fixnum</span><span class='rparen token'>)</span> <span class='question op'>?</span> <span class='rubyid_status identifier id'>status</span> <span class='colon op'>:</span> <span class='rubyid_Rack constant id'>Rack</span><span class='colon2 op'>::</span><span class='rubyid_Utils constant id'>Utils</span><span class='dot token'>.</span><span class='rubyid_status_code identifier id'>status_code</span><span class='lparen token'>(</span><span class='rubyid_status identifier id'>status</span><span class='dot token'>.</span><span class='rubyid_ensure_string identifier id'>ensure_string</span><span class='dot token'>.</span><span class='rubyid_to_sym identifier id'>to_sym</span><span class='rparen token'>)</span>
|
979
|
-
<span class='rubyid_end end kw'>end</span>
|
980
|
-
|
981
|
-
<span class='comment val'># Returns a JSON representation of the response.</span>
|
982
|
-
<span class='comment val'>#</span>
|
983
|
-
<span class='comment val'># @param options [Hash] The options to use for serializing. Currently only `original_status` is supported.</span>
|
984
|
-
<span class='comment val'># @return [Hash] A JSON representation of the response.</span>
|
985
|
-
<span class='rubyid_def def kw'>def</span> <span class='rubyid_as_json identifier id'>as_json</span><span class='lparen token'>(</span><span class='rubyid_options identifier id'>options</span> <span class='assign token'>=</span> <span class='lbrace token'>{</span><span class='rbrace token'>}</span><span class='rparen token'>)</span>
|
986
|
-
<span class='lbrace token'>{</span>
|
987
|
-
<span class='label val'>status:</span> <span class='rubyid_options identifier id'>options</span><span class='lbrack token'>[</span><span class='symbol val'>:original_status</span><span class='rbrack token'>]</span> <span class='question op'>?</span> <span class='rubyid_status identifier id'>status</span> <span class='colon op'>:</span> <span class='rubyid_numeric_status identifier id'>numeric_status</span><span class='comma token'>,</span>
|
988
|
-
<span class='label val'>data:</span> <span class='rubyid_data identifier id'>data</span><span class='comma token'>,</span>
|
989
|
-
<span class='label val'>error:</span> <span class='rubyid_error identifier id'>error</span>
|
990
|
-
<span class='rbrace token'>}</span>
|
991
|
-
<span class='rubyid_end end kw'>end</span>
|
992
|
-
|
993
|
-
<span class='comment val'># Sends the response using the transport.</span>
|
994
|
-
<span class='comment val'>#</span>
|
995
|
-
<span class='comment val'># @param format [Symbol] The content type of the response.</span>
|
996
|
-
<span class='comment val'># @param pretty_json [Boolean] If JSON response must be pretty formatted.</span>
|
997
|
-
<span class='rubyid_def def kw'>def</span> <span class='rubyid_reply identifier id'>reply</span><span class='lparen token'>(</span><span class='label val'>format:</span> <span class='symbol val'>:json</span><span class='comma token'>,</span> <span class='label val'>pretty_json:</span> <span class='rubyid_false false kw'>false</span><span class='rparen token'>)</span>
|
998
|
-
<span class='rubyid_return return kw'>return</span> <span class='rubyid_if if_mod kw'>if</span> <span class='rubyid_transport identifier id'>transport</span><span class='dot token'>.</span><span class='rubyid_performed? fid id'>performed?</span>
|
999
|
-
|
1000
|
-
<span class='rubyid_format identifier id'>format</span><span class='comma token'>,</span> <span class='rubyid_callback identifier id'>callback</span><span class='comma token'>,</span> <span class='rubyid_content_type identifier id'>content_type</span> <span class='assign token'>=</span> <span class='rubyid_format_reply identifier id'>format_reply</span><span class='lparen token'>(</span><span class='rubyid_format identifier id'>format</span><span class='rparen token'>)</span>
|
1001
|
-
<span class='rubyid_content identifier id'>content</span> <span class='assign token'>=</span> <span class='rubyid_prepare_content identifier id'>prepare_content</span>
|
1002
|
-
<span class='rubyid_content identifier id'>content</span> <span class='assign token'>=</span> <span class='lparen token'>(</span><span class='rubyid_pretty_json identifier id'>pretty_json</span> <span class='integer val'>? </span><span class='rubyid_Oj constant id'>Oj</span><span class='dot token'>.</span><span class='rubyid_dump identifier id'>dump</span><span class='lparen token'>(</span><span class='rubyid_content identifier id'>content</span><span class='rparen token'>)</span> <span class='colon op'>:</span> <span class='rubyid_ActiveSupport constant id'>ActiveSupport</span><span class='colon2 op'>::</span><span class='rubyid_JSON constant id'>JSON</span><span class='dot token'>.</span><span class='rubyid_encode identifier id'>encode</span><span class='lparen token'>(</span><span class='rubyid_content identifier id'>content</span><span class='rparen token'>)</span><span class='rparen token'>)</span> <span class='rubyid_if if_mod kw'>if</span> <span class='lbrack token'>[</span><span class='symbol val'>:json</span><span class='comma token'>,</span> <span class='symbol val'>:jsonp</span><span class='comma token'>,</span> <span class='symbol val'>:text</span><span class='rbrack token'>]</span><span class='dot token'>.</span><span class='rubyid_include? fid id'>include?</span><span class='lparen token'>(</span><span class='rubyid_format identifier id'>format</span><span class='rparen token'>)</span>
|
1003
|
-
|
1004
|
-
<span class='rubyid_transport identifier id'>transport</span><span class='dot token'>.</span><span class='rubyid_render identifier id'>render</span><span class='lparen token'>(</span><span class='rubyid_format identifier id'>format</span> <span class='assign token'>=</span><span class='gt op'>></span> <span class='rubyid_content identifier id'>content</span><span class='comma token'>,</span> <span class='label val'>status:</span> <span class='rubyid_numeric_status identifier id'>numeric_status</span><span class='comma token'>,</span> <span class='label val'>callback:</span> <span class='rubyid_callback identifier id'>callback</span><span class='comma token'>,</span> <span class='label val'>content_type:</span> <span class='rubyid_content_type identifier id'>content_type</span><span class='rparen token'>)</span>
|
1005
|
-
<span class='rubyid_end end kw'>end</span>
|
1006
|
-
|
1007
|
-
<span class='rubyid_private identifier id'>private</span>
|
1008
|
-
|
1009
|
-
<span class='comment val'># :nodoc:</span>
|
1010
|
-
<span class='rubyid_def def kw'>def</span> <span class='rubyid_format_reply identifier id'>format_reply</span><span class='lparen token'>(</span><span class='rubyid_format identifier id'>format</span><span class='rparen token'>)</span>
|
1011
|
-
<span class='rubyid_format identifier id'>format</span> <span class='assign token'>=</span> <span class='rubyid_choose_format identifier id'>choose_format</span><span class='lparen token'>(</span><span class='rubyid_format identifier id'>format</span><span class='rparen token'>)</span>
|
1012
|
-
<span class='rubyid_callback identifier id'>callback</span> <span class='assign token'>=</span> <span class='lbrack token'>[</span><span class='symbol val'>:jsonp</span><span class='comma token'>,</span> <span class='symbol val'>:pretty_jsonp</span><span class='rbrack token'>]</span><span class='dot token'>.</span><span class='rubyid_include? fid id'>include?</span><span class='lparen token'>(</span><span class='rubyid_format identifier id'>format</span><span class='rparen token'>)</span> <span class='question op'>?</span> <span class='lparen token'>(</span><span class='rubyid_transport identifier id'>transport</span><span class='dot token'>.</span><span class='rubyid_params identifier id'>params</span><span class='lbrack token'>[</span><span class='symbol val'>:callback</span><span class='rbrack token'>]</span> <span class='orop op'>||</span> <span class='dstring node'>"jsonp#{Time.now.to_i}"</span><span class='rparen token'>)</span> <span class='colon op'>:</span> <span class='rubyid_nil nil kw'>nil</span>
|
1013
|
-
<span class='rubyid_content_type identifier id'>content_type</span> <span class='assign token'>=</span> <span class='lparen token'>(</span><span class='rubyid_format identifier id'>format</span> <span class='eq op'>==</span> <span class='symbol val'>:text</span><span class='rparen token'>)</span> <span class='question op'>?</span> <span class='string val'>"text/plain"</span> <span class='colon op'>:</span> <span class='rubyid_nil nil kw'>nil</span>
|
1014
|
-
|
1015
|
-
<span class='lbrack token'>[</span><span class='rubyid_format identifier id'>format</span><span class='comma token'>,</span> <span class='rubyid_callback identifier id'>callback</span><span class='comma token'>,</span> <span class='rubyid_content_type identifier id'>content_type</span><span class='rbrack token'>]</span>
|
1016
|
-
<span class='rubyid_end end kw'>end</span>
|
1017
|
-
|
1018
|
-
<span class='comment val'># :nodoc:</span>
|
1019
|
-
<span class='rubyid_def def kw'>def</span> <span class='rubyid_choose_format identifier id'>choose_format</span><span class='lparen token'>(</span><span class='rubyid_format identifier id'>format</span><span class='rparen token'>)</span>
|
1020
|
-
<span class='lparen token'>(</span><span class='rubyid_format identifier id'>format</span> <span class='orop op'>||</span> <span class='rubyid_transport identifier id'>transport</span><span class='dot token'>.</span><span class='rubyid_params identifier id'>params</span><span class='lbrack token'>[</span><span class='symbol val'>:format</span><span class='rbrack token'>]</span> <span class='orop op'>||</span> <span class='rubyid_transport identifier id'>transport</span><span class='dot token'>.</span><span class='rubyid_request identifier id'>request</span><span class='dot token'>.</span><span class='rubyid_format identifier id'>format</span> <span class='orop op'>||</span> <span class='string val'>"json"</span><span class='rparen token'>)</span><span class='dot token'>.</span><span class='rubyid_to_sym identifier id'>to_sym</span> <span class='orop op'>||</span> <span class='symbol val'>:html</span>
|
1021
|
-
<span class='rubyid_end end kw'>end</span>
|
1022
|
-
|
1023
|
-
<span class='comment val'># :nodoc:</span>
|
1024
|
-
<span class='rubyid_def def kw'>def</span> <span class='rubyid_prepare_content identifier id'>prepare_content</span>
|
1025
|
-
<span class='lbrace token'>{</span><span class='label val'>status:</span> <span class='rubyid_Rack constant id'>Rack</span><span class='colon2 op'>::</span><span class='rubyid_Utils constant id'>Utils</span><span class='dot token'>.</span><span class='rubyid_status_code identifier id'>status_code</span><span class='lparen token'>(</span><span class='rubyid_status identifier id'>status</span><span class='rparen token'>)</span><span class='comma token'>,</span> <span class='label val'>data:</span> <span class='rubyid_data identifier id'>data</span><span class='comma token'>,</span> <span class='label val'>error:</span> <span class='rubyid_error identifier id'>error</span><span class='rbrace token'>}</span>
|
1026
|
-
<span class='rubyid_end end kw'>end</span>
|
1027
|
-
<span class='rubyid_end end kw'>end</span>
|
1028
|
-
</pre>
|
1029
|
-
</td>
|
1030
|
-
</tr>
|
1031
|
-
</table>
|
1032
|
-
</div>
|
1033
|
-
|
1034
|
-
|
1035
|
-
<span id="transport=-instance_method"></span>
|
1036
|
-
<div class="method_details ">
|
1037
|
-
<h3 class="signature " id="transport-instance_method">
|
1038
|
-
|
1039
|
-
- (<tt>Object|NilClass</tt>) <strong>transport</strong>
|
1040
|
-
|
1041
|
-
|
1042
|
-
|
1043
|
-
|
1044
|
-
|
1045
|
-
</h3><div class="docstring">
|
1046
|
-
<div class="discussion">
|
1047
|
-
<p>Returns The transport to use for sending. Must respond to <code>render</code>, <code>params</code>, <code>request.format</code> and <code>performed?</code>.</p>
|
1048
|
-
|
1049
|
-
|
1050
|
-
</div>
|
1051
|
-
</div>
|
1052
|
-
<div class="tags">
|
1053
|
-
|
1054
|
-
<p class="tag_title">Returns:</p>
|
1055
|
-
<ul class="return">
|
1056
|
-
|
1057
|
-
<li>
|
1058
|
-
|
1059
|
-
|
1060
|
-
<span class='type'>(<tt>Object|NilClass</tt>)</span>
|
1061
|
-
|
1062
|
-
|
1063
|
-
|
1064
|
-
—
|
1065
|
-
<div class='inline'><p>The transport to use for sending. Must respond to <code>render</code>, <code>params</code>, <code>request.format</code> and <code>performed?</code>.</p>
|
1066
|
-
</div>
|
1067
|
-
|
1068
|
-
</li>
|
1069
|
-
|
1070
|
-
</ul>
|
1071
|
-
|
1072
|
-
</div><table class="source_code">
|
1073
|
-
<tr>
|
1074
|
-
<td>
|
1075
|
-
<pre class="lines">
|
1076
|
-
|
1077
|
-
|
1078
|
-
17
|
1079
|
-
18
|
1080
|
-
19
|
1081
|
-
20
|
1082
|
-
21
|
1083
|
-
22
|
1084
|
-
23
|
1085
|
-
24
|
1086
|
-
25
|
1087
|
-
26
|
1088
|
-
27
|
1089
|
-
28
|
1090
|
-
29
|
1091
|
-
30
|
1092
|
-
31
|
1093
|
-
32
|
1094
|
-
33
|
1095
|
-
34
|
1096
|
-
35
|
1097
|
-
36
|
1098
|
-
37
|
1099
|
-
38
|
1100
|
-
39
|
1101
|
-
40
|
1102
|
-
41
|
1103
|
-
42
|
1104
|
-
43
|
1105
|
-
44
|
1106
|
-
45
|
1107
|
-
46
|
1108
|
-
47
|
1109
|
-
48
|
1110
|
-
49
|
1111
|
-
50
|
1112
|
-
51
|
1113
|
-
52
|
1114
|
-
53
|
1115
|
-
54
|
1116
|
-
55
|
1117
|
-
56
|
1118
|
-
57
|
1119
|
-
58
|
1120
|
-
59
|
1121
|
-
60
|
1122
|
-
61
|
1123
|
-
62
|
1124
|
-
63
|
1125
|
-
64
|
1126
|
-
65
|
1127
|
-
66
|
1128
|
-
67
|
1129
|
-
68
|
1130
|
-
69
|
1131
|
-
70
|
1132
|
-
71
|
1133
|
-
72
|
1134
|
-
73
|
1135
|
-
74
|
1136
|
-
75
|
1137
|
-
76
|
1138
|
-
77
|
1139
|
-
78
|
1140
|
-
79
|
1141
|
-
80
|
1142
|
-
81
|
1143
|
-
82
|
1144
|
-
83
|
1145
|
-
84
|
1146
|
-
85
|
1147
|
-
86</pre>
|
1148
|
-
</td>
|
1149
|
-
<td>
|
1150
|
-
<pre class="code"><span class="info file"># File 'lib/ballast/ajax_response.rb', line 17</span>
|
1151
|
-
|
1152
|
-
<span class='rubyid_class class kw'>class</span> <span class='rubyid_AjaxResponse constant id'>AjaxResponse</span>
|
1153
|
-
<span class='rubyid_attr_accessor identifier id'>attr_accessor</span> <span class='symbol val'>:status</span><span class='comma token'>,</span> <span class='symbol val'>:data</span><span class='comma token'>,</span> <span class='symbol val'>:error</span><span class='comma token'>,</span> <span class='symbol val'>:transport</span>
|
1154
|
-
|
1155
|
-
<span class='comment val'># Creates an AJAX response.</span>
|
1156
|
-
<span class='comment val'>#</span>
|
1157
|
-
<span class='comment val'># @param status [Symbol|Fixnum] The HTTP status of the response.</span>
|
1158
|
-
<span class='comment val'># @param data [Object|Hash|NilClass] Additional data to append to the response.</span>
|
1159
|
-
<span class='comment val'># @param error [Object|NilClass] A error to append to the response.</span>
|
1160
|
-
<span class='comment val'># @param transport [Object|NilClass] The transport to use for sending. Must respond to `render`, `params`, `request.format` and `performed?`.</span>
|
1161
|
-
<span class='rubyid_def def kw'>def</span> <span class='rubyid_initialize identifier id'>initialize</span><span class='lparen token'>(</span><span class='label val'>status:</span> <span class='symbol val'>:ok</span><span class='comma token'>,</span> <span class='label val'>data:</span> <span class='lbrace token'>{</span><span class='rbrace token'>}</span><span class='comma token'>,</span> <span class='label val'>error:</span> <span class='rubyid_nil nil kw'>nil</span><span class='comma token'>,</span> <span class='label val'>transport:</span> <span class='rubyid_nil nil kw'>nil</span><span class='rparen token'>)</span>
|
1162
|
-
<span class='rubyid_@status ivar id'>@status</span> <span class='assign token'>=</span> <span class='rubyid_status identifier id'>status</span>
|
1163
|
-
<span class='rubyid_@data ivar id'>@data</span> <span class='assign token'>=</span> <span class='rubyid_data identifier id'>data</span>
|
1164
|
-
<span class='rubyid_@error ivar id'>@error</span> <span class='assign token'>=</span> <span class='rubyid_error identifier id'>error</span>
|
1165
|
-
<span class='rubyid_@transport ivar id'>@transport</span> <span class='assign token'>=</span> <span class='rubyid_transport identifier id'>transport</span>
|
1166
|
-
<span class='rubyid_end end kw'>end</span>
|
1167
|
-
|
1168
|
-
<span class='comment val'># Returns the status as a number.</span>
|
1169
|
-
<span class='comment val'>#</span>
|
1170
|
-
<span class='comment val'># @return [Fixnum] The status as a number.</span>
|
1171
|
-
<span class='rubyid_def def kw'>def</span> <span class='rubyid_numeric_status identifier id'>numeric_status</span>
|
1172
|
-
<span class='rubyid_status identifier id'>status</span><span class='dot token'>.</span><span class='rubyid_is_a? fid id'>is_a?</span><span class='lparen token'>(</span><span class='rubyid_Fixnum constant id'>Fixnum</span><span class='rparen token'>)</span> <span class='question op'>?</span> <span class='rubyid_status identifier id'>status</span> <span class='colon op'>:</span> <span class='rubyid_Rack constant id'>Rack</span><span class='colon2 op'>::</span><span class='rubyid_Utils constant id'>Utils</span><span class='dot token'>.</span><span class='rubyid_status_code identifier id'>status_code</span><span class='lparen token'>(</span><span class='rubyid_status identifier id'>status</span><span class='dot token'>.</span><span class='rubyid_ensure_string identifier id'>ensure_string</span><span class='dot token'>.</span><span class='rubyid_to_sym identifier id'>to_sym</span><span class='rparen token'>)</span>
|
1173
|
-
<span class='rubyid_end end kw'>end</span>
|
1174
|
-
|
1175
|
-
<span class='comment val'># Returns a JSON representation of the response.</span>
|
1176
|
-
<span class='comment val'>#</span>
|
1177
|
-
<span class='comment val'># @param options [Hash] The options to use for serializing. Currently only `original_status` is supported.</span>
|
1178
|
-
<span class='comment val'># @return [Hash] A JSON representation of the response.</span>
|
1179
|
-
<span class='rubyid_def def kw'>def</span> <span class='rubyid_as_json identifier id'>as_json</span><span class='lparen token'>(</span><span class='rubyid_options identifier id'>options</span> <span class='assign token'>=</span> <span class='lbrace token'>{</span><span class='rbrace token'>}</span><span class='rparen token'>)</span>
|
1180
|
-
<span class='lbrace token'>{</span>
|
1181
|
-
<span class='label val'>status:</span> <span class='rubyid_options identifier id'>options</span><span class='lbrack token'>[</span><span class='symbol val'>:original_status</span><span class='rbrack token'>]</span> <span class='question op'>?</span> <span class='rubyid_status identifier id'>status</span> <span class='colon op'>:</span> <span class='rubyid_numeric_status identifier id'>numeric_status</span><span class='comma token'>,</span>
|
1182
|
-
<span class='label val'>data:</span> <span class='rubyid_data identifier id'>data</span><span class='comma token'>,</span>
|
1183
|
-
<span class='label val'>error:</span> <span class='rubyid_error identifier id'>error</span>
|
1184
|
-
<span class='rbrace token'>}</span>
|
1185
|
-
<span class='rubyid_end end kw'>end</span>
|
1186
|
-
|
1187
|
-
<span class='comment val'># Sends the response using the transport.</span>
|
1188
|
-
<span class='comment val'>#</span>
|
1189
|
-
<span class='comment val'># @param format [Symbol] The content type of the response.</span>
|
1190
|
-
<span class='comment val'># @param pretty_json [Boolean] If JSON response must be pretty formatted.</span>
|
1191
|
-
<span class='rubyid_def def kw'>def</span> <span class='rubyid_reply identifier id'>reply</span><span class='lparen token'>(</span><span class='label val'>format:</span> <span class='symbol val'>:json</span><span class='comma token'>,</span> <span class='label val'>pretty_json:</span> <span class='rubyid_false false kw'>false</span><span class='rparen token'>)</span>
|
1192
|
-
<span class='rubyid_return return kw'>return</span> <span class='rubyid_if if_mod kw'>if</span> <span class='rubyid_transport identifier id'>transport</span><span class='dot token'>.</span><span class='rubyid_performed? fid id'>performed?</span>
|
1193
|
-
|
1194
|
-
<span class='rubyid_format identifier id'>format</span><span class='comma token'>,</span> <span class='rubyid_callback identifier id'>callback</span><span class='comma token'>,</span> <span class='rubyid_content_type identifier id'>content_type</span> <span class='assign token'>=</span> <span class='rubyid_format_reply identifier id'>format_reply</span><span class='lparen token'>(</span><span class='rubyid_format identifier id'>format</span><span class='rparen token'>)</span>
|
1195
|
-
<span class='rubyid_content identifier id'>content</span> <span class='assign token'>=</span> <span class='rubyid_prepare_content identifier id'>prepare_content</span>
|
1196
|
-
<span class='rubyid_content identifier id'>content</span> <span class='assign token'>=</span> <span class='lparen token'>(</span><span class='rubyid_pretty_json identifier id'>pretty_json</span> <span class='integer val'>? </span><span class='rubyid_Oj constant id'>Oj</span><span class='dot token'>.</span><span class='rubyid_dump identifier id'>dump</span><span class='lparen token'>(</span><span class='rubyid_content identifier id'>content</span><span class='rparen token'>)</span> <span class='colon op'>:</span> <span class='rubyid_ActiveSupport constant id'>ActiveSupport</span><span class='colon2 op'>::</span><span class='rubyid_JSON constant id'>JSON</span><span class='dot token'>.</span><span class='rubyid_encode identifier id'>encode</span><span class='lparen token'>(</span><span class='rubyid_content identifier id'>content</span><span class='rparen token'>)</span><span class='rparen token'>)</span> <span class='rubyid_if if_mod kw'>if</span> <span class='lbrack token'>[</span><span class='symbol val'>:json</span><span class='comma token'>,</span> <span class='symbol val'>:jsonp</span><span class='comma token'>,</span> <span class='symbol val'>:text</span><span class='rbrack token'>]</span><span class='dot token'>.</span><span class='rubyid_include? fid id'>include?</span><span class='lparen token'>(</span><span class='rubyid_format identifier id'>format</span><span class='rparen token'>)</span>
|
1197
|
-
|
1198
|
-
<span class='rubyid_transport identifier id'>transport</span><span class='dot token'>.</span><span class='rubyid_render identifier id'>render</span><span class='lparen token'>(</span><span class='rubyid_format identifier id'>format</span> <span class='assign token'>=</span><span class='gt op'>></span> <span class='rubyid_content identifier id'>content</span><span class='comma token'>,</span> <span class='label val'>status:</span> <span class='rubyid_numeric_status identifier id'>numeric_status</span><span class='comma token'>,</span> <span class='label val'>callback:</span> <span class='rubyid_callback identifier id'>callback</span><span class='comma token'>,</span> <span class='label val'>content_type:</span> <span class='rubyid_content_type identifier id'>content_type</span><span class='rparen token'>)</span>
|
1199
|
-
<span class='rubyid_end end kw'>end</span>
|
1200
|
-
|
1201
|
-
<span class='rubyid_private identifier id'>private</span>
|
1202
|
-
|
1203
|
-
<span class='comment val'># :nodoc:</span>
|
1204
|
-
<span class='rubyid_def def kw'>def</span> <span class='rubyid_format_reply identifier id'>format_reply</span><span class='lparen token'>(</span><span class='rubyid_format identifier id'>format</span><span class='rparen token'>)</span>
|
1205
|
-
<span class='rubyid_format identifier id'>format</span> <span class='assign token'>=</span> <span class='rubyid_choose_format identifier id'>choose_format</span><span class='lparen token'>(</span><span class='rubyid_format identifier id'>format</span><span class='rparen token'>)</span>
|
1206
|
-
<span class='rubyid_callback identifier id'>callback</span> <span class='assign token'>=</span> <span class='lbrack token'>[</span><span class='symbol val'>:jsonp</span><span class='comma token'>,</span> <span class='symbol val'>:pretty_jsonp</span><span class='rbrack token'>]</span><span class='dot token'>.</span><span class='rubyid_include? fid id'>include?</span><span class='lparen token'>(</span><span class='rubyid_format identifier id'>format</span><span class='rparen token'>)</span> <span class='question op'>?</span> <span class='lparen token'>(</span><span class='rubyid_transport identifier id'>transport</span><span class='dot token'>.</span><span class='rubyid_params identifier id'>params</span><span class='lbrack token'>[</span><span class='symbol val'>:callback</span><span class='rbrack token'>]</span> <span class='orop op'>||</span> <span class='dstring node'>"jsonp#{Time.now.to_i}"</span><span class='rparen token'>)</span> <span class='colon op'>:</span> <span class='rubyid_nil nil kw'>nil</span>
|
1207
|
-
<span class='rubyid_content_type identifier id'>content_type</span> <span class='assign token'>=</span> <span class='lparen token'>(</span><span class='rubyid_format identifier id'>format</span> <span class='eq op'>==</span> <span class='symbol val'>:text</span><span class='rparen token'>)</span> <span class='question op'>?</span> <span class='string val'>"text/plain"</span> <span class='colon op'>:</span> <span class='rubyid_nil nil kw'>nil</span>
|
1208
|
-
|
1209
|
-
<span class='lbrack token'>[</span><span class='rubyid_format identifier id'>format</span><span class='comma token'>,</span> <span class='rubyid_callback identifier id'>callback</span><span class='comma token'>,</span> <span class='rubyid_content_type identifier id'>content_type</span><span class='rbrack token'>]</span>
|
1210
|
-
<span class='rubyid_end end kw'>end</span>
|
1211
|
-
|
1212
|
-
<span class='comment val'># :nodoc:</span>
|
1213
|
-
<span class='rubyid_def def kw'>def</span> <span class='rubyid_choose_format identifier id'>choose_format</span><span class='lparen token'>(</span><span class='rubyid_format identifier id'>format</span><span class='rparen token'>)</span>
|
1214
|
-
<span class='lparen token'>(</span><span class='rubyid_format identifier id'>format</span> <span class='orop op'>||</span> <span class='rubyid_transport identifier id'>transport</span><span class='dot token'>.</span><span class='rubyid_params identifier id'>params</span><span class='lbrack token'>[</span><span class='symbol val'>:format</span><span class='rbrack token'>]</span> <span class='orop op'>||</span> <span class='rubyid_transport identifier id'>transport</span><span class='dot token'>.</span><span class='rubyid_request identifier id'>request</span><span class='dot token'>.</span><span class='rubyid_format identifier id'>format</span> <span class='orop op'>||</span> <span class='string val'>"json"</span><span class='rparen token'>)</span><span class='dot token'>.</span><span class='rubyid_to_sym identifier id'>to_sym</span> <span class='orop op'>||</span> <span class='symbol val'>:html</span>
|
1215
|
-
<span class='rubyid_end end kw'>end</span>
|
1216
|
-
|
1217
|
-
<span class='comment val'># :nodoc:</span>
|
1218
|
-
<span class='rubyid_def def kw'>def</span> <span class='rubyid_prepare_content identifier id'>prepare_content</span>
|
1219
|
-
<span class='lbrace token'>{</span><span class='label val'>status:</span> <span class='rubyid_Rack constant id'>Rack</span><span class='colon2 op'>::</span><span class='rubyid_Utils constant id'>Utils</span><span class='dot token'>.</span><span class='rubyid_status_code identifier id'>status_code</span><span class='lparen token'>(</span><span class='rubyid_status identifier id'>status</span><span class='rparen token'>)</span><span class='comma token'>,</span> <span class='label val'>data:</span> <span class='rubyid_data identifier id'>data</span><span class='comma token'>,</span> <span class='label val'>error:</span> <span class='rubyid_error identifier id'>error</span><span class='rbrace token'>}</span>
|
1220
|
-
<span class='rubyid_end end kw'>end</span>
|
1221
|
-
<span class='rubyid_end end kw'>end</span>
|
1222
|
-
</pre>
|
1223
|
-
</td>
|
1224
|
-
</tr>
|
1225
|
-
</table>
|
1226
|
-
</div>
|
1227
|
-
|
1228
|
-
</div>
|
1229
|
-
|
1230
|
-
|
1231
|
-
<div id="instance_method_details" class="method_details_list">
|
1232
|
-
<h2>Instance Method Details</h2>
|
1233
|
-
|
1234
|
-
|
1235
|
-
<div class="method_details first">
|
1236
|
-
<h3 class="signature first" id="as_json-instance_method">
|
1237
|
-
|
1238
|
-
- (<tt>Hash</tt>) <strong>as_json</strong>(options = {})
|
1239
|
-
|
1240
|
-
|
1241
|
-
|
1242
|
-
|
1243
|
-
|
1244
|
-
</h3><div class="docstring">
|
1245
|
-
<div class="discussion">
|
1246
|
-
<p>Returns a JSON representation of the response.</p>
|
1247
|
-
|
1248
|
-
|
1249
|
-
</div>
|
1250
|
-
</div>
|
1251
|
-
<div class="tags">
|
1252
|
-
<p class="tag_title">Parameters:</p>
|
1253
|
-
<ul class="param">
|
1254
|
-
|
1255
|
-
<li>
|
1256
|
-
|
1257
|
-
<span class='name'>options</span>
|
1258
|
-
|
1259
|
-
|
1260
|
-
<span class='type'>(<tt>Hash</tt>)</span>
|
1261
|
-
|
1262
|
-
|
1263
|
-
<em class="default">(defaults to: <tt>{}</tt>)</em>
|
1264
|
-
|
1265
|
-
|
1266
|
-
—
|
1267
|
-
<div class='inline'><p>The options to use for serializing. Currently only <code>original_status</code> is supported.</p>
|
1268
|
-
</div>
|
1269
|
-
|
1270
|
-
</li>
|
1271
|
-
|
1272
|
-
</ul>
|
1273
|
-
|
1274
|
-
<p class="tag_title">Returns:</p>
|
1275
|
-
<ul class="return">
|
1276
|
-
|
1277
|
-
<li>
|
1278
|
-
|
1279
|
-
|
1280
|
-
<span class='type'>(<tt>Hash</tt>)</span>
|
1281
|
-
|
1282
|
-
|
1283
|
-
|
1284
|
-
—
|
1285
|
-
<div class='inline'><p>A JSON representation of the response.</p>
|
1286
|
-
</div>
|
1287
|
-
|
1288
|
-
</li>
|
1289
|
-
|
1290
|
-
</ul>
|
1291
|
-
|
1292
|
-
</div><table class="source_code">
|
1293
|
-
<tr>
|
1294
|
-
<td>
|
1295
|
-
<pre class="lines">
|
1296
|
-
|
1297
|
-
|
1298
|
-
44
|
1299
|
-
45
|
1300
|
-
46
|
1301
|
-
47
|
1302
|
-
48
|
1303
|
-
49
|
1304
|
-
50</pre>
|
1305
|
-
</td>
|
1306
|
-
<td>
|
1307
|
-
<pre class="code"><span class="info file"># File 'lib/ballast/ajax_response.rb', line 44</span>
|
1308
|
-
|
1309
|
-
<span class='rubyid_def def kw'>def</span> <span class='rubyid_as_json identifier id'>as_json</span><span class='lparen token'>(</span><span class='rubyid_options identifier id'>options</span> <span class='assign token'>=</span> <span class='lbrace token'>{</span><span class='rbrace token'>}</span><span class='rparen token'>)</span>
|
1310
|
-
<span class='lbrace token'>{</span>
|
1311
|
-
<span class='label val'>status:</span> <span class='rubyid_options identifier id'>options</span><span class='lbrack token'>[</span><span class='symbol val'>:original_status</span><span class='rbrack token'>]</span> <span class='question op'>?</span> <span class='rubyid_status identifier id'>status</span> <span class='colon op'>:</span> <span class='rubyid_numeric_status identifier id'>numeric_status</span><span class='comma token'>,</span>
|
1312
|
-
<span class='label val'>data:</span> <span class='rubyid_data identifier id'>data</span><span class='comma token'>,</span>
|
1313
|
-
<span class='label val'>error:</span> <span class='rubyid_error identifier id'>error</span>
|
1314
|
-
<span class='rbrace token'>}</span>
|
1315
|
-
<span class='rubyid_end end kw'>end</span>
|
1316
|
-
</pre>
|
1317
|
-
</td>
|
1318
|
-
</tr>
|
1319
|
-
</table>
|
1320
|
-
</div>
|
1321
|
-
|
1322
|
-
<div class="method_details ">
|
1323
|
-
<h3 class="signature " id="numeric_status-instance_method">
|
1324
|
-
|
1325
|
-
- (<tt>Fixnum</tt>) <strong>numeric_status</strong>
|
1326
|
-
|
1327
|
-
|
1328
|
-
|
1329
|
-
|
1330
|
-
|
1331
|
-
</h3><div class="docstring">
|
1332
|
-
<div class="discussion">
|
1333
|
-
<p>Returns the status as a number.</p>
|
1334
|
-
|
1335
|
-
|
1336
|
-
</div>
|
1337
|
-
</div>
|
1338
|
-
<div class="tags">
|
1339
|
-
|
1340
|
-
<p class="tag_title">Returns:</p>
|
1341
|
-
<ul class="return">
|
1342
|
-
|
1343
|
-
<li>
|
1344
|
-
|
1345
|
-
|
1346
|
-
<span class='type'>(<tt>Fixnum</tt>)</span>
|
1347
|
-
|
1348
|
-
|
1349
|
-
|
1350
|
-
—
|
1351
|
-
<div class='inline'><p>The status as a number.</p>
|
1352
|
-
</div>
|
1353
|
-
|
1354
|
-
</li>
|
1355
|
-
|
1356
|
-
</ul>
|
1357
|
-
|
1358
|
-
</div><table class="source_code">
|
1359
|
-
<tr>
|
1360
|
-
<td>
|
1361
|
-
<pre class="lines">
|
1362
|
-
|
1363
|
-
|
1364
|
-
36
|
1365
|
-
37
|
1366
|
-
38</pre>
|
1367
|
-
</td>
|
1368
|
-
<td>
|
1369
|
-
<pre class="code"><span class="info file"># File 'lib/ballast/ajax_response.rb', line 36</span>
|
1370
|
-
|
1371
|
-
<span class='rubyid_def def kw'>def</span> <span class='rubyid_numeric_status identifier id'>numeric_status</span>
|
1372
|
-
<span class='rubyid_status identifier id'>status</span><span class='dot token'>.</span><span class='rubyid_is_a? fid id'>is_a?</span><span class='lparen token'>(</span><span class='rubyid_Fixnum constant id'>Fixnum</span><span class='rparen token'>)</span> <span class='question op'>?</span> <span class='rubyid_status identifier id'>status</span> <span class='colon op'>:</span> <span class='rubyid_Rack constant id'>Rack</span><span class='colon2 op'>::</span><span class='rubyid_Utils constant id'>Utils</span><span class='dot token'>.</span><span class='rubyid_status_code identifier id'>status_code</span><span class='lparen token'>(</span><span class='rubyid_status identifier id'>status</span><span class='dot token'>.</span><span class='rubyid_ensure_string identifier id'>ensure_string</span><span class='dot token'>.</span><span class='rubyid_to_sym identifier id'>to_sym</span><span class='rparen token'>)</span>
|
1373
|
-
<span class='rubyid_end end kw'>end</span>
|
1374
|
-
</pre>
|
1375
|
-
</td>
|
1376
|
-
</tr>
|
1377
|
-
</table>
|
1378
|
-
</div>
|
1379
|
-
|
1380
|
-
<div class="method_details ">
|
1381
|
-
<h3 class="signature " id="reply-instance_method">
|
1382
|
-
|
1383
|
-
- (<tt>Object</tt>) <strong>reply</strong>(format: :json, pretty_json: false)
|
1384
|
-
|
1385
|
-
|
1386
|
-
|
1387
|
-
|
1388
|
-
|
1389
|
-
</h3><div class="docstring">
|
1390
|
-
<div class="discussion">
|
1391
|
-
<p>Sends the response using the transport.</p>
|
1392
|
-
|
1393
|
-
|
1394
|
-
</div>
|
1395
|
-
</div>
|
1396
|
-
<div class="tags">
|
1397
|
-
<p class="tag_title">Parameters:</p>
|
1398
|
-
<ul class="param">
|
1399
|
-
|
1400
|
-
<li>
|
1401
|
-
|
1402
|
-
<span class='name'>format</span>
|
1403
|
-
|
1404
|
-
|
1405
|
-
<span class='type'>(<tt>Symbol</tt>)</span>
|
1406
|
-
|
1407
|
-
|
1408
|
-
|
1409
|
-
—
|
1410
|
-
<div class='inline'><p>The content type of the response.</p>
|
1411
|
-
</div>
|
1412
|
-
|
1413
|
-
</li>
|
1414
|
-
|
1415
|
-
<li>
|
1416
|
-
|
1417
|
-
<span class='name'>pretty_json</span>
|
1418
|
-
|
1419
|
-
|
1420
|
-
<span class='type'>(<tt>Boolean</tt>)</span>
|
1421
|
-
|
1422
|
-
|
1423
|
-
|
1424
|
-
—
|
1425
|
-
<div class='inline'><p>If JSON response must be pretty formatted.</p>
|
1426
|
-
</div>
|
1427
|
-
|
1428
|
-
</li>
|
1429
|
-
|
1430
|
-
</ul>
|
1431
|
-
|
1432
|
-
|
1433
|
-
</div><table class="source_code">
|
1434
|
-
<tr>
|
1435
|
-
<td>
|
1436
|
-
<pre class="lines">
|
1437
|
-
|
1438
|
-
|
1439
|
-
56
|
1440
|
-
57
|
1441
|
-
58
|
1442
|
-
59
|
1443
|
-
60
|
1444
|
-
61
|
1445
|
-
62
|
1446
|
-
63
|
1447
|
-
64</pre>
|
1448
|
-
</td>
|
1449
|
-
<td>
|
1450
|
-
<pre class="code"><span class="info file"># File 'lib/ballast/ajax_response.rb', line 56</span>
|
1451
|
-
|
1452
|
-
<span class='rubyid_def def kw'>def</span> <span class='rubyid_reply identifier id'>reply</span><span class='lparen token'>(</span><span class='label val'>format:</span> <span class='symbol val'>:json</span><span class='comma token'>,</span> <span class='label val'>pretty_json:</span> <span class='rubyid_false false kw'>false</span><span class='rparen token'>)</span>
|
1453
|
-
<span class='rubyid_return return kw'>return</span> <span class='rubyid_if if_mod kw'>if</span> <span class='rubyid_transport identifier id'>transport</span><span class='dot token'>.</span><span class='rubyid_performed? fid id'>performed?</span>
|
1454
|
-
|
1455
|
-
<span class='rubyid_format identifier id'>format</span><span class='comma token'>,</span> <span class='rubyid_callback identifier id'>callback</span><span class='comma token'>,</span> <span class='rubyid_content_type identifier id'>content_type</span> <span class='assign token'>=</span> <span class='rubyid_format_reply identifier id'>format_reply</span><span class='lparen token'>(</span><span class='rubyid_format identifier id'>format</span><span class='rparen token'>)</span>
|
1456
|
-
<span class='rubyid_content identifier id'>content</span> <span class='assign token'>=</span> <span class='rubyid_prepare_content identifier id'>prepare_content</span>
|
1457
|
-
<span class='rubyid_content identifier id'>content</span> <span class='assign token'>=</span> <span class='lparen token'>(</span><span class='rubyid_pretty_json identifier id'>pretty_json</span> <span class='integer val'>? </span><span class='rubyid_Oj constant id'>Oj</span><span class='dot token'>.</span><span class='rubyid_dump identifier id'>dump</span><span class='lparen token'>(</span><span class='rubyid_content identifier id'>content</span><span class='rparen token'>)</span> <span class='colon op'>:</span> <span class='rubyid_ActiveSupport constant id'>ActiveSupport</span><span class='colon2 op'>::</span><span class='rubyid_JSON constant id'>JSON</span><span class='dot token'>.</span><span class='rubyid_encode identifier id'>encode</span><span class='lparen token'>(</span><span class='rubyid_content identifier id'>content</span><span class='rparen token'>)</span><span class='rparen token'>)</span> <span class='rubyid_if if_mod kw'>if</span> <span class='lbrack token'>[</span><span class='symbol val'>:json</span><span class='comma token'>,</span> <span class='symbol val'>:jsonp</span><span class='comma token'>,</span> <span class='symbol val'>:text</span><span class='rbrack token'>]</span><span class='dot token'>.</span><span class='rubyid_include? fid id'>include?</span><span class='lparen token'>(</span><span class='rubyid_format identifier id'>format</span><span class='rparen token'>)</span>
|
1458
|
-
|
1459
|
-
<span class='rubyid_transport identifier id'>transport</span><span class='dot token'>.</span><span class='rubyid_render identifier id'>render</span><span class='lparen token'>(</span><span class='rubyid_format identifier id'>format</span> <span class='assign token'>=</span><span class='gt op'>></span> <span class='rubyid_content identifier id'>content</span><span class='comma token'>,</span> <span class='label val'>status:</span> <span class='rubyid_numeric_status identifier id'>numeric_status</span><span class='comma token'>,</span> <span class='label val'>callback:</span> <span class='rubyid_callback identifier id'>callback</span><span class='comma token'>,</span> <span class='label val'>content_type:</span> <span class='rubyid_content_type identifier id'>content_type</span><span class='rparen token'>)</span>
|
1460
|
-
<span class='rubyid_end end kw'>end</span>
|
1461
|
-
</pre>
|
1462
|
-
</td>
|
1463
|
-
</tr>
|
1464
|
-
</table>
|
1465
|
-
</div>
|
1466
|
-
|
1467
|
-
</div>
|
1468
|
-
|
1469
|
-
</div>
|
1470
|
-
|
1471
|
-
<div id="footer">
|
1472
|
-
Generated on Tue Mar 29 10:52:51 2016 by
|
1473
|
-
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1474
|
-
0.8.7.6 (ruby-2.3.0).
|
1475
|
-
</div>
|
1476
|
-
|
1477
|
-
</body>
|
1478
|
-
</html>
|