Class: Gitcamp::Basecamp::Todo

Inherits:
Object
  • Object
show all
Defined in:
lib/gitcamp/basecamp/todo.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Todo

Returns a new instance of Todo.



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/gitcamp/basecamp/todo.rb', line 6

def initialize(options = {})
  unless options[:issue]
    raise ArgumentError, 'no GitHub Issue given'
  end

  @list = options[:list]
  @issue = options[:issue]

  @title = @issue.title.gsub(/\[[\d\.]*\]\s+/, '')
  @title = "##{issue.number} #{@title}"
end

Instance Attribute Details

#descriptionObject (readonly)

Returns the value of attribute description.



4
5
6
# File 'lib/gitcamp/basecamp/todo.rb', line 4

def description
  @description
end

#issueObject (readonly)

Returns the value of attribute issue.



4
5
6
# File 'lib/gitcamp/basecamp/todo.rb', line 4

def issue
  @issue
end

#itemObject (readonly)

Returns the value of attribute item.



4
5
6
# File 'lib/gitcamp/basecamp/todo.rb', line 4

def item
  @item
end

#listObject (readonly)

Returns the value of attribute list.



4
5
6
# File 'lib/gitcamp/basecamp/todo.rb', line 4

def list
  @list
end

#titleObject (readonly)

Returns the value of attribute title.



4
5
6
# File 'lib/gitcamp/basecamp/todo.rb', line 4

def title
  @title
end

Instance Method Details

#saveObject



18
19
20
21
22
23
24
25
26
# File 'lib/gitcamp/basecamp/todo.rb', line 18

def save
  find_or_build_todo

  if item.save
    say "Processed todo #{title} in Basecamp"
  end

  create_or_update_comment
end