Class: Zillabyte::API::Components
- Defined in:
- lib/zillabyte/api/components.rb
Instance Method Summary collapse
-
#get(id, options = {}) ⇒ Object
GET /components/id.
-
#get_rpc_results(id, options = {}) ⇒ Object
GET /components/id/execute.
-
#list(options = {}) ⇒ Object
GET /apps.
-
#rpc(id, options = {}) ⇒ Object
POST /components/id/execute.
Methods inherited from Flows
#create_delete, #create_kill, #create_pause, #create_resume, #create_scale, #delete, #get_meta, #poll_delete, #poll_kill, #poll_pause, #poll_resume, #poll_scale, #pull_to_directory, #push_directory
Methods inherited from Base
Methods included from Helpers
#app, #ask, #command, #create_git_remote, #display, #error, #extract_app_from_git_config, #extract_app_in_dir, #format_with_bang, #friendly_dir, #get_flow_ui_link, #get_info, #get_rich_info, #git, #handle_downloading_manifest, #has_git?, #longest, #read_multiline, #truncate_message, #version_okay?, #with_tty
Constructor Details
This class inherits a constructor from Zillabyte::API::Base
Instance Method Details
#get(id, options = {}) ⇒ Object
GET /components/id
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/zillabyte/api/components.rb', line 54 def get(id, = {}) = { # TODO }.merge() res = @api.request( :expects => 200, :method => :get, :path => "/components/#{id}", :body => .to_json ) res.body end |
#get_rpc_results(id, options = {}) ⇒ Object
GET /components/id/execute
86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/zillabyte/api/components.rb', line 86 def get_rpc_results(id, = {}) res = @api.request( :expects => 200, :method => :get, :path => "/components/#{id}/execute", :body => .to_json ) res.body end |
#list(options = {}) ⇒ Object
GET /apps
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/zillabyte/api/components.rb', line 7 def list( = {}) = { # TODO }.merge() res = @api.request( :expects => 200, :method => :get, :path => "/components", :body => .to_json ) body = res.body body.map do |component| next if component["nodes"].nil? inputs = "" outputs = "" nodes = component["nodes"] next if nodes.nil? nodes.each do |node| if node["type"] == "input" or node["type"] == "source" inputs += "#{node["name"]}:\n" next if node["fields"].nil? node["fields"].each do |field| inputs += " (#{field.keys[0]}, #{field.values[0].upcase})\n" end elsif node["type"] == "output" or node["type"] == "sink" outputs += "#{node["name"]}:\n" next if node["columns"].nil? node["columns"].each do |field| outputs += " (#{field.keys[0]}, #{field.values[0].upcase})\n" end end end component["inputs"] = inputs component["outputs"] = outputs end body end |
#rpc(id, options = {}) ⇒ Object
POST /components/id/execute
73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/zillabyte/api/components.rb', line 73 def rpc(id, = {}) res = @api.request( :expects => 200, :method => :post, :path => "/components/#{id}/execute", :body => .to_json ) res.body end |