Class: TransportAPI

Inherits:
Sinatra::Base
  • Object
show all
Defined in:
lib/bolt_ext/server.rb

Instance Method Summary collapse

Constructor Details

#initialize(app = nil) ⇒ TransportAPI

Returns a new instance of TransportAPI.



13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/bolt_ext/server.rb', line 13

def initialize(app = nil)
  @schemas = {
    "ssh-run_task" => JSON.parse(File.read(File.join(__dir__, 'schemas', 'ssh-run_task.json'))),
    "winrm-run_task" => JSON.parse(File.read(File.join(__dir__, 'schemas', 'winrm-run_task.json')))
  }
  shared_schema = JSON::Schema.new(JSON.parse(File.read(File.join(__dir__, 'schemas', 'task.json'))),
                                   Addressable::URI.parse("file:task"))
  JSON::Validator.add_schema(shared_schema)

  @executor = Bolt::Executor.new(0, load_config: false)

  super(app)
end