Class: Viewpoint::SPWS::Types::TasksList

Inherits:
List
  • Object
show all
Includes:
Viewpoint::SPWS::Types
Defined in:
lib/viewpoint/spws/types/tasks_list.rb

Overview

This class represents a Sharepoint List returned from the Lists Web Service with a ServerTemplate id of 107 (Tasks).

Constant Summary

Constants included from Viewpoint::SPWS::Types

PRIORITY, STATUS

Instance Attribute Summary

Attributes inherited from List

#created, #description, #feature_id, #guid, #modified, #root_folder, #server_template, #title

Instance Method Summary collapse

Methods inherited from List

#delete!, #get_item, #hidden?, #initialize, #items, #path

Constructor Details

This class inherits a constructor from Viewpoint::SPWS::Types::List

Instance Method Details

#add_item!(opts) ⇒ Viewpoint::SPWS::Types::ListItem

Add a Task to this List

Parameters:

  • opts (Hash)

    parameters for this Task

Options Hash (opts):

  • :title (String)

    The title of this Task

  • :due_date (DateTime)

    The date in which this Task is due

  • :priority (Symbol)

    The priority of the Task :high, :normal, :low

  • :status (Symbol)

    The status of the Task :not_started, :in_progress, :completed, :deferred, :waiting

  • :percent_complete (Fixnum)

    The percentage of completion. Must be a number from 0 to 100.

Returns:



36
37
38
39
40
41
42
43
44
45
46
# File 'lib/viewpoint/spws/types/tasks_list.rb', line 36

def add_item!(opts)
  raise "Title argument required" unless opts[:title]
  topts = opts.clone
  topts[:priority] = :normal unless topts[:priority]
  topts[:status]   = :not_started unless topts[:status]
  if(topts[:percent_complete] && !(0..100).include?(topts[:percent_complete]))
    raise "Invalid :percent_complete #{topts[:percent_complete]}"
  end

  super(topts)
end