Class: Neoneo::Task
- Inherits:
-
Object
- Object
- Neoneo::Task
- Defined in:
- lib/neoneo.rb
Overview
Represents a No Kahuna task
At the moment this class is read-only in regards of it’s description. But you can close or reopen a task. This will be improved as soon as possible!
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#project ⇒ Object
readonly
Returns the value of attribute project.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
- #category ⇒ Object
- #close! ⇒ Object
- #closed? ⇒ Boolean
- #description ⇒ Object
-
#initialize(id, description, category, user, project, done = false) ⇒ Task
constructor
A new instance of Task.
- #reopen! ⇒ Object
- #url(appendix = '') ⇒ Object
Constructor Details
#initialize(id, description, category, user, project, done = false) ⇒ Task
Returns a new instance of Task.
424 425 426 427 428 429 430 431 432 433 |
# File 'lib/neoneo.rb', line 424 def initialize(id, description, category, user, project, done = false) @id = id @description = description @category = category @user = user @project = project @done = done @uncertain = @description =~ /\.{3}$/ end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
422 423 424 |
# File 'lib/neoneo.rb', line 422 def id @id end |
#project ⇒ Object (readonly)
Returns the value of attribute project.
422 423 424 |
# File 'lib/neoneo.rb', line 422 def project @project end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
422 423 424 |
# File 'lib/neoneo.rb', line 422 def user @user end |
Instance Method Details
#category ⇒ Object
440 441 442 443 444 |
# File 'lib/neoneo.rb', line 440 def category build_category! unless @category @category end |
#close! ⇒ Object
450 451 452 453 454 455 456 457 |
# File 'lib/neoneo.rb', line 450 def close! page = @project.user.agent.get(url) form = page.forms.last authenticity_token = form.authenticity_token @project.user.agent.post(url('done'), :authenticity_token => authenticity_token, '_method'.to_sym => 'put') @done = true end |
#closed? ⇒ Boolean
470 471 472 |
# File 'lib/neoneo.rb', line 470 def closed? @done end |
#description ⇒ Object
435 436 437 438 |
# File 'lib/neoneo.rb', line 435 def description build_description! if @uncertain @description end |
#reopen! ⇒ Object
459 460 461 462 463 464 465 466 467 468 |
# File 'lib/neoneo.rb', line 459 def reopen! return unless @done page = @project.user.agent.get(url) form = page.forms.last authenticity_token = form.authenticity_token @project.user.agent.post(url('not_done'), :authenticity_token => authenticity_token, '_method'.to_sym => 'put') @done = false end |
#url(appendix = '') ⇒ Object
446 447 448 |
# File 'lib/neoneo.rb', line 446 def url(appendix = '') @project.url("tasks/#{@id}/#{appendix}") end |