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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c0ff082b8bd1417341423a5a5abdee33a74725e8
4
- data.tar.gz: da6f80a3b3196dff209bab205bb5576c0c891876
3
+ metadata.gz: b87ad63f5ba3f56d568e2173cc7aeeb91baf3385
4
+ data.tar.gz: 84149a402131cbff753036033e9e001fbd2760d0
5
5
  SHA512:
6
- metadata.gz: 0755f9c681941673028c0951c89ba2b34e832ff9bdc3a9f1c79eaad9ba7c3fa2c56db3beddc87a85bac337d03488bbd61389fcdb30e6cd23b61f8267bc6b048a
7
- data.tar.gz: 8580d408cb8fb79baf05c4a9480c7c5b6f59ca2880e608388d62be9d4ced01cc843e5124399a380c91b4c325d5a4ca13a3a022366b1ea0333950535a79d66e64
6
+ metadata.gz: d1494c5b9021a6bc7315284ad9d0edbeecd8c6a943add5c98a2f07e17114747765a5c6ca527a47617e2698a863ae03bfe10a31e640ed76d07f0aaad827732a83
7
+ data.tar.gz: 31e38e4f48ae3c31f04a82a892caa6931235cc0b7b35d99c8c5194f2baff24dd202abd422f3d86f0b4a10adb825b914fbcbce02fc66ff716dff52c54eda6107a
@@ -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
- ## note: dummy for now
106
- if obj.is_a?(String)
107
- response.write obj
106
+ if obj.respond_to?( :as_json_v2 )
107
+ response.write obj.as_json_v2
108
108
  else
109
- response.write "hello - obj: #{obj.class.name} - to be done"
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
@@ -2,8 +2,8 @@
2
2
 
3
3
  module Webservice
4
4
  MAJOR = 0 ## todo: namespace inside version or something - why? why not??
5
- MINOR = 1
6
- PATCH = 1
5
+ MINOR = 2
6
+ PATCH = 0
7
7
  VERSION = [MAJOR,MINOR,PATCH].join('.')
8
8
 
9
9
  def self.version
data/lib/webservice.rb CHANGED
@@ -1,5 +1,10 @@
1
1
  # encoding: utf-8
2
2
 
3
+ ## stdlib
4
+ require 'json'
5
+ require 'pp'
6
+
7
+
3
8
  # 3rd party gems/libs
4
9
 
5
10
  require 'logutils'
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 'Hello World', last_response.body
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 'Hello world', last_response.body
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 'Hello ruby', last_response.body
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 'Hello ruby', last_response.body
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 'servus wien', last_response.body
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 'Hallo Welt', last_response.body
51
+ assert_equal %q{"Hallo Welt"}, last_response.body
52
52
  end
53
53
 
54
54
  def test_halt
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webservice
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gerald Bauer