Class: OpenPull::PullRequestFetcher

Inherits:
Object
  • Object
show all
Defined in:
lib/openpull/pull_request_fetcher.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client, organisation, username = '') ⇒ PullRequestFetcher

Returns a new instance of PullRequestFetcher.



5
6
7
8
9
# File 'lib/openpull/pull_request_fetcher.rb', line 5

def initialize(client, organisation, username = '')
  @client       = client
  @organisation = organisation
  @username     = username
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



3
4
5
# File 'lib/openpull/pull_request_fetcher.rb', line 3

def client
  @client
end

#organisationObject (readonly)

Returns the value of attribute organisation.



3
4
5
# File 'lib/openpull/pull_request_fetcher.rb', line 3

def organisation
  @organisation
end

#usernameObject (readonly)

Returns the value of attribute username.



3
4
5
# File 'lib/openpull/pull_request_fetcher.rb', line 3

def username
  @username
end

Instance Method Details

#fetchObject



11
12
13
14
15
16
17
# File 'lib/openpull/pull_request_fetcher.rb', line 11

def fetch
  repos = client.org_repos(organisation).map do |repository|
    Thread.new { fetch_pull_requests(repository) }
  end.map(&:value)

  repos.reject { |v| v.nil? || v.empty? }
end