Sha256: 24bc89f58a26be18ac218b0b6adc769e1e2edfeeda5e366cb3d628c8e29c5351
Contents?: true
Size: 1.4 KB
Versions: 6
Compression:
Stored size: 1.4 KB
Contents
#!/usr/bin/env ruby # Used to run virtual web service on localhost. This makes tests more reliable and faster $LOAD_PATH.unshift File.join(File.dirname(__FILE__), *%w[.. lib]) require 'soaspec' require 'sinatra' require 'nokogiri' require 'erb' require 'json' require 'faker' set :port, 4999 # Used to test attributes get '/test_attribute' do Soaspec::TestServer::TestAttribute.note end # This is the one being hit by SOAP actions post '/BLZService' do Soaspec::TestServer::GetBank.response_for request end # This is returned when a query for the WSDL is made get '/BLZService' do [200, { 'Content-Type' => 'text/xml' }, Soaspec::TestServer::GetBank.test_wsdl] end get '/as/token.oauth2' do end # Used for testing storage of data post '/test/id' do # puts request.body.string request_hash = JSON.parse(request.body.string) # request_hash = JSON.parse('{ "id": "1" }') # puts request_hash uuid = SecureRandom.uuid Soaspec::TestServer::PuppyService.data[uuid] = {} Soaspec::TestServer::PuppyService.data[uuid][:id] = request_hash['id'] # puts PuppyService.data 'Success' end # Used for testing retrieving storage of data get '/test/id/:id' do |id| # puts "ID is:#{id}:" # puts id.class # puts PuppyService.data # puts PuppyService.data['id'] # puts PuppyService.data[id] result = Soaspec::TestServer::PuppyService.data.select { |_key, hash| hash[:id] == id } JSON.generate(result) end
Version data entries
6 entries across 6 versions & 1 rubygems