Sha256: 74e1e6cd3c6e15baf3d4983bfd708fd5c4691ca6c02214eed013e759dbcf8d59

Contents?: true

Size: 489 Bytes

Versions: 2

Compression:

Stored size: 489 Bytes

Contents

module HubLink
  class Batch
    attr_reader :query

    def initialize(query)
      @query = query
    end

    def fetch(resource)
      public_send(resource)
    end

    def pull_requests
      results.map(&:to_h)
    end

    def reviews
      results.flat_map(&:reviews).map(&:to_h)
    end

    def review_requests
      results.flat_map(&:review_requests).map(&:to_h)
    end

    private

      def results
        @_results ||= Api::PullRequest.search(query)
      end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
hub_link-0.12.0 lib/hub_link/batch.rb
hub_link-0.11.0 lib/hub_link/batch.rb