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.



7
8
9
10
11
# File 'lib/openpull/pull_request_fetcher.rb', line 7

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

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



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

def client
  @client
end

#organisationObject (readonly)

Returns the value of attribute organisation.



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

def organisation
  @organisation
end

#usernameObject (readonly)

Returns the value of attribute username.



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

def username
  @username
end

Instance Method Details

#fetchObject



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

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