Class: XPlanner::Iteration

Inherits:
ModelHelper show all
Extended by:
AttrAccessorWithDirtyBit
Defined in:
lib/models/iteration.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from AttrAccessorWithDirtyBit

dirty_accessor

Methods inherited from ModelHelper

base_url, base_url=, check_client_initialised, #check_client_initialised, #create_payload, fetch_from_remote, #hashify, parse_date, remote_delete, #remote_update, soap_client, soap_client=

Constructor Details

#initialize(iter) ⇒ Iteration

Returns a new instance of Iteration.



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/models/iteration.rb', line 24

def initialize( iter )
  @dirty_bit = false

  @id                         = iter[:id]
  @name                       = iter[:name]
  @description                = iter[:description]
  @project_id                 = iter[:project_id]
  @status_key                 = iter[:status_key]
  @actual_hours               = iter[:actual_hours]
  @added_hours                = iter[:added_hours]
  @adjusted_estimated_hours   = iter[:adjusted_estimated_hours]
  @days_worked                = iter[:days_worked]
  @estimated_hours            = iter[:estimated_hours]
  @overestimated_hours        = iter[:overestimated_hours]
  @postponed_hours            = iter[:postponed_hours]
  @remaining_hours            = iter[:remaining_hours]
  @start_date                 = Iteration.parse_date iter[:start_date]
  @end_date                   = Iteration.parse_date iter[:end_date]
  @last_update_time           = Iteration.parse_date iter[:last_update_time]
  @underestimated_hours       = iter[:underestimated_hours]
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



20
21
22
# File 'lib/models/iteration.rb', line 20

def id
  @id
end

#last_update_timeObject (readonly)

Returns the value of attribute last_update_time.



20
21
22
# File 'lib/models/iteration.rb', line 20

def last_update_time
  @last_update_time
end

Class Method Details

.all(project_id) ⇒ Object



46
47
48
49
50
51
# File 'lib/models/iteration.rb', line 46

def self.all( project_id )
  rpc = :get_iterations
  payload = { :projectId => project_id }
  path = [:get_iterations_response, :get_iterations_return, :get_iterations_return]
  fetch_from_remote( rpc, payload, path, Iteration )
end

.create(project_id, name, description, start_date, end_date) ⇒ Object

needs status setting



61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/models/iteration.rb', line 61

def self.create( project_id, name, description, start_date, end_date )
  rpc = :add_iteration
  payload = { 
    :iterationData => {
      :project_id => project_id, 
      :name => name, 
      :description => description, 
      :start_date => start_date, 
      :end_date => end_date,
      :status_key => 'inactive'
    } 
  }
  path = [:add_iteration_response, :add_iteration_return]
  fetch_from_remote( rpc, payload, path, Iteration )
end

.delete(id) ⇒ Object



77
78
79
80
81
# File 'lib/models/iteration.rb', line 77

def self.delete( id )
  rpc = :remove_iteration
  payload = { :id => id }
  remote_delete( rpc, payload )
end

.retrieve(iteration_id) ⇒ Object



53
54
55
56
57
58
# File 'lib/models/iteration.rb', line 53

def self.retrieve( iteration_id )
  rpc = :get_iteration
  payload = { :iterationId => iteration_id }
  path = [:get_iteration_response, :get_iteration_return]
  fetch_from_remote( rpc, payload, path, Iteration )
end

Instance Method Details

#deleteObject



83
84
85
# File 'lib/models/iteration.rb', line 83

def delete
  Iteration.delete( @id )
end

#saveObject



87
88
89
90
91
# File 'lib/models/iteration.rb', line 87

def save
  rpc = :update
  payload = { :iterationData => create_payload }
  remote_update( rpc, payload )
end