soaspec 0.0.70 → 0.0.71
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ChangeLog +4 -0
- data/exe/soaspec-virtual-server +53 -48
- data/lib/soaspec/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5e53a58becd2e09fe58b8b40fefdd5b4b0388bea
|
4
|
+
data.tar.gz: 0dd249bb58f3d9f57ae1a182bea25b2e84203db2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d55f91deface593e2c66a6ac06d5d0c0f9ff347f3700d9c7473a87016cb526bb5220d1a1761e41a3a99c36e5e0e7da68844844116f9a03f3bb5c6aa94d42c947
|
7
|
+
data.tar.gz: 1bb1828e448a6ecbcfab0c84c7f85eec52a8c05406fccaa14e1f025fb93af701b93da348d42eae9c5a5b4cdce1cf341e729cc85990a2677e5411e5cf21b1839f
|
data/ChangeLog
CHANGED
data/exe/soaspec-virtual-server
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
# Used to run virtual web service on localhost. This makes tests more reliable and faster
|
4
|
-
|
5
3
|
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
|
6
4
|
require 'soaspec'
|
7
5
|
require 'sinatra'
|
@@ -11,61 +9,68 @@ require 'erb'
|
|
11
9
|
require 'json'
|
12
10
|
require 'faker'
|
13
11
|
|
14
|
-
|
12
|
+
class SoaspecVirtualServer < Sinatra::Application
|
15
13
|
|
16
|
-
# Used to
|
17
|
-
get '/test_attribute' do
|
18
|
-
Soaspec::TestServer::TestAttribute.note
|
19
|
-
end
|
14
|
+
# Used to run virtual web service on localhost. This makes tests more reliable and faster
|
20
15
|
|
21
|
-
|
22
|
-
post '/BLZService' do
|
23
|
-
Soaspec::TestServer::GetBank.response_for request
|
24
|
-
end
|
16
|
+
set :port, 4999
|
25
17
|
|
26
|
-
#
|
27
|
-
get '/
|
28
|
-
|
29
|
-
end
|
18
|
+
# Used to test attributes
|
19
|
+
get '/test_attribute' do
|
20
|
+
Soaspec::TestServer::TestAttribute.note
|
21
|
+
end
|
30
22
|
|
31
|
-
#
|
32
|
-
post '/
|
33
|
-
|
34
|
-
end
|
23
|
+
# This is the one being hit by SOAP actions
|
24
|
+
post '/BLZService' do
|
25
|
+
Soaspec::TestServer::GetBank.response_for request
|
26
|
+
end
|
35
27
|
|
36
|
-
|
37
|
-
|
38
|
-
|
28
|
+
# This is returned when a query for the WSDL is made
|
29
|
+
get '/BLZService' do
|
30
|
+
[200, { 'Content-Type' => 'text/xml' }, Soaspec::TestServer::GetBank.test_wsdl]
|
31
|
+
end
|
39
32
|
|
40
|
-
|
41
|
-
|
42
|
-
|
33
|
+
# Simulate retrieving an ouath token. Passed to '/invoices'
|
34
|
+
post '/as/token.oauth2' do
|
35
|
+
[200, Soaspec::TestServer::Invoices.oauth_headers, JSON.generate(Soaspec::TestServer::Invoices.oauth_body) ] #Soaspec::TestServer::Invoices.oauth_headers, ]# JSON.generate(Soaspec::TestServer::Invoices.oauth_body)]
|
36
|
+
end
|
43
37
|
|
44
|
-
|
45
|
-
|
46
|
-
'Secret data'
|
38
|
+
get '/invoice/:id' do |id|
|
39
|
+
JSON.generate(customer_id: id, oauth: request.env['HTTP_AUTHORIZATION'])
|
47
40
|
end
|
48
|
-
end
|
49
41
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
end
|
42
|
+
authorize do |username, password|
|
43
|
+
username == 'admin' && password == 'secret'
|
44
|
+
end
|
45
|
+
|
46
|
+
protect do
|
47
|
+
get '/basic_secrets' do
|
48
|
+
'Secret data'
|
49
|
+
end
|
50
|
+
end
|
59
51
|
|
60
|
-
# Used for testing
|
61
|
-
|
62
|
-
|
63
|
-
|
52
|
+
# Used for testing storage of data
|
53
|
+
post '/test/puppy' do
|
54
|
+
request_hash = JSON.parse(request.body.string)
|
55
|
+
id = Soaspec::TestServer::PuppyService.new_id
|
56
|
+
Soaspec::TestServer::PuppyService.data[id][:Name] = request_hash['Name']
|
57
|
+
Soaspec::TestServer::PuppyService.data[id][:Failure_Type__c] = request_hash['Failure_Type__c'] if request_hash['Failure_Type__c']
|
58
|
+
response_hash = { result: { Status: 'success', Data: Soaspec::TestServer::PuppyService.data[id] } }
|
59
|
+
JSON.generate response_hash
|
60
|
+
end
|
61
|
+
|
62
|
+
# Used for testing retrieving storage of data
|
63
|
+
get '/test/puppy/:id' do |id|
|
64
|
+
result = Soaspec::TestServer::PuppyService.data[id.to_i]
|
65
|
+
JSON.generate result
|
66
|
+
end
|
67
|
+
|
68
|
+
patch '/test/puppy/:id' do |id|
|
69
|
+
request_hash = JSON.parse(request.body.string)
|
70
|
+
Soaspec::TestServer::PuppyService.data[id.to_i][:Name] = request_hash['Name']
|
71
|
+
response_hash = { result: { Status: 'updated', With: request_hash['Name'] } }
|
72
|
+
JSON.generate response_hash
|
73
|
+
end
|
64
74
|
end
|
65
75
|
|
66
|
-
|
67
|
-
request_hash = JSON.parse(request.body.string)
|
68
|
-
Soaspec::TestServer::PuppyService.data[id.to_i][:Name] = request_hash['Name']
|
69
|
-
response_hash = { result: { Status: 'updated', With: request_hash['Name'] } }
|
70
|
-
JSON.generate response_hash
|
71
|
-
end
|
76
|
+
SoaspecVirtualServer.run!
|
data/lib/soaspec/version.rb
CHANGED