flexible_api_server 0.0.10 → 0.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/flexible_api_server/version.rb +1 -1
- data/lib/flexible_api_server.rb +11 -2
- metadata +3 -3
data/lib/flexible_api_server.rb
CHANGED
@@ -33,6 +33,9 @@ module FlexibleApiServer
|
|
33
33
|
nil
|
34
34
|
end
|
35
35
|
|
36
|
+
JSON_CONTENT_TYPE = 'application/json;charset=utf-8'
|
37
|
+
XML_CONTENT_TYPE = 'application/xml;charset=utf-8'
|
38
|
+
|
36
39
|
def free_render(code, hash = '') # blank by default, not nil
|
37
40
|
status code
|
38
41
|
# Filter some things out
|
@@ -42,8 +45,14 @@ module FlexibleApiServer
|
|
42
45
|
# and respond
|
43
46
|
format :js unless ALLOWED_FORMATS.include? format
|
44
47
|
respond_to do |wants|
|
45
|
-
wants.js
|
46
|
-
|
48
|
+
wants.js do
|
49
|
+
headers['Content-type'] = JSON_CONTENT_TYPE
|
50
|
+
hash.to_json
|
51
|
+
end
|
52
|
+
wants.xml do
|
53
|
+
headers['Content-type'] = XML_CONTENT_TYPE
|
54
|
+
hash.to_xml
|
55
|
+
end
|
47
56
|
end
|
48
57
|
end
|
49
58
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flexible_api_server
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 9
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 11
|
10
|
+
version: 0.0.11
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- John Crepezzi
|