Sha256: a9ebe4742fc41bc7652a4484350955be79c8c3dfb4b17afe8662ad9c1079e823
Contents?: true
Size: 788 Bytes
Versions: 33
Compression:
Stored size: 788 Bytes
Contents
module Gitea module Api class Config < Common::Struct::Base attrs :domain, :base_url, :username, :password, :token, :open_timeout, :read_timeout def initialize(opts = {}) super(opts) valid! normalize_domain end private def valid! if @domain.nil? || @base_url.nil? fail Exception, "@domain, @base_url not permit blank." end end def normalize_domain uri = URI.parse(domain) uri = URI.parse(domain) uri = URI.parse("http://#{domain}") unless uri.scheme if uri.scheme != 'http' and uri.scheme != 'https' fail ClientError, "Only HTTP and HTTPS domain are accepted." end @domain = uri end end end # Common end # Gitea
Version data entries
33 entries across 33 versions & 1 rubygems