Class: HowIs::Fetcher

Inherits:
Object
  • Object
show all
Includes:
Contracts::Core
Defined in:
lib/how_is/fetcher.rb

Overview

Fetches data from GitHub.

Defined Under Namespace

Classes: Results

Instance Method Summary collapse

Instance Method Details

#call(repository, github = nil) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/how_is/fetcher.rb', line 28

def call(repository,
      github = nil)
  github ||= Github.new(auto_pagination: true)
  user, repo = repository.split('/', 2)
  issues  = github.issues.list user: user, repo: repo
  pulls   = github.pulls.list  user: user, repo: repo

  Results.new(
    repository,
    obj_to_array_of_hashes(issues),
    obj_to_array_of_hashes(pulls)
  )
end