Sha256: e1f07fa753ea6c537d2de7f9cfcea061012d6f76a0fbba2b420ce8fd31d962cd

Contents?: true

Size: 625 Bytes

Versions: 9

Compression:

Stored size: 625 Bytes

Contents

module HubLink
  module Api
    class Review < SimpleDelegator
      BOTS = %w(houndci-bot cookpad-devel)

      def reviewer
        user.login
      end

      def approval?
        state == "APPROVED"
      end

      def invalid?
        bot? || driveby? || draft?
      end

      def to_h
        Slicer.new(self, columns: %i(id pull_request_id submitted_at reviewer approval?)).to_h
      end

      private

        def bot?
          BOTS.include?(user.login)
        end

        def driveby?
          state == "COMMENTED"
        end

        def draft?
          state == "PENDING"
        end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
hub_link-0.9.0 lib/hub_link/api/review.rb
hub_link-0.8.0 lib/hub_link/api/review.rb
hub_link-0.7.0 lib/hub_link/api/review.rb
hub_link-0.6.0 lib/hub_link/api/review.rb
hub_link-0.5.0 lib/hub_link/api/review.rb
hub_link-0.4.0 lib/hub_link/api/review.rb
hub_link-0.3.0 lib/hub_link/api/review.rb
hub_link-0.2.0 lib/hub_link/api/review.rb
hub_link-0.1.0 lib/hub_link/api/review.rb