manywho 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/lib/manywho.rb +555 -0
- metadata +44 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
NjE2ZjlmMjlkMzc5ZDc2ODE5MDJkNmE1Y2Q0YzRiZmIzYWI0YTM3Ng==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
NGE2ZmFiNzJlYjc0NjlmN2Q3MWNlYzAyZTRkMTFkMzA2NWFjZGQ0MQ==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
ZDMxMmFhZWNkMzI2MzQ2MDA2ZTY2N2YyMDk5YzhiNzNhYjhiOWM0NzM0NjE5
|
10
|
+
Yzc4OGU3YWRlNmEzYjM3ZDFjNWIxNGNiZDA3MzM0OTk1NjY0MWI0MDYzNGE5
|
11
|
+
NGJkNTNlNjBhYTUyMTI3YjZkOTBiMDQ4MWE4MTRiOGU5NTIxYTM=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
MTI2ODNkNWIyYTExY2FlMmQ1YzUzOWM5NDU2ZTkxNDgwNGZmNWJiNDNjMGE0
|
14
|
+
NTQzMzA1YjE0MGFmNDZhYmMxOWNjNjUzMzUxZjcxY2MxMTRlMjQ5Y2Y2OTVk
|
15
|
+
YTBjOTM2ZmQ2YmRiMDE2MWZiZjMzNjMxNjNiZmQ2ZjQzMjYyY2Y=
|
data/lib/manywho.rb
ADDED
@@ -0,0 +1,555 @@
|
|
1
|
+
=begin
|
2
|
+
|
3
|
+
Copyright 2013 Manywho, Inc.
|
4
|
+
|
5
|
+
Licensed under the Manywho License, Version 1.0 (the "License"); you may not use this
|
6
|
+
file except in compliance with the License.
|
7
|
+
|
8
|
+
You may obtain a copy of the License at: http://manywho.com/sharedsource
|
9
|
+
|
10
|
+
Unless required by applicable law or agreed to in writing, software distributed under
|
11
|
+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
12
|
+
KIND, either express or implied. See the License for the specific language governing
|
13
|
+
permissions and limitations under the License.
|
14
|
+
|
15
|
+
=end
|
16
|
+
|
17
|
+
require "net/http"
|
18
|
+
require "net/https"
|
19
|
+
require "json"
|
20
|
+
require "date"
|
21
|
+
require "cgi"
|
22
|
+
|
23
|
+
HTTP = Net::HTTP.new("flow.manywho.com", 443)
|
24
|
+
HTTP.use_ssl = true
|
25
|
+
|
26
|
+
# OpenSSL verification
|
27
|
+
HTTP.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
28
|
+
|
29
|
+
module Manywho
|
30
|
+
class Engine
|
31
|
+
# Initialize instance variables
|
32
|
+
def initialize
|
33
|
+
@TenantUID = false
|
34
|
+
@LoginToken = nil
|
35
|
+
end
|
36
|
+
|
37
|
+
# This method sets the Tenant Unique ID
|
38
|
+
def set_tenant(tenantUniqueID)
|
39
|
+
if ( is_valid_id(tenantUniqueID, "tenantUniqueId") )
|
40
|
+
@TenantUID = tenantUniqueID
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
# Tests if an id is valid, otherwise raises an error
|
45
|
+
def is_valid_id(idString, idType)
|
46
|
+
if (idString.is_a? String) && (idString =~ /^[-0-9a-f]+$/) &&
|
47
|
+
(idString.length == 36) && (idString.count("-") == 4)
|
48
|
+
return true
|
49
|
+
else
|
50
|
+
puts "Error: id is not valid (" + idType + "): " + idString.to_s
|
51
|
+
return false
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
# Tests if a request has completed successfully, otherwise raises an error
|
56
|
+
def is_ok(resp, url)
|
57
|
+
if (resp.code == "200") && (resp.body.length)
|
58
|
+
return true
|
59
|
+
else
|
60
|
+
puts "Error: something went wrong in the rsponse (" + url +")"
|
61
|
+
return false
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
# Tests if a value is of a specified class type, otherwise raises an error
|
66
|
+
def is_class(value, expectedClass, methodName, parameter)
|
67
|
+
if (value.class.to_s == expectedClass.to_s)
|
68
|
+
return true
|
69
|
+
else
|
70
|
+
puts "Error: parameter " + parameter.to_s + " of " + methodName + " must be a " + expectedClass.to_s + ". " +
|
71
|
+
"Parameter " + parameter.to_s + " was a " + value.class.to_s
|
72
|
+
return false
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
# Gets a FlowResponse object from the server for the provided ID
|
77
|
+
def get_FlowResponse(flowId)
|
78
|
+
if ( is_valid_id(flowId, "FlowId") )
|
79
|
+
resp, data = HTTP.get("/api/run/1/flow/" + flowId,
|
80
|
+
{ "ManyWhoTenant" => @TenantUID , "content-type" => "application/json"} )
|
81
|
+
# If everything went well, return a new FlowResponse from the JSON object retrieved
|
82
|
+
if ( is_ok(resp, "/api/run/1/flow/" + flowId) )
|
83
|
+
parsedJSON = JSON.parse(resp.body)
|
84
|
+
return FlowResponse.new(parsedJSON)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
return false
|
88
|
+
end
|
89
|
+
|
90
|
+
# Creates an EngineInitializationRequest to be sent to the server using get_EngineInitializationResponse
|
91
|
+
def create_EngineInitializationRequest(flowResponse, annotations = nil, inputs = [], mode = nil)
|
92
|
+
# Ensure that all of the arguments are valid
|
93
|
+
if ( is_class(flowResponse, FlowResponse, "create_EngineInitializationRequest", 1) ) &&
|
94
|
+
( (annotations == nil) or (is_class( annotations, Hash, "create_EngineInitializationRequest", "annotations")) ) &&
|
95
|
+
( (is_class( inputs, Array, "create_EngineInitializationRequest", "inputs")) ) &&
|
96
|
+
( (mode == nil) or (is_class( mode, String, "create_EngineInitializationRequest", "mode")) )
|
97
|
+
# Create a hash to initialize the EngineInitializationRequest
|
98
|
+
engineInitializationJSON = { "flowId" => flowResponse.id,
|
99
|
+
"annotations" => annotations,
|
100
|
+
"inputs" => inputs,
|
101
|
+
"playerURL" => "https://flow.manywho.com/"+@TenantUID+"/play/myplayer",
|
102
|
+
"joinPlayerURL" => "https://flow.manywho.com/"+@TenantUID+"/play/myplayer",
|
103
|
+
"mode" => mode
|
104
|
+
}
|
105
|
+
return EngineInitializationRequest.new(engineInitializationJSON)
|
106
|
+
end
|
107
|
+
return false
|
108
|
+
end
|
109
|
+
|
110
|
+
# Gets an EngineInitializationResponse from the server, using a HTTP POST request.
|
111
|
+
def get_EngineInitializationResponse(engineInitializationRequest)
|
112
|
+
# Ensure that all of the arguments are valid
|
113
|
+
if ( is_class(engineInitializationRequest, EngineInitializationRequest, "get_EngineInitializationResponse", 1) )
|
114
|
+
|
115
|
+
# POST the EngineInitializationRequest
|
116
|
+
resp, data = HTTP.post("/api/run/1/",
|
117
|
+
engineInitializationRequest.to_json(),
|
118
|
+
{ "ManyWhoTenant" => @TenantUID , "content-type" => "application/json"} )
|
119
|
+
|
120
|
+
# If everything went well, return a new EngineInitializationResponse created from the server's response
|
121
|
+
if ( is_ok(resp, "/api/run/1/") )
|
122
|
+
parsedJSON = JSON.parse(resp.body)
|
123
|
+
return EngineInitializationResponse.new(parsedJSON)
|
124
|
+
end
|
125
|
+
end
|
126
|
+
return false
|
127
|
+
end
|
128
|
+
|
129
|
+
# Logs in to the flow. Flows may require you to log in, this only has to be done once before executing the flow
|
130
|
+
def login(engineInitializationResponse, username, password)
|
131
|
+
# Ensure that all of the arguments are valid
|
132
|
+
if ( is_class(engineInitializationResponse, EngineInitializationResponse, "login", 1) ) &&
|
133
|
+
( ( is_class(username, String, "login", 2) ) && (username.length) ) &&
|
134
|
+
( ( is_class(password, String, "login", 3) ) && (password.length) )
|
135
|
+
|
136
|
+
# Create a logon request
|
137
|
+
loginRequest = {
|
138
|
+
"loginUrl" => engineInitializationResponse.authorizationContext.loginUrl, #engineInitializationResponse.authorizationContext["loginUrl"],
|
139
|
+
"username" => username,
|
140
|
+
"password" => password
|
141
|
+
}
|
142
|
+
|
143
|
+
# POST the login request
|
144
|
+
resp, data = HTTP.post("/api/run/1/authentication",
|
145
|
+
loginRequest.to_json(),
|
146
|
+
{ "ManyWhoTenant" => @TenantUID , "content-type" => "application/json"} )
|
147
|
+
|
148
|
+
# If everything went well, set the logon token
|
149
|
+
if ( is_ok(resp, "/api/run/1/authentication") )
|
150
|
+
@LoginToken = resp.body[1...resp.body.length-1]
|
151
|
+
end
|
152
|
+
end
|
153
|
+
return false
|
154
|
+
end
|
155
|
+
|
156
|
+
# Create an EngineInvokeRequest to be posted to the server using get_EngineInvokeResponse
|
157
|
+
def create_EngineInvokeRequest(engineInitializationResponse, flowResponse=nil, invokeType="FORWARD")
|
158
|
+
# Ensure that all of the arguments are valid
|
159
|
+
if ( is_class(engineInitializationResponse, EngineInitializationResponse, "create_EngineInvokeRequest", 1) ) &&
|
160
|
+
( is_class(invokeType, String, "create_EngineInvokeRequest", "invokeType") ) &&
|
161
|
+
( (flowResponse == nil) || (is_class(flowResponse, FlowResponse, "create_EngineInvokeRequest", "flowResponse")) )
|
162
|
+
|
163
|
+
# If a flowResponse is provided, use the startMapElementId
|
164
|
+
# If no flowResponse is provided, such as the engine is syncing, use the currentMapElementId
|
165
|
+
if (flowResponse)
|
166
|
+
currentMapElementId = flowResponse.startMapElementId
|
167
|
+
elsif
|
168
|
+
currentMapElementId = engineInitializationResponse.currentMapElementId
|
169
|
+
end
|
170
|
+
|
171
|
+
# Create and return a new EngineInvokeRequest
|
172
|
+
engineInvokeJSON = {
|
173
|
+
"stateId" => engineInitializationResponse.stateId,
|
174
|
+
"stateToken" => engineInitializationResponse.stateToken,
|
175
|
+
"currentMapElementId" => currentMapElementId, #"7b2e4865-bd54-4073-b4f4-a4ec001afc9a", #### BODGE #### engineInitializationResponse.currentMapElementId,
|
176
|
+
"invokeType" => invokeType,
|
177
|
+
"geoLocation" => {
|
178
|
+
"latitude" => 0,
|
179
|
+
"longitude" => 0,
|
180
|
+
"accuracy" => 0,
|
181
|
+
"altitude" => 0,
|
182
|
+
"altitudeAccuracy" => 0,
|
183
|
+
"heading" => 0,
|
184
|
+
"speed" => 0
|
185
|
+
},
|
186
|
+
"mapElementInvokeRequest" => {
|
187
|
+
"selectedOutcomeId" => nil
|
188
|
+
},
|
189
|
+
"mode" => nil
|
190
|
+
}
|
191
|
+
return EngineInvokeRequest.new(engineInvokeJSON)
|
192
|
+
end
|
193
|
+
return false
|
194
|
+
end
|
195
|
+
|
196
|
+
# Create a EngineInvokeRequest from an engineInvokeResponse - such as when an outcome is selected, and a new EngineInvokeRequest is required
|
197
|
+
def recreate_EngineInvokeRequest(engineInvokeResponse, selectedOutcomeId, invokeType="FORWARD")
|
198
|
+
# Ensure that all of the arguments are valid
|
199
|
+
if ( is_class(engineInvokeResponse, EngineInvokeResponse, "recreate_EngineInvokeRequest", 1) ) &&
|
200
|
+
( is_valid_id(selectedOutcomeId, "selectedOutcomeId") ) &&
|
201
|
+
( is_class(invokeType, String, "create_EngineInvokeRequest", "invokeType") )
|
202
|
+
|
203
|
+
# Create and return a new EngineInvokeRequest
|
204
|
+
engineInvokeJSON = {
|
205
|
+
"stateId" => engineInvokeResponse.stateId,
|
206
|
+
"stateToken" => engineInvokeResponse.stateToken,
|
207
|
+
"currentMapElementId" => engineInvokeResponse.currentMapElementId,
|
208
|
+
"invokeType" => invokeType,
|
209
|
+
"geoLocation" => {
|
210
|
+
"latitude" => 0,
|
211
|
+
"longitude" => 0,
|
212
|
+
"accuracy" => 0,
|
213
|
+
"altitude" => 0,
|
214
|
+
"altitudeAccuracy" => 0,
|
215
|
+
"heading" => 0,
|
216
|
+
"speed" => 0
|
217
|
+
},
|
218
|
+
"mapElementInvokeRequest" => {
|
219
|
+
"selectedOutcomeId" => selectedOutcomeId
|
220
|
+
},
|
221
|
+
"mode" => nil
|
222
|
+
}
|
223
|
+
return EngineInvokeRequest.new(engineInvokeJSON)
|
224
|
+
end
|
225
|
+
return false
|
226
|
+
end
|
227
|
+
|
228
|
+
# Post the EngineInvokeRequest, and return the EngineInvokeResponse
|
229
|
+
def get_EngineInvokeResponse(engineInvokeRequest)
|
230
|
+
# Ensure that all arguments are valid
|
231
|
+
if ( is_class(engineInvokeRequest, EngineInvokeRequest, "get_EngineInvokeResponse", 1) )
|
232
|
+
if (@LoginToken)
|
233
|
+
# POST the EngineInvokeRequest, with authentication
|
234
|
+
resp, data = HTTP.post("/api/run/1/state/" + engineInvokeRequest.stateId,
|
235
|
+
engineInvokeRequest.to_json,
|
236
|
+
{ "ManyWhoTenant" => @TenantUID , "content-type" => "application/json", "Authorization" => @LoginToken} )
|
237
|
+
else
|
238
|
+
# POST the EngineInvokeRequest, without authentication
|
239
|
+
resp, data = HTTP.post("/api/run/1/state/" + engineInvokeRequest.stateId,
|
240
|
+
engineInvokeRequest.to_json,
|
241
|
+
{ "ManyWhoTenant" => @TenantUID , "content-type" => "application/json"} )
|
242
|
+
end
|
243
|
+
|
244
|
+
# If everything went well, return a new EngineInvokeResponse created from the server's response
|
245
|
+
if ( is_ok(resp, "/api/run/1/state/" + engineInvokeRequest.stateId) )
|
246
|
+
parsedJSON = JSON.parse(resp.body)
|
247
|
+
return EngineInvokeResponse.new(parsedJSON)
|
248
|
+
end
|
249
|
+
end
|
250
|
+
return false
|
251
|
+
end
|
252
|
+
|
253
|
+
# Select an outcomeResponse, and get the next EngineInvokeResponse
|
254
|
+
def select_OutcomeResponse(engineInvokeResponse, outcomeResponseDeveloperName, invokeType="FORWARD")
|
255
|
+
# Ensure that all arguments are valid
|
256
|
+
if ( is_class(engineInvokeResponse, EngineInvokeResponse, "select_OutcomeResponse", 1) ) &&
|
257
|
+
( is_class(outcomeResponseDeveloperName, String, "select_OutcomeResponse", 2) ) &&
|
258
|
+
( is_class(invokeType, String, "select_OutcomeResponse", "invokeType") )
|
259
|
+
|
260
|
+
# Get the ID of the selected outcome, using the outcome's developerName
|
261
|
+
selectedOutcomeId = nil
|
262
|
+
engineInvokeResponse.mapElementInvokeResponses[0].outcomeResponses.each do |outcomeResp|
|
263
|
+
if (outcomeResp.developerName == outcomeResponseDeveloperName)
|
264
|
+
selectedOutcomeId = outcomeResp.id
|
265
|
+
end
|
266
|
+
end
|
267
|
+
|
268
|
+
# Create the EngineInvokeRequest from the EngineInvokeResponse
|
269
|
+
engineInvokeRequest = recreate_EngineInvokeRequest(engineInvokeResponse, selectedOutcomeId)
|
270
|
+
|
271
|
+
# Return a new EngineInvokeResponse, created from data received from the server
|
272
|
+
return get_EngineInvokeResponse( engineInvokeRequest )
|
273
|
+
end
|
274
|
+
return false
|
275
|
+
end
|
276
|
+
|
277
|
+
# Load a flow, given the tenantId, flowId and logon details the first EngineInvokeResponse will be returned
|
278
|
+
def load_flow(tenant, flowId, username="", password="")
|
279
|
+
# Ensure all the arguments are valid
|
280
|
+
if ( is_valid_id(tenant, "tenantId") ) &&
|
281
|
+
( is_valid_id(flowId, "flowId") ) &&
|
282
|
+
( is_class(username, String, "load_flow", "username") ) &&
|
283
|
+
( is_class(password, String, "load_flow", "password") )
|
284
|
+
# Set the tenant
|
285
|
+
set_tenant(tenant)
|
286
|
+
|
287
|
+
# Get the FlowResponse for the flow by id
|
288
|
+
flowResponse = get_FlowResponse(flowId)
|
289
|
+
|
290
|
+
# Create an EngineInitializationRequest, and use it to retreive an EngineInitializationResponse from the server
|
291
|
+
engineInitializationResponse = get_EngineInitializationResponse(
|
292
|
+
create_EngineInitializationRequest( flowResponse )
|
293
|
+
)
|
294
|
+
|
295
|
+
# If required to log in to the flow
|
296
|
+
if (engineInitializationResponse.statusCode == "401")
|
297
|
+
# If login details, attempt to login
|
298
|
+
if (username != "") && (password != "")
|
299
|
+
login(engineInitializationResponse, username, password)
|
300
|
+
else
|
301
|
+
return "You need to login to run this flow: " + engineInitializationResponse.authorizationContext.loginUrl#["loginUrl"]
|
302
|
+
end
|
303
|
+
end
|
304
|
+
|
305
|
+
# Get a new EngineInvokeResponse from the server
|
306
|
+
return engineInvokeResponse = get_EngineInvokeResponse(
|
307
|
+
create_EngineInvokeRequest(engineInitializationResponse, flowResponse=flowResponse) )
|
308
|
+
end
|
309
|
+
return false
|
310
|
+
end
|
311
|
+
end
|
312
|
+
|
313
|
+
# Initialized with a JSON hash, each value of the hash is converted into an instance variable. Can also be easily converted into a JSON string
|
314
|
+
class MyStruct
|
315
|
+
def to_json(options= {})
|
316
|
+
hash = {}
|
317
|
+
self.instance_variables.each do |var|
|
318
|
+
hash[var[1...var.length]] = self.instance_variable_get var
|
319
|
+
end
|
320
|
+
return hash.to_json
|
321
|
+
end
|
322
|
+
|
323
|
+
# Set instance values from the hash
|
324
|
+
def initialize(jsonValue)
|
325
|
+
if (jsonValue != nil)
|
326
|
+
jsonValue.each do
|
327
|
+
|k,v| self.instance_variable_set("@#{k}", v)
|
328
|
+
end
|
329
|
+
end
|
330
|
+
end
|
331
|
+
end
|
332
|
+
|
333
|
+
class FlowResponse < MyStruct
|
334
|
+
attr_accessor :dateCreated, :dateModified, :userCreated,
|
335
|
+
:userModified, :userOwner, :alertEmail,
|
336
|
+
:editingToken, :id, :developerName,
|
337
|
+
:developerSummary, :isActive, :startMapElementId,
|
338
|
+
:authorization
|
339
|
+
|
340
|
+
def initialize(jsonValue)
|
341
|
+
super(jsonValue)
|
342
|
+
@id = FlowIdentifier.new(@id)
|
343
|
+
end
|
344
|
+
end
|
345
|
+
|
346
|
+
class EngineInitializationRequest < MyStruct
|
347
|
+
attr_accessor :flowId, :annotations, :inputs,
|
348
|
+
:mode
|
349
|
+
|
350
|
+
def initialize(jsonValue)
|
351
|
+
super(jsonValue)
|
352
|
+
#@flowId = FlowIdentifier.new(@flowId)
|
353
|
+
if (@inputs != nil)
|
354
|
+
endArray = []
|
355
|
+
@inputs.each do |input|
|
356
|
+
endArray += [EngineValue(input)]
|
357
|
+
end
|
358
|
+
@inputs = endArray
|
359
|
+
end
|
360
|
+
|
361
|
+
end
|
362
|
+
end
|
363
|
+
|
364
|
+
class EngineInitializationResponse < MyStruct
|
365
|
+
attr_accessor :stateId, :stateToken, :currentMapElementId,
|
366
|
+
:currentMapElementId, :currentStreamId, :statusCode,
|
367
|
+
:authorizationContext
|
368
|
+
def initialize(jsonValue)
|
369
|
+
super(jsonValue)
|
370
|
+
@authorizationContext = AuthorizationContext.new(@authorizationContext)
|
371
|
+
end
|
372
|
+
end
|
373
|
+
|
374
|
+
class EngineInvokeRequest < MyStruct
|
375
|
+
attr_accessor :stateId, :stateToken, :currentMapElementId,
|
376
|
+
:invokeType, :annotations, :geoLocatoin,
|
377
|
+
:mapElementInvokeRequest, :mode
|
378
|
+
def initialize(jsonValue)
|
379
|
+
super(jsonValue)
|
380
|
+
@geoLocation = GeoLocation.new(@geoLocation)
|
381
|
+
@mapElementInvokeRequest = MapElementInvokeResponse.new(@mapElementInvokeRequest)
|
382
|
+
end
|
383
|
+
end
|
384
|
+
|
385
|
+
class MapElementInvokeRequest < MyStruct
|
386
|
+
attr_accessor :selectedOutcomeId
|
387
|
+
end
|
388
|
+
|
389
|
+
class EngineInvokeResponse < MyStruct
|
390
|
+
attr_accessor :stateId, :stateToken, :currentMapElementId,
|
391
|
+
:invokeType, :annotations, :mapElementInvokeResponses,
|
392
|
+
:stateLog, :preCommitStateValues, :stateValues,
|
393
|
+
:outputs, :statusCode, :runFlowUrl,
|
394
|
+
:joinFlowUrl, :authorizationContext
|
395
|
+
def initialize(jsonValue)
|
396
|
+
super(jsonValue)
|
397
|
+
if (@mapElementInvokeResponses != nil)
|
398
|
+
endArray = []
|
399
|
+
@mapElementInvokeResponses.each do |invokeResponse|
|
400
|
+
endArray += [MapElementInvokeResponse.new(invokeResponse)]
|
401
|
+
end
|
402
|
+
@mapElementInvokeResponses = endArray
|
403
|
+
end
|
404
|
+
if (@preCommitStateValues != nil)
|
405
|
+
endArray = []
|
406
|
+
@preCommitStateValues.each do |preComitStateValue|
|
407
|
+
endArray += [EngineValue.new(preComitStateValue)]
|
408
|
+
end
|
409
|
+
@preCommitStateValues = endArray
|
410
|
+
end
|
411
|
+
if (@stateValues != nil)
|
412
|
+
endArray = []
|
413
|
+
@stateValues.each do |stateValue|
|
414
|
+
endArray += [EngineValue.new(stateValue)]
|
415
|
+
end
|
416
|
+
@stateValues = endArray
|
417
|
+
end
|
418
|
+
if (@outputs != nil)
|
419
|
+
endArray = []
|
420
|
+
@outputs.each do |output|
|
421
|
+
endArray += [EngineValue.new(output)]
|
422
|
+
end
|
423
|
+
@outputs = endArray
|
424
|
+
end
|
425
|
+
@authorizationContext = AuthorizationContext.new(@authorizationContext)
|
426
|
+
end
|
427
|
+
end
|
428
|
+
|
429
|
+
class MapElementInvokeResponse < MyStruct
|
430
|
+
attr_accessor :mapElementId, :developerName, :pageResponse,
|
431
|
+
:outcomeResponses, :rootFaults
|
432
|
+
|
433
|
+
def initialize(jsonValue)
|
434
|
+
super(jsonValue)
|
435
|
+
@pageResponse = PageResponse.new(@pageResponse)
|
436
|
+
if (@outcomeResponses != nil)
|
437
|
+
endArray = []
|
438
|
+
@outcomeResponses.each do |outputResponse|
|
439
|
+
endArray += [OutcomeResponse.new(outputResponse)]
|
440
|
+
end
|
441
|
+
@outcomeResponses = endArray
|
442
|
+
end
|
443
|
+
end
|
444
|
+
end
|
445
|
+
|
446
|
+
class PageResponse < MyStruct
|
447
|
+
attr_accessor :label, :pageContainerResponses, :pageComponentResponses,
|
448
|
+
:pageContainerDataResponses, :pageComponentDataResponses, :order,
|
449
|
+
:outcomeResponses, :rootFaults
|
450
|
+
def initialize(jsonValue)
|
451
|
+
super(jsonValue)
|
452
|
+
if (@pageContainerResponses != nil)
|
453
|
+
endArray = []
|
454
|
+
@pageContainerResponses.each do |pContainer|
|
455
|
+
endArray += [PageContainerResponse.new(pContainer)]
|
456
|
+
end
|
457
|
+
@pageContainerResponses = endArray
|
458
|
+
end
|
459
|
+
if (@pageComponentResponses != nil)
|
460
|
+
endArray = []
|
461
|
+
@pageComponentResponses.each do |pComponent|
|
462
|
+
endArray += [PageComponentResponse.new(pComponent)]
|
463
|
+
end
|
464
|
+
@pageComponentResponses = endArray
|
465
|
+
end
|
466
|
+
if (@pageContainerDataResponses != nil)
|
467
|
+
endArray = []
|
468
|
+
@pageContainerDataResponses.each do |pContainerData|
|
469
|
+
endArray += [PageContainerDataResponse.new(pContainerData)]
|
470
|
+
end
|
471
|
+
@pageContainerDataResponses = endArray
|
472
|
+
end
|
473
|
+
if (@pageComponentDataResponses != nil)
|
474
|
+
endArray = []
|
475
|
+
@pageComponentDataResponses.each do |pComponentData|
|
476
|
+
endArray += [PageComponentDataResponse.new(pComponentData)]
|
477
|
+
end
|
478
|
+
@pageComponentDataResponses = endArray
|
479
|
+
end
|
480
|
+
if (@outcomeResponses != nil)
|
481
|
+
endArray = []
|
482
|
+
@outcomeResponses.each do |outcomeResponse|
|
483
|
+
endArray += [OutcomeResponse.new(outcomeResponse)]
|
484
|
+
end
|
485
|
+
@outcomeResponses = endArray
|
486
|
+
end
|
487
|
+
end
|
488
|
+
end
|
489
|
+
|
490
|
+
class PageContainerResponse < MyStruct
|
491
|
+
attr_accessor :id, :containerType, :developerName,
|
492
|
+
:label, :pageContainerResponses, :order
|
493
|
+
def initialize(jsonValue)
|
494
|
+
super(jsonValue)
|
495
|
+
if (@pageContainerResponses != nil)
|
496
|
+
endArray = []
|
497
|
+
@pageContainerResponses.each do |pContainer|
|
498
|
+
endArray += [PageContainerResponse.new(pContainer)]
|
499
|
+
end
|
500
|
+
@pageContainerResponses = endArray
|
501
|
+
end
|
502
|
+
end
|
503
|
+
end
|
504
|
+
|
505
|
+
class PageComponentResponse < MyStruct
|
506
|
+
attr_accessor :pageContainerDeveloperName, :pageContainerId, :id,
|
507
|
+
:developerName, :componentType, :contentType,
|
508
|
+
:label, :columns, :size,
|
509
|
+
:maxSize, :height, :width,
|
510
|
+
:hintValue, :helpInfo, :order,
|
511
|
+
:isMultiSelect, :hasEvents
|
512
|
+
end
|
513
|
+
|
514
|
+
class PageComponentDataResponse < MyStruct
|
515
|
+
attr_accessor :pageComponentId, :isEnabled, :isEditable,
|
516
|
+
:isRequired, :isVisible, :objectData,
|
517
|
+
:objectDataRequest, :contentValue, :content,
|
518
|
+
:isValid, :validationMessage, :tags
|
519
|
+
end
|
520
|
+
|
521
|
+
class PageContainerDataResponse < MyStruct
|
522
|
+
attr_accessor :pageContainerId, :isEnabled, :isVisible,
|
523
|
+
:tags
|
524
|
+
end
|
525
|
+
|
526
|
+
class OutcomeResponse < MyStruct
|
527
|
+
attr_accessor :id, :developerName, :label,
|
528
|
+
:pageActionBinding, :formElementBindingId, :order
|
529
|
+
end
|
530
|
+
|
531
|
+
class GeoLocation < MyStruct
|
532
|
+
attr_accessor :latitude, :longitude, :accuracy,
|
533
|
+
:altitude, :altitudeAccuracy, :heading,
|
534
|
+
:speed
|
535
|
+
end
|
536
|
+
|
537
|
+
class FlowIdentifier < MyStruct
|
538
|
+
attr_accessor :id, :versionId
|
539
|
+
end
|
540
|
+
|
541
|
+
class AuthorizationContext < MyStruct
|
542
|
+
attr_accessor :id, :directoryId, :loginUrl
|
543
|
+
end
|
544
|
+
|
545
|
+
class AuthorizationRequest < MyStruct
|
546
|
+
attr_accessor :loginUrl, :username, :password,
|
547
|
+
:token
|
548
|
+
end
|
549
|
+
|
550
|
+
class EngineValue < MyStruct
|
551
|
+
attr_accessor :id, :typeElementId, :typeElementEntryId,
|
552
|
+
:typeElementDeveloperName, :typeElementEntryDeveloperName, :contentValue,
|
553
|
+
:contentType, :id
|
554
|
+
end
|
555
|
+
end
|
metadata
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: manywho
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Eddie Ellams
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-09-03 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Allows Manywho flows to be run within Ruby
|
14
|
+
email: eddie.ellams@manywho.com
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- lib/manywho.rb
|
20
|
+
homepage: ''
|
21
|
+
licenses:
|
22
|
+
- Manywho License, Version 1.0
|
23
|
+
metadata: {}
|
24
|
+
post_install_message:
|
25
|
+
rdoc_options: []
|
26
|
+
require_paths:
|
27
|
+
- lib
|
28
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
requirements: []
|
39
|
+
rubyforge_project:
|
40
|
+
rubygems_version: 2.0.7
|
41
|
+
signing_key:
|
42
|
+
specification_version: 4
|
43
|
+
summary: Manywho gem
|
44
|
+
test_files: []
|