Sha256: fd4cf2273a2380a64d8bbacd77a2076ecb4dd0a8a0aa9c27955021f9be57745b

Contents?: true

Size: 1.6 KB

Versions: 2

Compression:

Stored size: 1.6 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/name' do
  request_hash = JSON.parse(request.body.string)
  id = Soaspec::TestServer::PuppyService.new_id
  Soaspec::TestServer::PuppyService.data[id][:Name] = request_hash['Name']
  Soaspec::TestServer::PuppyService.data[id][:Failure_Type__c] = request_hash['Failure_Type__c'] if request_hash['Failure_Type__c']
  response_hash = { result: { Status: 'success', Data: Soaspec::TestServer::PuppyService.data[id] } }
  JSON.generate response_hash
end

# Used for testing retrieving storage of data
get '/test/name/:id' do |id|
  result = Soaspec::TestServer::PuppyService.data[id.to_i]
  JSON.generate result
end

patch '/test/name/:id' do |id|
  request_hash = JSON.parse(request.body.string)
  Soaspec::TestServer::PuppyService.data[id.to_i][:Name] = request_hash['Name']
  response_hash = { result: { Status: 'updated', With: request_hash['Name'] } }
  JSON.generate response_hash
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
soaspec-0.0.68 exe/soaspec-virtual-server
soaspec-0.0.67 exe/soaspec-virtual-server