Sha256: 20465650ad03ee9919fe766f4c5d0c27dc57299532110e12663cacf43542de73
Contents?: true
Size: 838 Bytes
Versions: 5
Compression:
Stored size: 838 Bytes
Contents
class Evil::Client # # Resolves request URI from operation settings and schema # @private # class Resolver::Uri < Resolver private def initialize(schema, settings) super schema, settings, :path end def __call__ super do parts = __blocks__.map { |block| instance_exec(&block)&.to_s } path = File.join(parts) __uri__(path).tap { |uri| __check__(uri) } end end def __uri__(path) URI path rescue StandardError => error raise __definition_error__(error.message) end def __check__(uri) scheme = uri.scheme details = "base url should be defined" unless scheme details ||= "base url should use HTTP(S). '#{scheme}' used instead" raise __definition_error__(details) unless scheme&.match(/^https?$/) end end end
Version data entries
5 entries across 5 versions & 1 rubygems