Sha256: dd8772c81e7c4e751ea107ca490d5a402f48de51ac134f76653abefddc7f1fd1

Contents?: true

Size: 821 Bytes

Versions: 6

Compression:

Stored size: 821 Bytes

Contents

module HubLink
  module Api
    class ReviewRequest
      require "digest/sha1"

      attr_reader :reviewer, :requester, :created_at, :pull_request_id

      def initialize(reviewer:, requester:, created_at:, pull_request_id:)
        @reviewer = reviewer
        @requester = requester
        @created_at = created_at
        @pull_request_id = pull_request_id
      end

      # API doesn't return IDs for review requests https://developer.github.com/v3/pulls/review_requests/#list-review-requests
      def digest
        Digest::SHA1.hexdigest(digest_components.join)
      end

      def to_h
        Slicer.new(self, columns: %i(digest reviewer requester created_at pull_request_id)).to_h
      end

      private

        def digest_components
          [pull_request_id, reviewer]
        end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
hub_link-0.18.0 lib/hub_link/api/review_request.rb
hub_link-0.15.0 lib/hub_link/api/review_request.rb
hub_link-0.13.0 lib/hub_link/api/review_request.rb
hub_link-0.12.0 lib/hub_link/api/review_request.rb
hub_link-0.11.0 lib/hub_link/api/review_request.rb
hub_link-0.10.0 lib/hub_link/api/review_request.rb