sysaid 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/sysaid.rb +2 -0
- data/lib/sysaid/project.rb +153 -0
- data/lib/sysaid/task.rb +151 -0
- data/lib/sysaid/ticket.rb +1 -5
- data/lib/sysaid/user.rb +4 -9
- metadata +9 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 28de569790b5e1535736dbe13140e24bd5db028c
|
4
|
+
data.tar.gz: 4d8ccbf9063b61f34aff001add3219fcaed693b8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 649aaffb348c3647e10eaa11bf3557d0c9bd7a758d95acc79bdbba118d9c103a97c269716a41f948d0960c45c81aa2911aea03223706f65481318fe172c5725a
|
7
|
+
data.tar.gz: 8e48200f76e6a8f0049df3dbe49738b618209ffd53b04b18fd44b68158ec7b9ee7a284e62fb19525876e0d5deb945564f5122764cdca2fa415045854160d5727
|
data/lib/sysaid.rb
CHANGED
@@ -0,0 +1,153 @@
|
|
1
|
+
require 'date'
|
2
|
+
|
3
|
+
class SysAid::Project
|
4
|
+
attr_accessor :assigned_group, :category, :company, :cust_date1, :cust_date2, :cust_int1, :cust_int2, :cust_list1,
|
5
|
+
:cust_list2, :cust_notes, :custom_date_fields, :custom_fields, :cust_text1, :cust_text2, :description,
|
6
|
+
:end_time, :id, :incident_title, :manager, :notes, :progress, :raw_estimation, :request_group,
|
7
|
+
:start_time, :status, :title, :version
|
8
|
+
|
9
|
+
def initialize
|
10
|
+
self.start_time = Date.new
|
11
|
+
self.end_time = Date.new
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.find_by_id(project_id)
|
15
|
+
project = SysAid::Project.new
|
16
|
+
|
17
|
+
project.id = project_id
|
18
|
+
|
19
|
+
return nil unless project.refresh
|
20
|
+
|
21
|
+
return project
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.find_by_query(query)
|
25
|
+
response = SysAid.client.call(:execute_select_query, message: sql_query(query))
|
26
|
+
|
27
|
+
if response.to_hash[:execute_select_query_response][:return]
|
28
|
+
return response.to_hash[:execute_select_query_response][:return]
|
29
|
+
end
|
30
|
+
|
31
|
+
return false
|
32
|
+
end
|
33
|
+
|
34
|
+
# Loads the latest project information from the SysAid server
|
35
|
+
def refresh
|
36
|
+
response = SysAid.client.call(:load_by_string_id, message: to_xml)
|
37
|
+
|
38
|
+
if response.to_hash[:load_by_string_id_response][:return]
|
39
|
+
set_self_from_response(response.to_hash[:load_by_string_id_response][:return])
|
40
|
+
return true
|
41
|
+
end
|
42
|
+
|
43
|
+
return false
|
44
|
+
end
|
45
|
+
|
46
|
+
# Saves a project back to the SysAid server
|
47
|
+
#
|
48
|
+
# Example:
|
49
|
+
# >> project_object.save
|
50
|
+
# => true
|
51
|
+
def save
|
52
|
+
if SysAid.logged_in? == false
|
53
|
+
raise "You must log in before creating or saving a project."
|
54
|
+
end
|
55
|
+
|
56
|
+
# Save it via the SOAP API
|
57
|
+
response = SysAid.client.call(:save, message: to_xml(false))
|
58
|
+
if response.to_hash[:save_response][:return]
|
59
|
+
return true
|
60
|
+
else
|
61
|
+
return false
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
# Deletes a project from the SysAid server
|
66
|
+
#
|
67
|
+
# No return value as SysAid's 'delete' call returns void. No idea why.
|
68
|
+
#
|
69
|
+
# Example:
|
70
|
+
# >> project_object.delete
|
71
|
+
# => true
|
72
|
+
def delete
|
73
|
+
SysAid.client.call(:delete, message: to_xml(false))
|
74
|
+
end
|
75
|
+
|
76
|
+
private
|
77
|
+
|
78
|
+
def self.sql_query(query)
|
79
|
+
builder = Builder::XmlMarkup.new
|
80
|
+
|
81
|
+
builder.sessionId(SysAid.session_id)
|
82
|
+
xml = builder.apiSysObj('xsi:type' => "tns:apiProject")
|
83
|
+
xml = builder.condition(query)
|
84
|
+
xml
|
85
|
+
end
|
86
|
+
|
87
|
+
def to_xml(include_id = true)
|
88
|
+
builder = Builder::XmlMarkup.new
|
89
|
+
|
90
|
+
builder.sessionId(SysAid.session_id)
|
91
|
+
xml = builder.apiSysObj('xsi:type' => "tns:apiProject") { |b|
|
92
|
+
b.assignedGroup(self.assigned_group, 'xsi:type' => 'xsd:string')
|
93
|
+
b.category(self.category, 'xsi:type' => 'xsd:int')
|
94
|
+
b.company(self.company, 'xsi:type' => 'xsd:int')
|
95
|
+
#b.custDate1(self.cust_date1.rfc3339, 'xsi:type' => 'xsd:dateTime')
|
96
|
+
#b.custDate2(self.cust_date2.rfc3339, 'xsi:type' => 'xsd:dateTime')
|
97
|
+
b.custInt1(self.cust_int1, 'xsi:type' => 'xsd:int')
|
98
|
+
b.custInt2(self.cust_int2, 'xsi:type' => 'xsd:int')
|
99
|
+
b.custList1(self.cust_list1, 'xsi:type' => 'xsd:int')
|
100
|
+
b.custList2(self.cust_list2, 'xsi:type' => 'xsd:int')
|
101
|
+
b.custNotes(self.cust_notes, 'xsi:type' => 'xsd:string')
|
102
|
+
b.custText1(self.cust_text1, 'xsi:type' => 'xsd:string')
|
103
|
+
b.custText2(self.cust_text2, 'xsi:type' => 'xsd:string')
|
104
|
+
b.customDateFields
|
105
|
+
#b.customFields
|
106
|
+
b.description(self.description, 'xsi:type' => 'xsd:string')
|
107
|
+
b.endTime(self.end_time.rfc3339, 'xsi:type' => 'xsd:dateTime')
|
108
|
+
b.id(self.id, 'xsi:type' => 'xsd:int')
|
109
|
+
b.incidentTitle(self.incident_title, 'xsi:type' => 'xsd:string')
|
110
|
+
b.manager(self.manager, 'xsi:type' => 'xsd:string')
|
111
|
+
b.notes(self.notes, 'xsi:type' => 'xsd:string')
|
112
|
+
b.progress(self.progress, 'xsi:type' => 'xsd:int')
|
113
|
+
b.rawEstimation(self.raw_estimation, 'xsi:type' => 'xsd:int')
|
114
|
+
b.requestGroup(self.request_group, 'xsi:type' => 'xsd:string')
|
115
|
+
b.startTime(self.start_time.rfc3339, 'xsi:type' => 'xsd:dateTime')
|
116
|
+
b.status(self.status, 'xsi:type' => 'xsd:int')
|
117
|
+
b.title(self.title, 'xsi:type' => 'xsd:string')
|
118
|
+
b.version(self.version, 'xsi:type' => 'xsd:int')
|
119
|
+
}
|
120
|
+
xml = builder.id(self.id) if include_id
|
121
|
+
|
122
|
+
xml
|
123
|
+
end
|
124
|
+
|
125
|
+
# Update instance variables to match what is in response
|
126
|
+
def set_self_from_response(response)
|
127
|
+
self.assigned_group = response[:assign_group]
|
128
|
+
self.category = response[:category]
|
129
|
+
self.company = response[:company]
|
130
|
+
#self.cust_date1 = response[:cust_date1]
|
131
|
+
#self.cust_date2 = response[:cust_date2]
|
132
|
+
self.cust_int1 = response[:cust_int1]
|
133
|
+
self.cust_int2 = response[:cust_int2]
|
134
|
+
self.cust_list1 = response[:cust_list1]
|
135
|
+
self.cust_list2 = response[:cust_list2]
|
136
|
+
self.cust_notes = response[:cust_notes]
|
137
|
+
self.cust_text1 = response[:cust_text1]
|
138
|
+
self.cust_text2 = response[:cust_text2]
|
139
|
+
self.description = response[:description]
|
140
|
+
self.end_time = response[:end_time]
|
141
|
+
self.id = response[:id]
|
142
|
+
self.incident_title = response[:incident_title]
|
143
|
+
self.manager = response[:manager]
|
144
|
+
self.notes = response[:notes]
|
145
|
+
self.progress = response[:progress]
|
146
|
+
self.raw_estimation = response[:raw_estimation]
|
147
|
+
self.request_group = response[:request_group]
|
148
|
+
self.start_time = response[:start_time]
|
149
|
+
self.status = response[:status]
|
150
|
+
self.title = response[:title]
|
151
|
+
self.version = response[:version]
|
152
|
+
end
|
153
|
+
end
|
data/lib/sysaid/task.rb
ADDED
@@ -0,0 +1,151 @@
|
|
1
|
+
require 'date'
|
2
|
+
|
3
|
+
class SysAid::Task
|
4
|
+
attr_accessor :category, :ciid, :cust_date1, :cust_date2, :cust_int1, :cust_int2, :cust_list1, :cust_list2,
|
5
|
+
:cust_notes, :custom_date_fields, :custom_fields, :cust_text1, :cust_text2, :description,
|
6
|
+
:end_time, :estimation, :id, :notes, :progress, :project_id, :start_time, :status,
|
7
|
+
:task_dependency, :task_dependency_type, :title, :version
|
8
|
+
|
9
|
+
def initialize
|
10
|
+
self.start_time = Date.new
|
11
|
+
self.end_time = Date.new
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.find_by_id(task_id)
|
15
|
+
task = SysAid::Task.new
|
16
|
+
|
17
|
+
task.id = task_id
|
18
|
+
|
19
|
+
return nil unless task.refresh
|
20
|
+
|
21
|
+
return task
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.find_by_project_id(project_id)
|
25
|
+
response = SysAid.client.call(:execute_select_query, message: sql_query(project_id))
|
26
|
+
|
27
|
+
if response.to_hash[:execute_select_query_response][:return]
|
28
|
+
return response.to_hash[:execute_select_query_response][:return]
|
29
|
+
end
|
30
|
+
|
31
|
+
return false
|
32
|
+
end
|
33
|
+
|
34
|
+
# Loads the latest task information from the SysAid server
|
35
|
+
def refresh
|
36
|
+
response = SysAid.client.call(:load_by_string_id, message: to_xml)
|
37
|
+
|
38
|
+
if response.to_hash[:load_by_string_id_response][:return]
|
39
|
+
set_self_from_response(response.to_hash[:load_by_string_id_response][:return])
|
40
|
+
return true
|
41
|
+
end
|
42
|
+
|
43
|
+
return false
|
44
|
+
end
|
45
|
+
|
46
|
+
# Saves a task back to the SysAid server
|
47
|
+
#
|
48
|
+
# Example:
|
49
|
+
# >> task_object.save
|
50
|
+
# => true
|
51
|
+
def save
|
52
|
+
if SysAid.logged_in? == false
|
53
|
+
raise "You must log in before creating or saving a task."
|
54
|
+
end
|
55
|
+
|
56
|
+
# Save it via the SOAP API
|
57
|
+
response = SysAid.client.call(:save, message: to_xml(false))
|
58
|
+
if response.to_hash[:save_response][:return]
|
59
|
+
return true
|
60
|
+
else
|
61
|
+
return false
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
# Deletes a task from the SysAid server
|
66
|
+
#
|
67
|
+
# No return value as SysAid's 'delete' call returns void. No idea why.
|
68
|
+
#
|
69
|
+
# Example:
|
70
|
+
# >> task_object.delete
|
71
|
+
# => true
|
72
|
+
def delete
|
73
|
+
SysAid.client.call(:delete, message: to_xml(false))
|
74
|
+
end
|
75
|
+
|
76
|
+
private
|
77
|
+
|
78
|
+
def self.sql_query(project_id)
|
79
|
+
builder = Builder::XmlMarkup.new
|
80
|
+
|
81
|
+
builder.sessionId(SysAid.session_id)
|
82
|
+
xml = builder.apiSysObj('xsi:type' => "tns:apiTask")
|
83
|
+
xml = builder.condition("project_id=#{project_id}")
|
84
|
+
xml
|
85
|
+
end
|
86
|
+
|
87
|
+
def to_xml(include_id = true)
|
88
|
+
builder = Builder::XmlMarkup.new
|
89
|
+
|
90
|
+
builder.sessionId(SysAid.session_id)
|
91
|
+
xml = builder.apiSysObj('xsi:type' => "tns:apiTask") { |b|
|
92
|
+
b.category(self.category, 'xsi:type' => 'xsd:int')
|
93
|
+
b.ciId(self.ciid, 'xsi:type' => 'xsd:int')
|
94
|
+
#b.custDate1(self.cust_date1.rfc3339, 'xsi:type' => 'xsd:dateTime')
|
95
|
+
#b.custDate2(self.cust_date2.rfc3339, 'xsi:type' => 'xsd:dateTime')
|
96
|
+
b.custInt1(self.cust_int1, 'xsi:type' => 'xsd:int')
|
97
|
+
b.custInt2(self.cust_int2, 'xsi:type' => 'xsd:int')
|
98
|
+
b.custList1(self.cust_list1, 'xsi:type' => 'xsd:int')
|
99
|
+
b.custList2(self.cust_list2, 'xsi:type' => 'xsd:int')
|
100
|
+
b.custNotes(self.cust_notes, 'xsi:type' => 'xsd:string')
|
101
|
+
b.custText1(self.cust_text1, 'xsi:type' => 'xsd:string')
|
102
|
+
b.custText2(self.cust_text2, 'xsi:type' => 'xsd:string')
|
103
|
+
b.customDateFields
|
104
|
+
#b.customFields
|
105
|
+
b.description(self.description, 'xsi:type' => 'xsd:string')
|
106
|
+
b.endTime(self.end_time.rfc3339, 'xsi:type' => 'xsd:dateTime')
|
107
|
+
b.estimation(self.estimation, 'xsi:type' => 'xsd:int')
|
108
|
+
b.id(self.id, 'xsi:type' => 'xsd:int')
|
109
|
+
b.notes(self.notes, 'xsi:type' => 'xsd:string')
|
110
|
+
b.progress(self.progress, 'xsi:type' => 'xsd:int')
|
111
|
+
b.projectId(self.project_id, 'xsi:type' => 'xsd:int')
|
112
|
+
b.startTime(self.start_time.rfc3339, 'xsi:type' => 'xsd:dateTime')
|
113
|
+
b.status(self.status, 'xsi:type' => 'xsd:int')
|
114
|
+
b.taskDependency(self.task_dependency, 'xsi:type' => 'xsd:int')
|
115
|
+
b.taskDependencyType(self.task_dependency_type, 'xsi:type' => 'xsd:int')
|
116
|
+
b.title(self.title, 'xsi:type' => 'xsd:string')
|
117
|
+
b.version(self.version, 'xsi:type' => 'xsd:int')
|
118
|
+
}
|
119
|
+
xml = builder.id(self.id) if include_id
|
120
|
+
|
121
|
+
xml
|
122
|
+
end
|
123
|
+
|
124
|
+
# Update instance variables to match what is in response
|
125
|
+
def set_self_from_response(response)
|
126
|
+
self.category = response[:category]
|
127
|
+
self.ciid = response[:ciid]
|
128
|
+
#self.cust_date1 = response[:cust_date1]
|
129
|
+
#self.cust_date2 = response[:cust_date2]
|
130
|
+
self.cust_int1 = response[:cust_int1]
|
131
|
+
self.cust_int2 = response[:cust_int2]
|
132
|
+
self.cust_list1 = response[:cust_list1]
|
133
|
+
self.cust_list2 = response[:cust_list2]
|
134
|
+
self.cust_notes = response[:cust_notes]
|
135
|
+
self.cust_text1 = response[:cust_text1]
|
136
|
+
self.cust_text2 = response[:cust_text2]
|
137
|
+
self.description = response[:description]
|
138
|
+
self.end_time = response[:end_time]
|
139
|
+
self.estimation = response[:estimation]
|
140
|
+
self.id = response[:id]
|
141
|
+
self.notes = response[:notes]
|
142
|
+
self.progress = response[:progress]
|
143
|
+
self.project_id = response[:project_id]
|
144
|
+
self.start_time = response[:start_time]
|
145
|
+
self.status = response[:status]
|
146
|
+
self.task_dependency = response[:task_dependency]
|
147
|
+
self.task_dependency_type = response[:task_dependency_type]
|
148
|
+
self.title = response[:title]
|
149
|
+
self.version = response[:version]
|
150
|
+
end
|
151
|
+
end
|
data/lib/sysaid/ticket.rb
CHANGED
@@ -25,7 +25,7 @@ class SysAid::Ticket
|
|
25
25
|
return ticket
|
26
26
|
end
|
27
27
|
|
28
|
-
# Loads the latest
|
28
|
+
# Loads the latest ticket information from the SysAid server
|
29
29
|
def refresh
|
30
30
|
response = SysAid.client.call(:load_by_string_id, message: to_xml)
|
31
31
|
|
@@ -136,10 +136,6 @@ class SysAid::Ticket
|
|
136
136
|
|
137
137
|
# Update instance variables to match what is in response
|
138
138
|
def set_self_from_response(response)
|
139
|
-
pp "---"
|
140
|
-
pp response
|
141
|
-
pp "---"
|
142
|
-
|
143
139
|
self.agreement = response[:agreement]
|
144
140
|
self.archive = response[:archive]
|
145
141
|
self.assign_counter = response[:assign_counter]
|
data/lib/sysaid/user.rb
CHANGED
@@ -54,18 +54,13 @@ class SysAid::User
|
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
57
|
-
# Deletes a
|
57
|
+
# Deletes a user from the SysAid server
|
58
58
|
#
|
59
59
|
# Example:
|
60
|
-
# >>
|
61
|
-
# =>
|
60
|
+
# >> user_object.delete
|
61
|
+
# => nil
|
62
62
|
def delete
|
63
|
-
|
64
|
-
|
65
|
-
#response.to_hash[:delete_response]
|
66
|
-
|
67
|
-
# The SysAid API doesn't return anything on delete.
|
68
|
-
# Think about that for a minute.
|
63
|
+
SysAid.client.call(:delete, message: to_xml(false).to_s )
|
69
64
|
end
|
70
65
|
|
71
66
|
private
|
metadata
CHANGED
@@ -1,27 +1,27 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sysaid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christopher Thielen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-12-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: savon
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 2.3.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 2.3.0
|
27
27
|
description: Wrapper for the SysAid SOAP API
|
@@ -31,6 +31,8 @@ extensions: []
|
|
31
31
|
extra_rdoc_files: []
|
32
32
|
files:
|
33
33
|
- lib/sysaid.rb
|
34
|
+
- lib/sysaid/project.rb
|
35
|
+
- lib/sysaid/task.rb
|
34
36
|
- lib/sysaid/ticket.rb
|
35
37
|
- lib/sysaid/user.rb
|
36
38
|
homepage: https://github.com/cthielen/ruby-sysaid
|
@@ -43,17 +45,17 @@ require_paths:
|
|
43
45
|
- lib
|
44
46
|
required_ruby_version: !ruby/object:Gem::Requirement
|
45
47
|
requirements:
|
46
|
-
- -
|
48
|
+
- - ">="
|
47
49
|
- !ruby/object:Gem::Version
|
48
50
|
version: '0'
|
49
51
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
50
52
|
requirements:
|
51
|
-
- -
|
53
|
+
- - ">="
|
52
54
|
- !ruby/object:Gem::Version
|
53
55
|
version: '0'
|
54
56
|
requirements: []
|
55
57
|
rubyforge_project:
|
56
|
-
rubygems_version: 2.0
|
58
|
+
rubygems_version: 2.2.0
|
57
59
|
signing_key:
|
58
60
|
specification_version: 4
|
59
61
|
summary: ruby-sysaid
|