Sha256: 8a43a56b79775eb72d5ccac1e43a7d59d9326d17b4115c69aa651d0fe0a1d51a
Contents?: true
Size: 858 Bytes
Versions: 5
Compression:
Stored size: 858 Bytes
Contents
module OasParser class Definition include OasParser::RawAccessor raw_keys :info, :servers, :components, :openapi attr_reader :path attr_accessor :raw def self.resolve(path) raw = Parser.resolve(path) Definition.new(raw, path) end def initialize(raw, path) @raw = raw @path = path end def format File.extname(@path).sub('.', '') end def paths raw['paths'].map do |path, definition| OasParser::Path.new(self, path, definition) end end def path_by_path(path) definition = raw['paths'][path] raise StandardError.new('So such path exists') unless definition OasParser::Path.new(self, path, definition) end def security raw['security'] || [] end def endpoints paths.flat_map(&:endpoints) end end end
Version data entries
5 entries across 5 versions & 1 rubygems