Sha256: 9e0f821b8a407e9fb7ab4a6a46397d5b14c11f2cf4f070a212603c6b99b3c807

Contents?: true

Size: 1.37 KB

Versions: 4

Compression:

Stored size: 1.37 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

# 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

4 entries across 4 versions & 1 rubygems

Version Path
soaspec-0.0.58 exe/soaspec-virtual-server
soaspec-0.0.57 exe/soaspec-virtual-server
soaspec-0.0.56 exe/soaspec-virtual-server
soaspec-0.0.55 exe/soaspec-virtual-server