Class: FoundationApi
- Inherits:
-
Object
- Object
- FoundationApi
- Defined in:
- lib/meshx-plugin-sdk.rb
Instance Method Summary collapse
- #display_response(response) ⇒ Object
- #exit ⇒ Object
- #file_cache_read(uri, destination) ⇒ Object
- #file_cache_write(filename) ⇒ Object
- #get_exit ⇒ Object
- #get_messages ⇒ Object
-
#initialize ⇒ FoundationApi
constructor
A new instance of FoundationApi.
- #pase_response(response) ⇒ Object
- #send_complete_events ⇒ Object
- #send_file_event(path, filename, originalpath, origin) ⇒ Object
- #send_folder_event(path, folder, originalpath, origin) ⇒ Object
- #send_message(data) ⇒ Object
Constructor Details
#initialize ⇒ FoundationApi
Returns a new instance of FoundationApi.
336 337 338 |
# File 'lib/meshx-plugin-sdk.rb', line 336 def initialize() @exit = false end |
Instance Method Details
#display_response(response) ⇒ Object
355 356 357 358 359 |
# File 'lib/meshx-plugin-sdk.rb', line 355 def display_response(response) puts("payload: #{response.payload}") puts("error: #{response.error}") puts("exit_code: #{response.exit_code}") end |
#exit ⇒ Object
340 341 342 |
# File 'lib/meshx-plugin-sdk.rb', line 340 def exit() @exit = true end |
#file_cache_read(uri, destination) ⇒ Object
389 390 391 392 393 394 |
# File 'lib/meshx-plugin-sdk.rb', line 389 def file_cache_read(uri, destination) d, e = GoApi.file_cache_read(uri, destination) parsed = pase_response(d) display_response(parsed) return FileReadResult.new(parsed) end |
#file_cache_write(filename) ⇒ Object
396 397 398 399 400 401 |
# File 'lib/meshx-plugin-sdk.rb', line 396 def file_cache_write(filename) d, e = GoApi.file_cache_write(filename) parsed = pase_response(d) display_response(parsed) return FileWriteResult.new(parsed) end |
#get_exit ⇒ Object
344 345 346 |
# File 'lib/meshx-plugin-sdk.rb', line 344 def get_exit() return @exit end |
#get_messages ⇒ Object
361 362 363 364 365 366 |
# File 'lib/meshx-plugin-sdk.rb', line 361 def () d, e = GoApi.() parsed = pase_response(d) display_response(parsed) return GetMessageResult.new(parsed) end |
#pase_response(response) ⇒ Object
348 349 350 351 352 353 |
# File 'lib/meshx-plugin-sdk.rb', line 348 def pase_response(response) data = JSON.parse(response) rtn = Response.new(data["payload"], data["error"], data["exit_code"]) return rtn end |
#send_complete_events ⇒ Object
403 404 405 406 407 408 |
# File 'lib/meshx-plugin-sdk.rb', line 403 def send_complete_events() d, e = GoApi.send_complete_events() parsed = pase_response(d) display_response(parsed) return SendCompleteResult.new(parsed) end |
#send_file_event(path, filename, originalpath, origin) ⇒ Object
375 376 377 378 379 380 |
# File 'lib/meshx-plugin-sdk.rb', line 375 def send_file_event(path, filename, originalpath, origin) d, e = GoApi.send_file_event(path, filename, originalpath, origin) parsed = pase_response(d) display_response(parsed) return SendMessageResult.new(parsed) end |
#send_folder_event(path, folder, originalpath, origin) ⇒ Object
382 383 384 385 386 387 |
# File 'lib/meshx-plugin-sdk.rb', line 382 def send_folder_event(path, folder, originalpath, origin) d, e = GoApi.send_folder_event(path, folder, originalpath, origin) parsed = pase_response(d) display_response(parsed) return SendFolderResult.new(parsed) end |
#send_message(data) ⇒ Object
368 369 370 371 372 373 |
# File 'lib/meshx-plugin-sdk.rb', line 368 def (data) d, e = GoApi.(data) parsed = pase_response(d) display_response(parsed) return SendMessageResult.new(parsed) end |