Class: Phabricator::Maniphest::Task

Inherits:
Object
  • Object
show all
Defined in:
lib/phabricator/maniphest/task.rb

Defined Under Namespace

Modules: Priority

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes) ⇒ Task

Returns a new instance of Task.



44
45
46
47
48
49
# File 'lib/phabricator/maniphest/task.rb', line 44

def initialize(attributes)
  @id = attributes['id']
  @title = attributes['title']
  @description = attributes['description']
  @priority = attributes['priority']
end

Instance Attribute Details

#descriptionObject

Returns the value of attribute description.



27
28
29
# File 'lib/phabricator/maniphest/task.rb', line 27

def description
  @description
end

#idObject (readonly)

Returns the value of attribute id.



26
27
28
# File 'lib/phabricator/maniphest/task.rb', line 26

def id
  @id
end

#priorityObject

Returns the value of attribute priority.



27
28
29
# File 'lib/phabricator/maniphest/task.rb', line 27

def priority
  @priority
end

#titleObject

Returns the value of attribute title.



27
28
29
# File 'lib/phabricator/maniphest/task.rb', line 27

def title
  @title
end

Class Method Details

.create(title, description = nil, projects = [], priority = 'normal', other = {}) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/phabricator/maniphest/task.rb', line 29

def self.create(title, description=nil, projects=[], priority='normal', other={})
  response = JSON.parse(client.request(:post, 'maniphest.createtask', {
    title: title,
    description: description,
    priority: Priority.send(priority),
    projectPHIDs: projects.map {|p| Phabricator::Project.find_by_name(p).phid }
  }.merge(other)))

  data = response['result']

  # TODO: Error handling

  self.new(data)
end