Added Call_Event

This commit is contained in:
G. Gibson 2022-01-08 11:30:58 -08:00
parent f714232854
commit 9a629ae516
3 changed files with 666 additions and 693 deletions

File diff suppressed because one or more lines are too long

View file

@ -721,7 +721,7 @@ module GxG
true true
end end
# #
def call_event(operation_envelope=nil, credential=:"00000000-0000-4000-0000-000000000000") def call_event(operation_envelope=nil, credential=(::GxG::DB[:administrator] || :"00000000-0000-4000-0000-000000000000"))
result = nil result = nil
if operation_envelope.is_a?(::Hash) if operation_envelope.is_a?(::Hash)
the_event = operation_envelope.keys[0] the_event = operation_envelope.keys[0]

View file

@ -1107,7 +1107,27 @@ module GxGwww
response = [404, {"content-type" => "application/json"}, ({:result => false, :error => "Not Found.", :parameters => false}).to_json()] response = [404, {"content-type" => "application/json"}, ({:result => false, :error => "Not Found.", :parameters => false}).to_json()]
end end
end end
response response
end
#
def call_event(details={})
if self.closed?
response = [500, {"content-type" => "application/json"}, ({:result => false, :error => "Connector Closed.", :parameters => false}).to_json()]
else
the_service = ::GxG::SERVICES[(details[:service].to_s.downcase.to_sym)]
if the_service
the_result = the_service.call_event(details[:op_frame], @credential)
if the_result[:error]
response = [500, {"content-type" => "application/json"}, ({:result => false, :error => the_result[:error], :parameters => false}).to_json()]
else
response = [200, {"content-type" => "application/json"}, (the_result.to_json]
end
else
# err - service not found
response = [404, {"content-type" => "application/json"}, ({:result => false, :error => "Service #{details[:service].to_s} Not Found.", :parameters => false}).to_json()]
end
end
response
end end
# #
def vfs_mkfile(details={}) def vfs_mkfile(details={})