Sha256: 94f9bb170b5c0b8206da637a6c9b4ac2e1c5abe987810efb3bf3ab4e5bd021f9
Contents?: true
Size: 706 Bytes
Versions: 2
Compression:
Stored size: 706 Bytes
Contents
# frozen_string_literal: true module Zilla::ClientFactory class UnsupportedVersion < Zilla::Error; end CLIENTS = { "2.0" => Zilla::Versions::V20::Client }.freeze class << self def build(input, host: nil, scheme: nil, faraday_config: {}, &block) definition = Zilla::LoaderFactory.build(input, faraday_config:, &block).load version = definition["swagger"] raise ArgumentError, "#{input.inspect} is not an OpenAPI definition" if version.nil? raise UnsupportedVersion, "usupported version #{version.inspect}" if version && CLIENTS[version].nil? CLIENTS[version].new(definition, host:, scheme:, faraday_config:, faraday_config_block: block) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
zilla-0.1.5 | lib/zilla/client_factory.rb |
zilla-0.1.4 | lib/zilla/client_factory.rb |