soaspec 0.0.70 → 0.0.71

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 75a8f7429afd308450857be61f8e893768528b2e
4
- data.tar.gz: 6e5653da6b36aedf3add0c3ca3745b61e9f1af58
3
+ metadata.gz: 5e53a58becd2e09fe58b8b40fefdd5b4b0388bea
4
+ data.tar.gz: 0dd249bb58f3d9f57ae1a182bea25b2e84203db2
5
5
  SHA512:
6
- metadata.gz: 1f3d4dcd1bb4e80a97e9a7068e0dd6ea5a7909d1e1eef99f3d4358619c52d744d04aba93f38ee0cd479dcb744cc8a722d3bead2e90ab799f56df2f8352acca87
7
- data.tar.gz: 19c0acd669bd4cb7ee5c2c26ef290082281ffc1ed0b5d6e6b721859d6dff4ad94d745b02f0fcf336081fae7ebfab887e0b98f187851598bab5cb97daaf33b2b1
6
+ metadata.gz: d55f91deface593e2c66a6ac06d5d0c0f9ff347f3700d9c7473a87016cb526bb5220d1a1761e41a3a99c36e5e0e7da68844844116f9a03f3bb5c6aa94d42c947
7
+ data.tar.gz: 1bb1828e448a6ecbcfab0c84c7f85eec52a8c05406fccaa14e1f025fb93af701b93da348d42eae9c5a5b4cdce1cf341e729cc85990a2677e5411e5cf21b1839f
data/ChangeLog CHANGED
@@ -1,3 +1,7 @@
1
+ Version 0.0.71
2
+ * Bug fix
3
+ * Got exe 'soaspec-virtual-server' working
4
+
1
5
  Version 0.0.70
2
6
  * Enhancements
3
7
  * Added api_username method to REST handler to change user for an API during runtime
@@ -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
- set :port, 4999
12
+ class SoaspecVirtualServer < Sinatra::Application
15
13
 
16
- # Used to test attributes
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
- # This is the one being hit by SOAP actions
22
- post '/BLZService' do
23
- Soaspec::TestServer::GetBank.response_for request
24
- end
16
+ set :port, 4999
25
17
 
26
- # This is returned when a query for the WSDL is made
27
- get '/BLZService' do
28
- [200, { 'Content-Type' => 'text/xml' }, Soaspec::TestServer::GetBank.test_wsdl]
29
- end
18
+ # Used to test attributes
19
+ get '/test_attribute' do
20
+ Soaspec::TestServer::TestAttribute.note
21
+ end
30
22
 
31
- # Simulate retrieving an ouath token. Passed to '/invoices'
32
- post '/as/token.oauth2' do
33
- [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)]
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
- get '/invoice/:id' do |id|
37
- JSON.generate(customer_id: id, oauth: request.env['HTTP_AUTHORIZATION'])
38
- end
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
- authorize do |username, password|
41
- username == 'admin' && password == 'secret'
42
- end
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
- protect do
45
- get '/basic_secrets' do
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
- # Used for testing storage of data
51
- post '/test/puppy' do
52
- request_hash = JSON.parse(request.body.string)
53
- id = Soaspec::TestServer::PuppyService.new_id
54
- Soaspec::TestServer::PuppyService.data[id][:Name] = request_hash['Name']
55
- Soaspec::TestServer::PuppyService.data[id][:Failure_Type__c] = request_hash['Failure_Type__c'] if request_hash['Failure_Type__c']
56
- response_hash = { result: { Status: 'success', Data: Soaspec::TestServer::PuppyService.data[id] } }
57
- JSON.generate response_hash
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 retrieving storage of data
61
- get '/test/puppy/:id' do |id|
62
- result = Soaspec::TestServer::PuppyService.data[id.to_i]
63
- JSON.generate result
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
- patch '/test/puppy/:id' do |id|
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!
@@ -1,3 +1,3 @@
1
1
  module Soaspec
2
- VERSION = '0.0.70'.freeze
2
+ VERSION = '0.0.71'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: soaspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.70
4
+ version: 0.0.71
5
5
  platform: ruby
6
6
  authors:
7
7
  - SamuelGarrattIQA