Class: Todoplicator::GitHubAdapter

Inherits:
Object
  • Object
show all
Defined in:
lib/todoplicator/git_hub_adapter.rb

Defined Under Namespace

Classes: Issue

Instance Method Summary collapse

Constructor Details

#initialize(target) ⇒ GitHubAdapter

Returns a new instance of GitHubAdapter.



37
38
39
# File 'lib/todoplicator/git_hub_adapter.rb', line 37

def initialize(target)
  @target = target
end

Instance Method Details

#create_issue(issue) ⇒ Object



45
46
47
48
49
# File 'lib/todoplicator/git_hub_adapter.rb', line 45

def create_issue(issue)
  new_issue = Issue.new(client.create_issue(@target, issue.title, issue.body))
  new_issue = Issue.new(client.close_issue(@target, new_issue.raw.number)) if issue.closed?
  new_issue
end

#find_issuesObject



41
42
43
# File 'lib/todoplicator/git_hub_adapter.rb', line 41

def find_issues
  client.list_issues(@target, state: :all).map { |i| Issue.new(i) }
end