Sha256: 08314eb7bc60bffee3d4fbff149ae4236470bf30e7aa020574400957f379f552
Contents?: true
Size: 652 Bytes
Versions: 2
Compression:
Stored size: 652 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, &block) definition = Zilla::LoaderFactory.build(input, &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_block: block) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
zilla-0.1.3 | lib/zilla/client_factory.rb |
zilla-0.1.2 | lib/zilla/client_factory.rb |