class IIB::Node::REST
Attributes
port[R]
Public Class Methods
new(options)
click to toggle source
# File lib/iib/node/REST.rb, line 25 def initialize(options) @hostname = options[:hostname] @port = options[:port] end
Public Instance Methods
name()
click to toggle source
# File lib/iib/node/REST.rb, line 30 def name rest_json = get_rest_json rest_json["name"] end
start()
click to toggle source
# File lib/iib/node/REST.rb, line 35 def start action_not_remotable end
stop()
click to toggle source
# File lib/iib/node/REST.rb, line 39 def stop action_not_remotable end
Private Instance Methods
action_not_remotable()
click to toggle source
# File lib/iib/node/REST.rb, line 63 def action_not_remotable fail RuntimeError, "This action is not available on a remote Integration Node" end
get_rest_json()
click to toggle source
# File lib/iib/node/REST.rb, line 45 def get_rest_json return @rest_json if !@rest_json.nil? @rest_json = top_level_rest_call end
top_level_rest_call()
click to toggle source
# File lib/iib/node/REST.rb, line 50 def top_level_rest_call uri = URI.parse("http://#{@hostname}:#{@port}/?depth=2") request = Net::HTTP::Get.new(uri.to_s) request.add_field('Accept', 'application/json') response = Net::HTTP.new(uri.host, uri.port).start do |http| http.request(request) end JSON.parse(response.body) end