Sha256: 95b0c4ef88389e2452ce14f9324c3e23e2eed519d9ac861252bc6b138ab2c8aa

Contents?: true

Size: 857 Bytes

Versions: 11

Compression:

Stored size: 857 Bytes

Contents

require 'pra/config'
require 'pra/pull_source_factory'
require 'pra/pull_request_service/fetch_status'

module Pra
  module PullRequestService
    def self.fetch_pull_requests
      pull_sources.each do |pull_source|
        yield fetch_with_status(pull_source)
      end
    end

    def self.fetch_with_status(pull_source)
      pull_requests = pull_source.pull_requests
      FetchStatus.success(pull_requests)
    rescue Exception => error
      FetchStatus.error(error)
    end

    def self.pull_sources
      config = Pra::Config.load_config
      return map_config_to_pull_sources(config)
    end

    def self.map_config_to_pull_sources(config)
      sources = []
      config.pull_sources.each do |pull_source_config|
        sources << Pra::PullSourceFactory.build_pull_source(pull_source_config)
      end
      return sources
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
pra-1.7.2 lib/pra/pull_request_service.rb
pra-1.7.1 lib/pra/pull_request_service.rb
pra-1.7.0 lib/pra/pull_request_service.rb
pra-1.6.0 lib/pra/pull_request_service.rb
pra-1.5.1 lib/pra/pull_request_service.rb
pra-1.5.0 lib/pra/pull_request_service.rb
pra-1.4.0 lib/pra/pull_request_service.rb
pra-1.3.0 lib/pra/pull_request_service.rb
pra-1.2.0 lib/pra/pull_request_service.rb
pra-1.1.0 lib/pra/pull_request_service.rb
pra-1.0.0 lib/pra/pull_request_service.rb