Sha256: 03b34a7f24ac59cea9da4fd873e5901c1b543054226e6872fe3d10b3c72f5528

Contents?: true

Size: 1.25 KB

Versions: 7

Compression:

Stored size: 1.25 KB

Contents

require 'universal-git-client/normalizers/base'

module UniversalGitClient
  module Normalizers
    class Gitlab < Base
      class UserSerializer < BaseSerializer
        attribute :login, &:username
        attributes :name, :avatar_url
      end

      class OrganizationSerializer < BaseSerializer
        attributes :avatar_url
        attribute :login, &:full_path
      end

      class RepositorySerializer < BaseSerializer
        attributes :name, :archived, :default_branch
        attribute :full_name, &:path_with_namespace
        attribute :full_path, &:path_with_namespace

        attribute :private do |object|
          case object.visibility
          when 'private'
            true
          else
            false
          end
        end
      end

      class BranchSerializer < BaseSerializer
        set_id :name
        attributes :name, :protected

        attribute :commit do |object|
          object.commit.id
        end
      end

      class WebhookSerializer < BaseSerializer
        attributes :url
        attribute(:active) { true }
        attribute(:type) { 'Repository' }

        attribute :events do |object|
          events = []
          events << 'push' if object.push_events
          events
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
universal-git-client-2.2.0 lib/universal-git-client/normalizers/gitlab.rb
universal-git-client-2.1.0 lib/universal-git-client/normalizers/gitlab.rb
universal-git-client-2.0.0 lib/universal-git-client/normalizers/gitlab.rb
universal-git-client-1.2.12 lib/universal-git-client/normalizers/gitlab.rb
universal-git-client-1.2.10 lib/universal-git-client/normalizers/gitlab.rb
universal-git-client-1.2.9 lib/universal-git-client/normalizers/gitlab.rb
universal-git-client-1.2.4 lib/universal-git-client/normalizers/gitlab.rb