ey_services_fake 0.3.7 → 0.3.8
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.
|
@@ -2,33 +2,42 @@ require 'sinatra/base'
|
|
|
2
2
|
|
|
3
3
|
module EyServicesFake
|
|
4
4
|
class MockingBirdService
|
|
5
|
-
|
|
5
|
+
|
|
6
|
+
def self.implement_the_app(app)
|
|
7
|
+
app.class_eval do
|
|
6
8
|
enable :raise_errors
|
|
7
9
|
disable :dump_errors
|
|
8
10
|
disable :show_exceptions
|
|
9
11
|
|
|
12
|
+
class << self
|
|
13
|
+
attr_accessor :parent
|
|
14
|
+
end
|
|
15
|
+
def parent
|
|
16
|
+
self.class.parent
|
|
17
|
+
end
|
|
18
|
+
|
|
10
19
|
delete '/api/1/some_provisioned_service' do
|
|
11
|
-
if
|
|
12
|
-
instance_eval(&
|
|
20
|
+
if parent.service_deprovisioning_handler
|
|
21
|
+
instance_eval(&parent.service_deprovisioning_handler)
|
|
13
22
|
else
|
|
14
23
|
{}.to_json
|
|
15
24
|
end
|
|
16
25
|
end
|
|
17
26
|
|
|
18
27
|
delete '/api/1/some_service_account' do
|
|
19
|
-
if
|
|
20
|
-
instance_eval(&
|
|
28
|
+
if parent.service_account_cancel_handler
|
|
29
|
+
instance_eval(&parent.service_account_cancel_handler)
|
|
21
30
|
else
|
|
22
31
|
{}.to_json
|
|
23
32
|
end
|
|
24
33
|
end
|
|
25
34
|
|
|
26
35
|
post '/api/1/service_accounts_callback' do
|
|
27
|
-
if
|
|
28
|
-
instance_eval(&
|
|
36
|
+
if parent.service_account_creation_handler
|
|
37
|
+
instance_eval(&parent.service_account_creation_handler)
|
|
29
38
|
else
|
|
30
39
|
service_account = EY::ServicesAPI::ServiceAccountCreation.from_request(request.body.read)
|
|
31
|
-
standard_response_params =
|
|
40
|
+
standard_response_params = parent.service_account_creation_params
|
|
32
41
|
EY::ServicesAPI::ServiceAccountResponse.new(
|
|
33
42
|
:provisioned_services_url => standard_response_params[:provisioned_services_url],
|
|
34
43
|
:url => standard_response_params[:url],
|
|
@@ -40,15 +49,15 @@ module EyServicesFake
|
|
|
40
49
|
end
|
|
41
50
|
|
|
42
51
|
post '/api/1/provisioned_services_callback' do
|
|
43
|
-
if
|
|
44
|
-
instance_eval(&
|
|
52
|
+
if parent.service_provisioning_handler
|
|
53
|
+
instance_eval(&parent.service_provisioning_handler)
|
|
45
54
|
else
|
|
46
55
|
provisioned_service = EY::ServicesAPI::ProvisionedServiceCreation.from_request(request.body.read)
|
|
47
|
-
standard_response_params =
|
|
56
|
+
standard_response_params = parent.service_provisioned_params
|
|
48
57
|
EY::ServicesAPI::ProvisionedServiceResponse.new(
|
|
49
58
|
:url => standard_response_params[:url],
|
|
50
59
|
:vars => standard_response_params[:vars],
|
|
51
|
-
:configuration_required =>
|
|
60
|
+
:configuration_required => standard_response_params[:configuration_required],
|
|
52
61
|
:configuration_url => standard_response_params[:configuration_url],
|
|
53
62
|
:message => EY::ServicesAPI::Message.new(:message_type => "status", :subject => "some provisioned service messages")
|
|
54
63
|
).to_hash.to_json
|
|
@@ -62,8 +71,8 @@ module EyServicesFake
|
|
|
62
71
|
get '/sso/some_provisioned_service' do
|
|
63
72
|
"SSO Hello Provisioned Service"
|
|
64
73
|
end
|
|
74
|
+
end
|
|
65
75
|
end
|
|
66
|
-
|
|
67
76
|
class << self
|
|
68
77
|
attr_accessor :service_account_creation_handler
|
|
69
78
|
attr_accessor :service_provisioning_handler
|
|
@@ -72,14 +81,21 @@ module EyServicesFake
|
|
|
72
81
|
end
|
|
73
82
|
|
|
74
83
|
def reset!
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
84
|
+
self.class.service_account_creation_handler = nil
|
|
85
|
+
self.class.service_provisioning_handler = nil
|
|
86
|
+
self.class.service_deprovisioning_handler = nil
|
|
87
|
+
self.class.service_account_cancel_handler = nil
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
def make_app
|
|
91
|
+
app = Class.new(Sinatra::Base)
|
|
92
|
+
self.class.implement_the_app(app)
|
|
93
|
+
app.parent = self.class
|
|
94
|
+
app
|
|
79
95
|
end
|
|
80
96
|
|
|
81
97
|
def app
|
|
82
|
-
|
|
98
|
+
@app ||= make_app
|
|
83
99
|
end
|
|
84
100
|
|
|
85
101
|
def setup(auth_id, auth_key, base_url = nil, backend = nil)
|
|
@@ -137,7 +153,7 @@ module EyServicesFake
|
|
|
137
153
|
end
|
|
138
154
|
|
|
139
155
|
def register_service(registration_url)
|
|
140
|
-
EY::ServicesAPI.connection.register_service(registration_url,
|
|
156
|
+
EY::ServicesAPI.connection.register_service(registration_url, self.class.registration_params)
|
|
141
157
|
end
|
|
142
158
|
|
|
143
159
|
def send_message(message_url, message_type, message_subject, message_body)
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ey_services_fake
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
hash:
|
|
4
|
+
hash: 3
|
|
5
5
|
prerelease:
|
|
6
6
|
segments:
|
|
7
7
|
- 0
|
|
8
8
|
- 3
|
|
9
|
-
-
|
|
10
|
-
version: 0.3.
|
|
9
|
+
- 8
|
|
10
|
+
version: 0.3.8
|
|
11
11
|
platform: ruby
|
|
12
12
|
authors:
|
|
13
13
|
- Jacob Burkhart & Josh Lane
|
|
@@ -15,7 +15,7 @@ autorequire:
|
|
|
15
15
|
bindir: bin
|
|
16
16
|
cert_chain: []
|
|
17
17
|
|
|
18
|
-
date: 2012-
|
|
18
|
+
date: 2012-04-04 00:00:00 Z
|
|
19
19
|
dependencies:
|
|
20
20
|
- !ruby/object:Gem::Dependency
|
|
21
21
|
name: sinatra
|
|
@@ -109,7 +109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
109
109
|
requirements: []
|
|
110
110
|
|
|
111
111
|
rubyforge_project: ey_services_fake
|
|
112
|
-
rubygems_version: 1.8.
|
|
112
|
+
rubygems_version: 1.8.19
|
|
113
113
|
signing_key:
|
|
114
114
|
specification_version: 3
|
|
115
115
|
summary: A fake for use when writting tests against the ey_services_api
|