Added download_file

This commit is contained in:
G. Gibson 2022-04-17 13:07:54 -07:00
parent d09194635d
commit 7dd91a2018

View file

@ -232,6 +232,17 @@ module GxG
# #
end end
# #
def download_file(the_vfs_path="", error_handler=nil, &the_handler)
if self.open?
if the_vfs_path.is_a?(::String) && the_handler
self.pull_data({:download_file => {:path => the_vfs_path}},error_handler, &the_handler)
true
else
false
end
end
end
#
def push(the_message=nil, options={}) def push(the_message=nil, options={})
if @active if @active
# Uses PUT method, with data payload # Uses PUT method, with data payload
@ -353,11 +364,7 @@ module GxG
# FOR NOW: limit 100 records returned at a time. # FOR NOW: limit 100 records returned at a time.
# Use: {:limit => 100, :offset => 0} || {:page => 1} # Use: {:limit => 100, :offset => 0} || {:page => 1}
if details.is_a?(::Hash) && the_handler if details.is_a?(::Hash) && the_handler
self.pull_data({:search_database => {:criteria => details}},error_handler) do |data| self.pull_data({:search_database => {:criteria => details}},error_handler, &the_handler)
if data.is_a?(::Hash)
the_handler.call(data)
end
end
true true
else else
false false
@ -708,9 +715,7 @@ module GxG
def call_event(service=:core, op_frame={:interface => true}, error_handler=nil, &the_handler) def call_event(service=:core, op_frame={:interface => true}, error_handler=nil, &the_handler)
if self.open? if self.open?
if op_frame.is_a?(::Hash) && the_handler if op_frame.is_a?(::Hash) && the_handler
self.pull_data({:call_event => {:service => service.to_s, :op_frame => op_frame}},error_handler) do |data| self.pull_data({:call_event => {:service => service.to_s, :op_frame => op_frame}}, error_handler, &the_handler)
the_handler.call(data)
end
true true
else else
false false