Class: SysAid::Project

Inherits:
Object
  • Object
show all
Defined in:
lib/sysaid/project.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeProject

Returns a new instance of Project.



9
10
11
12
# File 'lib/sysaid/project.rb', line 9

def initialize
  self.start_time = Date.new
  self.end_time = Date.new
end

Instance Attribute Details

#assigned_groupObject

Returns the value of attribute assigned_group.



4
5
6
# File 'lib/sysaid/project.rb', line 4

def assigned_group
  @assigned_group
end

#categoryObject

Returns the value of attribute category.



4
5
6
# File 'lib/sysaid/project.rb', line 4

def category
  @category
end

#companyObject

Returns the value of attribute company.



4
5
6
# File 'lib/sysaid/project.rb', line 4

def company
  @company
end

#cust_date1Object

Returns the value of attribute cust_date1.



4
5
6
# File 'lib/sysaid/project.rb', line 4

def cust_date1
  @cust_date1
end

#cust_date2Object

Returns the value of attribute cust_date2.



4
5
6
# File 'lib/sysaid/project.rb', line 4

def cust_date2
  @cust_date2
end

#cust_int1Object

Returns the value of attribute cust_int1.



4
5
6
# File 'lib/sysaid/project.rb', line 4

def cust_int1
  @cust_int1
end

#cust_int2Object

Returns the value of attribute cust_int2.



4
5
6
# File 'lib/sysaid/project.rb', line 4

def cust_int2
  @cust_int2
end

#cust_list1Object

Returns the value of attribute cust_list1.



4
5
6
# File 'lib/sysaid/project.rb', line 4

def cust_list1
  @cust_list1
end

#cust_list2Object

Returns the value of attribute cust_list2.



4
5
6
# File 'lib/sysaid/project.rb', line 4

def cust_list2
  @cust_list2
end

#cust_notesObject

Returns the value of attribute cust_notes.



4
5
6
# File 'lib/sysaid/project.rb', line 4

def cust_notes
  @cust_notes
end

#cust_text1Object

Returns the value of attribute cust_text1.



4
5
6
# File 'lib/sysaid/project.rb', line 4

def cust_text1
  @cust_text1
end

#cust_text2Object

Returns the value of attribute cust_text2.



4
5
6
# File 'lib/sysaid/project.rb', line 4

def cust_text2
  @cust_text2
end

#custom_date_fieldsObject

Returns the value of attribute custom_date_fields.



4
5
6
# File 'lib/sysaid/project.rb', line 4

def custom_date_fields
  @custom_date_fields
end

#custom_fieldsObject

Returns the value of attribute custom_fields.



4
5
6
# File 'lib/sysaid/project.rb', line 4

def custom_fields
  @custom_fields
end

#descriptionObject

Returns the value of attribute description.



4
5
6
# File 'lib/sysaid/project.rb', line 4

def description
  @description
end

#end_timeObject

Returns the value of attribute end_time.



4
5
6
# File 'lib/sysaid/project.rb', line 4

def end_time
  @end_time
end

#idObject

Returns the value of attribute id.



4
5
6
# File 'lib/sysaid/project.rb', line 4

def id
  @id
end

#incident_titleObject

Returns the value of attribute incident_title.



4
5
6
# File 'lib/sysaid/project.rb', line 4

def incident_title
  @incident_title
end

#managerObject

Returns the value of attribute manager.



4
5
6
# File 'lib/sysaid/project.rb', line 4

def manager
  @manager
end

#notesObject

Returns the value of attribute notes.



4
5
6
# File 'lib/sysaid/project.rb', line 4

def notes
  @notes
end

#progressObject

Returns the value of attribute progress.



4
5
6
# File 'lib/sysaid/project.rb', line 4

def progress
  @progress
end

#raw_estimationObject

Returns the value of attribute raw_estimation.



4
5
6
# File 'lib/sysaid/project.rb', line 4

def raw_estimation
  @raw_estimation
end

#request_groupObject

Returns the value of attribute request_group.



4
5
6
# File 'lib/sysaid/project.rb', line 4

def request_group
  @request_group
end

#start_timeObject

Returns the value of attribute start_time.



4
5
6
# File 'lib/sysaid/project.rb', line 4

def start_time
  @start_time
end

#statusObject

Returns the value of attribute status.



4
5
6
# File 'lib/sysaid/project.rb', line 4

def status
  @status
end

#titleObject

Returns the value of attribute title.



4
5
6
# File 'lib/sysaid/project.rb', line 4

def title
  @title
end

#versionObject

Returns the value of attribute version.



4
5
6
# File 'lib/sysaid/project.rb', line 4

def version
  @version
end

Class Method Details

.find_by_id(project_id) ⇒ Object



14
15
16
17
18
19
20
21
22
# File 'lib/sysaid/project.rb', line 14

def self.find_by_id(project_id)
  project = SysAid::Project.new

  project.id = project_id

  return nil unless project.refresh

  return project
end

.find_by_query(query) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
# File 'lib/sysaid/project.rb', line 24

def self.find_by_query(query)
  SysAid.ensure_logged_in

  response = SysAid.call(:execute_select_query, message: sql_query(query))

  if response.to_hash[:execute_select_query_response][:return]
    return response.to_hash[:execute_select_query_response][:return]
  end

  return false
end

Instance Method Details

#deleteObject

Deletes a project from the SysAid server

No return value as SysAid’s ‘delete’ call returns void. No idea why.

Example:

>> project_object.delete
=> true


74
75
76
77
# File 'lib/sysaid/project.rb', line 74

def delete
  SysAid.ensure_logged_in
  SysAid.call(:delete, message: to_xml(false))
end

#refreshObject

Loads the latest project information from the SysAid server



37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/sysaid/project.rb', line 37

def refresh
  SysAid.ensure_logged_in

  response = SysAid.call(:load_by_string_id, message: to_xml)

  if response.to_hash[:load_by_string_id_response][:return]
    set_self_from_response(response.to_hash[:load_by_string_id_response][:return])
    return true
  end

  return false
end

#saveObject

Saves a project back to the SysAid server

Example:

>> project_object.save
=> true


55
56
57
58
59
60
61
62
63
64
65
# File 'lib/sysaid/project.rb', line 55

def save
  SysAid.ensure_logged_in

  # Save it via the SOAP API
  response = SysAid.call(:save, message: to_xml(false))
  if response.to_hash[:save_response][:return]
    return true
  else
    return false
  end
end