webservice 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/webservice/base.rb +8 -7
- data/lib/webservice/version.rb +2 -2
- data/lib/webservice.rb +5 -0
- data/test/test_app.rb +6 -6
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b87ad63f5ba3f56d568e2173cc7aeeb91baf3385
|
4
|
+
data.tar.gz: 84149a402131cbff753036033e9e001fbd2760d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d1494c5b9021a6bc7315284ad9d0edbeecd8c6a943add5c98a2f07e17114747765a5c6ca527a47617e2698a863ae03bfe10a31e640ed76d07f0aaad827732a83
|
7
|
+
data.tar.gz: 31e38e4f48ae3c31f04a82a892caa6931235cc0b7b35d99c8c5194f2baff24dd202abd422f3d86f0b4a10adb825b914fbcbce02fc66ff716dff52c54eda6107a
|
data/lib/webservice/base.rb
CHANGED
@@ -99,18 +99,19 @@ private
|
|
99
99
|
end
|
100
100
|
|
101
101
|
def handle_response( obj )
|
102
|
+
puts "[Webservice::Base#handle_response]- obj: #{obj.class.name}"
|
103
|
+
|
102
104
|
### todo/fix: set content type to json
|
103
|
-
### call serializer or to_json
|
104
105
|
|
105
|
-
|
106
|
-
|
107
|
-
response.write obj
|
106
|
+
if obj.respond_to?( :as_json_v2 )
|
107
|
+
response.write obj.as_json_v2
|
108
108
|
else
|
109
|
-
|
109
|
+
## just try/use to_json
|
110
|
+
response.write obj.to_json
|
110
111
|
end
|
111
112
|
end
|
112
113
|
|
114
|
+
|
113
115
|
end # class Base
|
114
|
-
|
115
|
-
end # module Webservice
|
116
116
|
|
117
|
+
end # module Webservice
|
data/lib/webservice/version.rb
CHANGED
data/lib/webservice.rb
CHANGED
data/test/test_app.rb
CHANGED
@@ -24,31 +24,31 @@ class TestApp < MiniTest::Test
|
|
24
24
|
def test_get
|
25
25
|
get '/'
|
26
26
|
assert last_response.ok?
|
27
|
-
assert_equal
|
27
|
+
assert_equal %q{"Hello World"}, last_response.body
|
28
28
|
|
29
29
|
get '/hello/world'
|
30
30
|
assert last_response.ok?
|
31
|
-
assert_equal
|
31
|
+
assert_equal %q{"Hello world"}, last_response.body
|
32
32
|
|
33
33
|
##############################
|
34
34
|
## get '/hello/:name'
|
35
35
|
get '/hello/ruby'
|
36
36
|
assert last_response.ok?
|
37
|
-
assert_equal
|
37
|
+
assert_equal %q{"Hello ruby"}, last_response.body
|
38
38
|
|
39
39
|
get '/hello/ruby?test=t' ## try w/ extra query string/params
|
40
40
|
assert last_response.ok?
|
41
|
-
assert_equal
|
41
|
+
assert_equal %q{"Hello ruby"}, last_response.body
|
42
42
|
|
43
43
|
##################################
|
44
44
|
## get '/:message/:name'
|
45
45
|
get '/servus/wien'
|
46
46
|
assert last_response.ok?
|
47
|
-
assert_equal
|
47
|
+
assert_equal %q{"servus wien"}, last_response.body
|
48
48
|
|
49
49
|
get '/Hallo/Welt'
|
50
50
|
assert last_response.ok?
|
51
|
-
assert_equal
|
51
|
+
assert_equal %q{"Hallo Welt"}, last_response.body
|
52
52
|
end
|
53
53
|
|
54
54
|
def test_halt
|