lib/soaspec/virtual_server.rb in soaspec-0.2.21 vs lib/soaspec/virtual_server.rb in soaspec-0.2.22
- old
+ new
@@ -28,18 +28,32 @@
introduction 'This has some simple virtual services aimed at helping you with testing your Ruby API code.'
end
documentation 'Nothing under /. Go look at /docs' do
response 'redirects to the documentation page'
- status 303
+ status 302
end
get '/' do
redirect '/docs'
end
doc_endpoint '/docs'
+ documentation 'Simulate server error' do
+ status 500
+ end
+ get '/server_error' do
+ [500, {}, 'Internal Server Error']
+ end
+
+ documentation 'Used to verify extract from text response' do
+ response 'Plain text with a pattern to match in it'
+ end
+ get '/text_response' do
+ 'This is some text. In here it says ID=12345 to indicate value to obtain'
+ end
+
documentation 'Used to test attributes' do
response 'A simple Note XML with a date attribute'
end
get '/test_attribute' do
Soaspec::TestServer::TestAttribute.note
@@ -61,9 +75,10 @@
end
get '/packages/:num/:id' do |num, id|
JSON.generate(success: Soaspec::TestServer::IdManager.result_for(num, id), id: id)
end
+ documentation 'Sets status as developed'
post '/packages/developed' do
Soaspec::TestServer::IdManager.developed = request.body.include?('true')
Soaspec::TestServer::IdManager.developed.to_s
end