Sha256: 5920e2583fd5ac2704662dbd574a14369ee3ef1edbb50a0c95cd436f17e7b220

Contents?: true

Size: 879 Bytes

Versions: 3

Compression:

Stored size: 879 Bytes

Contents

require 'universal-git-client/client'
require 'universal-git-client/http/github'
require 'universal-git-client/http/gitlab'
require 'universal-git-client/http/bitbucket'
require 'universal-git-client/http/bitbucket_server'

module UniversalGitClient
  class ClientFactory
    class << self
      def build(provider, **args)
        case provider
        when :github
          Client.new('GitHub', UniversalGitClient::Http::Github.new(**args))
        when :gitlab
          Client.new('GitLab', UniversalGitClient::Http::Gitlab.new(**args))
        when :bitbucket
          Client.new('Bitbucket', UniversalGitClient::Http::Bitbucket.new(**args))
        when :bitbucket_server
          Client.new('Bitbucket Server', UniversalGitClient::Http::BitbucketServer.new(**args))
        else
          raise ArgumentError, 'Unknown provider'
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
universal-git-client-2.2.0 lib/universal-git-client/client_factory.rb
universal-git-client-2.1.0 lib/universal-git-client/client_factory.rb
universal-git-client-2.0.0 lib/universal-git-client/client_factory.rb