Class: KrakendOpenAPI::ImportCommand

Inherits:
Object
  • Object
show all
Defined in:
lib/commands/import.rb

Overview

Import Command

Instance Method Summary collapse

Constructor Details

#initialize(spec:, syntax:, config:) ⇒ ImportCommand

Returns a new instance of ImportCommand.



11
12
13
14
15
16
17
# File 'lib/commands/import.rb', line 11

def initialize(spec:, syntax:, config:)
  @spec = spec
  @syntax = syntax
  @config = config

  @importer_config = YAML.safe_load(File.read("#{Dir.pwd}/#{@config}"))
end

Instance Method Details

#executeObject



19
20
21
22
23
# File 'lib/commands/import.rb', line 19

def execute
  paths = OA3Reader.new(@spec).paths
  endpoints = OA3ToKrakendTransformer.new(paths, @importer_config).transform_paths
  KrakendWriter.new(endpoints, @importer_config).write
end