Sha256: 696373a7040fb9ed687e50581fc2a1cbe919d8503c92c1cb2087b1464314843b

Contents?: true

Size: 912 Bytes

Versions: 47

Compression:

Stored size: 912 Bytes

Contents

# frozen_string_literal: true

require_relative 'base'
require_relative 'label'
require 'date'
require 'time'

module Gitlab
  module Triage
    module Resource
      class LabelEvent < Base
        FIELDS = %i[
          id
          user
          resource_type
          resource_id
          action
        ].freeze

        TIME_FIELDS = %i[
          created_at
        ].freeze

        FIELDS.each do |field|
          define_field(field) do
            resource[field]
          end
        end

        TIME_FIELDS.each do |field|
          define_field(field) do
            value = resource[field]

            Time.parse(value) if value
          end
        end

        def label
          return unless resource[:label]

          @label ||= Label.new(
            resource[:label].reverse_merge(added_at: resource[:created_at]),
            parent: self)
        end
      end
    end
  end
end

Version data entries

47 entries across 47 versions & 2 rubygems

Version Path
gitlab-triage-1.44.1 lib/gitlab/triage/resource/label_event.rb
gitlab-triage-1.44.0 lib/gitlab/triage/resource/label_event.rb
gitlab-triage-1.43.2 lib/gitlab/triage/resource/label_event.rb
gitlab-triage-1.43.1 lib/gitlab/triage/resource/label_event.rb
gitlab-triage-1.43.0 lib/gitlab/triage/resource/label_event.rb
gitlab-triage-1.42.2 lib/gitlab/triage/resource/label_event.rb
gitlab-triage-1.42.1 lib/gitlab/triage/resource/label_event.rb
gitlab-triage-1.42.0 lib/gitlab/triage/resource/label_event.rb
gitlab-triage-1.41.0 lib/gitlab/triage/resource/label_event.rb
gitlab-triage-1.40.0 lib/gitlab/triage/resource/label_event.rb
gitlab-triage-1.30.0 lib/gitlab/triage/resource/label_event.rb
gitlab-triage-1.29.0 lib/gitlab/triage/resource/label_event.rb
payping-gitlab-triage-0.1.3 lib/gitlab/triage/resource/label_event.rb
payping-gitlab-triage-0.1.2 lib/gitlab/triage/resource/label_event.rb
payping-gitlab-triage-0.1.1 lib/gitlab/triage/resource/label_event.rb
gitlab-triage-1.28.0 lib/gitlab/triage/resource/label_event.rb
gitlab-triage-1.27.0 lib/gitlab/triage/resource/label_event.rb
gitlab-triage-1.26.0 lib/gitlab/triage/resource/label_event.rb
gitlab-triage-1.25.0 lib/gitlab/triage/resource/label_event.rb
gitlab-triage-1.24.0 lib/gitlab/triage/resource/label_event.rb