Class: GithubAPIAdapter
- Inherits:
-
Object
- Object
- GithubAPIAdapter
- Defined in:
- lib/backup-github.rb
Constant Summary collapse
- @@ISSUE_STATES =
%w{open closed}
Instance Method Summary collapse
- #has_issues?(reponame) ⇒ Boolean
-
#initialize(client) ⇒ GithubAPIAdapter
constructor
A new instance of GithubAPIAdapter.
- #on_issues(reponame, &block) ⇒ Object
- #repositories(orgname) ⇒ Object
Constructor Details
#initialize(client) ⇒ GithubAPIAdapter
Returns a new instance of GithubAPIAdapter.
82 83 84 |
# File 'lib/backup-github.rb', line 82 def initialize(client) @client = client end |
Instance Method Details
#has_issues?(reponame) ⇒ Boolean
86 87 88 |
# File 'lib/backup-github.rb', line 86 def has_issues?(reponame) @client.repository(reponame).has_issues end |
#on_issues(reponame, &block) ⇒ Object
90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/backup-github.rb', line 90 def on_issues(reponame, &block) @@ISSUE_STATES.each do |status| page = 0 begin issues = @client.list_issues( reponame, :page => page, :state => status ) issues.each do |issue| yield Issue.new(issue.number, @client.issue(reponame, issue.number)) end page += 1 end until issues.length != 10 end end |
#repositories(orgname) ⇒ Object
104 105 106 |
# File 'lib/backup-github.rb', line 104 def repositories(orgname) @client.repositories(orgname) end |