sysaid 0.3.3 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sysaid.rb +28 -13
- data/lib/sysaid/activity.rb +26 -26
- data/lib/sysaid/project.rb +22 -22
- data/lib/sysaid/task.rb +19 -19
- data/lib/sysaid/ticket.rb +21 -21
- data/lib/sysaid/user.rb +14 -24
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 22a0143cf3d7e453f2e61907d52a177f46ecfb58
|
4
|
+
data.tar.gz: 7b271de7c2b38af6fa93a19bacfb59027e39919a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0cd04dfef9f31101e2a388e686c38e69b3f1678f39cbd8c4611eace2d2215b1f2b38195184b48e7edf198a1d105c0d38657f0a62bc891f4c508d59d278adb8df
|
7
|
+
data.tar.gz: 86afd2f3ad495f74472512e045a88145e3f846c279a23fa6d2f97e1176b39f1611cbdaf38dedcf480cf6d3d2b27b53c149b1fd016f56145dee56a23c9ead3d3c
|
data/lib/sysaid.rb
CHANGED
@@ -8,19 +8,34 @@ end
|
|
8
8
|
class SysAid
|
9
9
|
@@logged_in = false
|
10
10
|
@@server_settings = { account: nil, username: nil, password: nil, wsdl_uri: nil, debug: false }
|
11
|
-
|
11
|
+
|
12
12
|
# Accessor for internal SysaidApiService object.
|
13
13
|
# Used by SysAid::Ticket
|
14
14
|
def self.client
|
15
15
|
@@client
|
16
16
|
end
|
17
17
|
|
18
|
+
# Proxy for @@client.call but allows us to catch the various exceptions which may happen
|
19
|
+
# due to network errors, SOAP errors, etc., which otherwise would have to be caught in
|
20
|
+
# many different places.
|
21
|
+
def self.call(method, message)
|
22
|
+
begin
|
23
|
+
return @@client.call(method, message)
|
24
|
+
rescue SocketError => e
|
25
|
+
raise SysAidException, "Unable to fetch user information from SysAid server: #{e.message}"
|
26
|
+
rescue Errno::EHOSTUNREACH => e
|
27
|
+
raise SysAidException, "Unable to save user due to server being unreachable: #{e.message}"
|
28
|
+
rescue Savon::SOAPFault => e
|
29
|
+
raise SysAidException, "Unable to save user due to SOAP communications error: #{e.message}"
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
18
33
|
# Accessor for session ID returned by SysAid server.
|
19
34
|
# Used by SysAid::Ticket
|
20
35
|
def self.session_id
|
21
36
|
@@session_id
|
22
37
|
end
|
23
|
-
|
38
|
+
|
24
39
|
# Accessor for server settings.
|
25
40
|
# Used by SysAid::Ticket
|
26
41
|
def self.server_settings
|
@@ -31,7 +46,7 @@ class SysAid
|
|
31
46
|
# If they don't pass in debug, set it to false to maintain default settings
|
32
47
|
@@server_settings[:debug] = false if server_settings[:debug].nil?
|
33
48
|
end
|
34
|
-
|
49
|
+
|
35
50
|
# The SysAid API isn't clear on what creates an API timeout. It's possible to login
|
36
51
|
# and make SOAP calls many minutes later but the API _seems_ to timeout at some point.
|
37
52
|
# With the exception of the added delay, there's no harm in simply logging in over and
|
@@ -40,7 +55,7 @@ class SysAid
|
|
40
55
|
def self.ensure_logged_in
|
41
56
|
self.login unless self.logged_in?
|
42
57
|
end
|
43
|
-
|
58
|
+
|
44
59
|
# Returns true if logged into SysAid server
|
45
60
|
# Note: By design, logged_in? will try to log in if it isn't already
|
46
61
|
#
|
@@ -49,44 +64,44 @@ class SysAid
|
|
49
64
|
# => true
|
50
65
|
def self.logged_in?
|
51
66
|
puts "SysAid.logged_in? called" if @@server_settings[:debug]
|
52
|
-
|
67
|
+
|
53
68
|
# Until official word comes from the company, we're going to login every time
|
54
69
|
# to avoid a problem with undetected timeouts.
|
55
70
|
#if @@logged_in == false
|
56
71
|
login
|
57
72
|
#end
|
58
|
-
|
73
|
+
|
59
74
|
if @@logged_in
|
60
75
|
return true
|
61
76
|
else
|
62
77
|
return false
|
63
78
|
end
|
64
79
|
end
|
65
|
-
|
80
|
+
|
66
81
|
# self.login does not require credentials be passed every time.
|
67
82
|
# SysAid sometimes times out the session and we can simply call 'login' again with the
|
68
83
|
# saved credentials to get around the timeout.
|
69
84
|
def self.login(account = nil, username = nil, password = nil, wsdl_uri = nil, debug = nil)
|
70
85
|
puts "SysAid.login" if @@server_settings[:debug]
|
71
|
-
|
86
|
+
|
72
87
|
if account and username and password and wsdl_uri
|
73
88
|
# Save server settings in case we need to log in again later
|
74
89
|
@@server_settings = { :account => account, :username => username, :password => password, :wsdl_uri => wsdl_uri }
|
75
90
|
# 'debug' parameter cannot default to false else it would override default, so use nil and check
|
76
91
|
@@server_settings[:debug] = debug if debug != nil
|
77
92
|
end
|
78
|
-
|
93
|
+
|
79
94
|
begin
|
80
95
|
@@client = Savon.client(wsdl: @@server_settings[:wsdl_uri], log: @@server_settings[:debug])
|
81
|
-
|
96
|
+
|
82
97
|
# login
|
83
98
|
unless @@server_settings[:account].nil?
|
84
99
|
# Call login
|
85
|
-
response =
|
86
|
-
|
100
|
+
response = self.call(:login, message: { accountId: @@server_settings[:account], userName: @@server_settings[:username], password: @@server_settings[:password] })
|
101
|
+
|
87
102
|
# Retrieve response
|
88
103
|
@@session_id = response.to_hash[:login_response][:return]
|
89
|
-
|
104
|
+
|
90
105
|
@@logged_in = true
|
91
106
|
end
|
92
107
|
rescue Net::ReadTimeout => e
|
data/lib/sysaid/activity.rb
CHANGED
@@ -2,11 +2,11 @@ require 'date'
|
|
2
2
|
|
3
3
|
class SysAid::Activity
|
4
4
|
attr_accessor :ciid, :cust_int1, :cust_int2, :cust_int3, :cust_int4, :cust_list1, :cust_list2, :description, :from_time, :id, :sr_id, :to_time, :user
|
5
|
-
|
5
|
+
|
6
6
|
def initialize
|
7
7
|
reset_all_attributes
|
8
8
|
end
|
9
|
-
|
9
|
+
|
10
10
|
# Needed by both initialize and delete (to empty out the object when deleted)
|
11
11
|
def reset_all_attributes
|
12
12
|
self.ciid = nil
|
@@ -23,46 +23,46 @@ class SysAid::Activity
|
|
23
23
|
self.to_time = Date.new
|
24
24
|
self.user = nil
|
25
25
|
end
|
26
|
-
|
26
|
+
|
27
27
|
# Returns an array of Activity IDs based on ticket_id.
|
28
28
|
# Returns false on error.
|
29
29
|
def self.find_by_ticket_id(ticket_id)
|
30
30
|
SysAid.ensure_logged_in
|
31
|
-
|
32
|
-
response = SysAid.
|
33
|
-
|
31
|
+
|
32
|
+
response = SysAid.call(:execute_select_query, message: sql_query(" service_req_id = #{ticket_id}"))
|
33
|
+
|
34
34
|
if response.to_hash[:execute_select_query_response][:return]
|
35
35
|
return response.to_hash[:execute_select_query_response][:return]
|
36
36
|
end
|
37
|
-
|
37
|
+
|
38
38
|
return false
|
39
39
|
end
|
40
|
-
|
40
|
+
|
41
41
|
# Returns a specific Activity based on an Activity ID
|
42
42
|
def self.find_by_id(activity_id)
|
43
43
|
activity = SysAid::Activity.new
|
44
|
-
|
44
|
+
|
45
45
|
activity.id = activity_id
|
46
|
-
|
46
|
+
|
47
47
|
return nil unless activity.refresh
|
48
|
-
|
48
|
+
|
49
49
|
return activity
|
50
50
|
end
|
51
|
-
|
51
|
+
|
52
52
|
# Loads the latest ticket information from the SysAid server
|
53
53
|
def refresh
|
54
54
|
SysAid.ensure_logged_in
|
55
|
-
|
56
|
-
response = SysAid.
|
57
|
-
|
55
|
+
|
56
|
+
response = SysAid.call(:load_by_string_id, message: to_xml)
|
57
|
+
|
58
58
|
if response.to_hash[:load_by_string_id_response][:return]
|
59
59
|
set_self_from_response(response.to_hash[:load_by_string_id_response][:return])
|
60
60
|
return true
|
61
61
|
end
|
62
|
-
|
62
|
+
|
63
63
|
return false
|
64
64
|
end
|
65
|
-
|
65
|
+
|
66
66
|
# Saves an activity back to the SysAid server
|
67
67
|
#
|
68
68
|
# Example:
|
@@ -70,9 +70,9 @@ class SysAid::Activity
|
|
70
70
|
# => true
|
71
71
|
def save
|
72
72
|
SysAid.ensure_logged_in
|
73
|
-
|
73
|
+
|
74
74
|
# Save it via the SOAP API
|
75
|
-
response = SysAid.
|
75
|
+
response = SysAid.call(:save, message: to_xml(false))
|
76
76
|
if response.to_hash[:save_response][:return]
|
77
77
|
# In the case of new activities, the SysAid response will be the assigned ID
|
78
78
|
self.id = response.to_hash[:save_response][:return] unless self.id
|
@@ -92,13 +92,13 @@ class SysAid::Activity
|
|
92
92
|
def delete
|
93
93
|
SysAid.ensure_logged_in
|
94
94
|
|
95
|
-
SysAid.
|
96
|
-
|
95
|
+
SysAid.call(:delete, message: to_xml(false))
|
96
|
+
|
97
97
|
reset_all_attributes
|
98
98
|
end
|
99
|
-
|
99
|
+
|
100
100
|
private
|
101
|
-
|
101
|
+
|
102
102
|
def self.sql_query(query)
|
103
103
|
builder = Builder::XmlMarkup.new
|
104
104
|
|
@@ -107,10 +107,10 @@ class SysAid::Activity
|
|
107
107
|
xml = builder.condition(query)
|
108
108
|
xml
|
109
109
|
end
|
110
|
-
|
110
|
+
|
111
111
|
def to_xml(include_id = true)
|
112
112
|
builder = Builder::XmlMarkup.new
|
113
|
-
|
113
|
+
|
114
114
|
builder.sessionId(SysAid.session_id)
|
115
115
|
xml = builder.apiSysObj('xsi:type' => "tns:apiServiceRequestActivity") { |b|
|
116
116
|
b.CIId(self.ciid, 'xsi:type' => 'xsd:int')
|
@@ -131,7 +131,7 @@ class SysAid::Activity
|
|
131
131
|
|
132
132
|
xml
|
133
133
|
end
|
134
|
-
|
134
|
+
|
135
135
|
# Update instance variables to match what is in response
|
136
136
|
def set_self_from_response(response)
|
137
137
|
self.ciid = response[:ci_id]
|
data/lib/sysaid/project.rb
CHANGED
@@ -3,47 +3,47 @@ require 'date'
|
|
3
3
|
class SysAid::Project
|
4
4
|
attr_accessor :assigned_group, :category, :company, :cust_date1, :cust_date2, :cust_int1, :cust_int2, :cust_list1,
|
5
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,
|
6
|
+
:end_time, :id, :incident_title, :manager, :notes, :progress, :raw_estimation, :request_group,
|
7
7
|
:start_time, :status, :title, :version
|
8
|
-
|
8
|
+
|
9
9
|
def initialize
|
10
10
|
self.start_time = Date.new
|
11
11
|
self.end_time = Date.new
|
12
12
|
end
|
13
|
-
|
13
|
+
|
14
14
|
def self.find_by_id(project_id)
|
15
15
|
project = SysAid::Project.new
|
16
|
-
|
16
|
+
|
17
17
|
project.id = project_id
|
18
|
-
|
18
|
+
|
19
19
|
return nil unless project.refresh
|
20
|
-
|
20
|
+
|
21
21
|
return project
|
22
22
|
end
|
23
23
|
|
24
24
|
def self.find_by_query(query)
|
25
25
|
SysAid.ensure_logged_in
|
26
|
-
|
27
|
-
response = SysAid.
|
28
|
-
|
26
|
+
|
27
|
+
response = SysAid.call(:execute_select_query, message: sql_query(query))
|
28
|
+
|
29
29
|
if response.to_hash[:execute_select_query_response][:return]
|
30
30
|
return response.to_hash[:execute_select_query_response][:return]
|
31
31
|
end
|
32
|
-
|
32
|
+
|
33
33
|
return false
|
34
34
|
end
|
35
|
-
|
35
|
+
|
36
36
|
# Loads the latest project information from the SysAid server
|
37
37
|
def refresh
|
38
38
|
SysAid.ensure_logged_in
|
39
|
-
|
40
|
-
response = SysAid.
|
41
|
-
|
39
|
+
|
40
|
+
response = SysAid.call(:load_by_string_id, message: to_xml)
|
41
|
+
|
42
42
|
if response.to_hash[:load_by_string_id_response][:return]
|
43
43
|
set_self_from_response(response.to_hash[:load_by_string_id_response][:return])
|
44
44
|
return true
|
45
45
|
end
|
46
|
-
|
46
|
+
|
47
47
|
return false
|
48
48
|
end
|
49
49
|
|
@@ -54,9 +54,9 @@ class SysAid::Project
|
|
54
54
|
# => true
|
55
55
|
def save
|
56
56
|
SysAid.ensure_logged_in
|
57
|
-
|
57
|
+
|
58
58
|
# Save it via the SOAP API
|
59
|
-
response = SysAid.
|
59
|
+
response = SysAid.call(:save, message: to_xml(false))
|
60
60
|
if response.to_hash[:save_response][:return]
|
61
61
|
return true
|
62
62
|
else
|
@@ -70,14 +70,14 @@ class SysAid::Project
|
|
70
70
|
#
|
71
71
|
# Example:
|
72
72
|
# >> project_object.delete
|
73
|
-
# => true
|
73
|
+
# => true
|
74
74
|
def delete
|
75
75
|
SysAid.ensure_logged_in
|
76
|
-
SysAid.
|
76
|
+
SysAid.call(:delete, message: to_xml(false))
|
77
77
|
end
|
78
|
-
|
78
|
+
|
79
79
|
private
|
80
|
-
|
80
|
+
|
81
81
|
def self.sql_query(query)
|
82
82
|
builder = Builder::XmlMarkup.new
|
83
83
|
|
@@ -121,7 +121,7 @@ class SysAid::Project
|
|
121
121
|
|
122
122
|
xml
|
123
123
|
end
|
124
|
-
|
124
|
+
|
125
125
|
# Update instance variables to match what is in response
|
126
126
|
def set_self_from_response(response)
|
127
127
|
self.assigned_group = response[:assign_group]
|
data/lib/sysaid/task.rb
CHANGED
@@ -5,45 +5,45 @@ class SysAid::Task
|
|
5
5
|
:cust_notes, :custom_date_fields, :custom_fields, :cust_text1, :cust_text2, :description,
|
6
6
|
:end_time, :estimation, :id, :notes, :progress, :project_id, :start_time, :status,
|
7
7
|
:task_dependency, :task_dependency_type, :title, :version
|
8
|
-
|
8
|
+
|
9
9
|
def initialize
|
10
10
|
self.start_time = Date.new
|
11
11
|
self.end_time = Date.new
|
12
12
|
end
|
13
|
-
|
13
|
+
|
14
14
|
def self.find_by_id(task_id)
|
15
15
|
task = SysAid::Task.new
|
16
|
-
|
16
|
+
|
17
17
|
task.id = task_id
|
18
|
-
|
18
|
+
|
19
19
|
return nil unless task.refresh
|
20
|
-
|
20
|
+
|
21
21
|
return task
|
22
22
|
end
|
23
23
|
|
24
24
|
def self.find_by_project_id(project_id)
|
25
25
|
SysAid.ensure_logged_in
|
26
|
-
|
27
|
-
response = SysAid.
|
28
|
-
|
26
|
+
|
27
|
+
response = SysAid.call(:execute_select_query, message: sql_query(project_id))
|
28
|
+
|
29
29
|
if response.to_hash[:execute_select_query_response][:return]
|
30
30
|
return response.to_hash[:execute_select_query_response][:return]
|
31
31
|
end
|
32
|
-
|
32
|
+
|
33
33
|
return false
|
34
34
|
end
|
35
35
|
|
36
36
|
# Loads the latest task information from the SysAid server
|
37
37
|
def refresh
|
38
38
|
SysAid.ensure_logged_in
|
39
|
-
|
40
|
-
response = SysAid.
|
41
|
-
|
39
|
+
|
40
|
+
response = SysAid.call(:load_by_string_id, message: to_xml)
|
41
|
+
|
42
42
|
if response.to_hash[:load_by_string_id_response][:return]
|
43
43
|
set_self_from_response(response.to_hash[:load_by_string_id_response][:return])
|
44
44
|
return true
|
45
45
|
end
|
46
|
-
|
46
|
+
|
47
47
|
return false
|
48
48
|
end
|
49
49
|
|
@@ -54,9 +54,9 @@ class SysAid::Task
|
|
54
54
|
# => true
|
55
55
|
def save
|
56
56
|
SysAid.ensure_logged_in
|
57
|
-
|
57
|
+
|
58
58
|
# Save it via the SOAP API
|
59
|
-
response = SysAid.
|
59
|
+
response = SysAid.call(:save, message: to_xml(false))
|
60
60
|
if response.to_hash[:save_response][:return]
|
61
61
|
return true
|
62
62
|
else
|
@@ -70,13 +70,13 @@ class SysAid::Task
|
|
70
70
|
#
|
71
71
|
# Example:
|
72
72
|
# >> task_object.delete
|
73
|
-
# => true
|
73
|
+
# => true
|
74
74
|
def delete
|
75
75
|
SysAid.ensure_logged_in
|
76
76
|
|
77
|
-
SysAid.
|
77
|
+
SysAid.call(:delete, message: to_xml(false))
|
78
78
|
end
|
79
|
-
|
79
|
+
|
80
80
|
private
|
81
81
|
|
82
82
|
def self.sql_query(project_id)
|
@@ -124,7 +124,7 @@ class SysAid::Task
|
|
124
124
|
|
125
125
|
xml
|
126
126
|
end
|
127
|
-
|
127
|
+
|
128
128
|
# Update instance variables to match what is in response
|
129
129
|
def set_self_from_response(response)
|
130
130
|
self.category = response[:category]
|
data/lib/sysaid/ticket.rb
CHANGED
@@ -8,11 +8,11 @@ class SysAid::Ticket
|
|
8
8
|
:assigned_group, :cc, :change_category, :close_time, :closure_information, :computer_id,
|
9
9
|
:cust_notes, :cust_text1, :cust_text2, :impact, :notes, :resolution, :solution, :third_level_category,
|
10
10
|
:update_time, :update_user, :user_manager, :workaround, :insert_time, :followup_text, :email_account
|
11
|
-
|
11
|
+
|
12
12
|
def initialize
|
13
13
|
reset_all_attributes
|
14
14
|
end
|
15
|
-
|
15
|
+
|
16
16
|
# Needed by both initialize and delete (to empty out the object when deleted)
|
17
17
|
def reset_all_attributes
|
18
18
|
self.agreement = nil
|
@@ -68,37 +68,37 @@ class SysAid::Ticket
|
|
68
68
|
self.version = nil
|
69
69
|
self.workaround = nil
|
70
70
|
end
|
71
|
-
|
71
|
+
|
72
72
|
def self.find_by_id(ticket_id)
|
73
73
|
ticket = SysAid::Ticket.new
|
74
|
-
|
74
|
+
|
75
75
|
ticket.id = ticket_id
|
76
|
-
|
76
|
+
|
77
77
|
return nil unless ticket.refresh
|
78
|
-
|
78
|
+
|
79
79
|
return ticket
|
80
80
|
end
|
81
|
-
|
81
|
+
|
82
82
|
# Loads the latest ticket information from the SysAid server
|
83
83
|
def refresh
|
84
84
|
SysAid.ensure_logged_in
|
85
|
-
|
86
|
-
response = SysAid.
|
87
|
-
|
85
|
+
|
86
|
+
response = SysAid.call(:load_by_string_id, message: to_xml)
|
87
|
+
|
88
88
|
if response.to_hash[:load_by_string_id_response][:return]
|
89
89
|
set_self_from_response(response.to_hash[:load_by_string_id_response][:return])
|
90
90
|
return true
|
91
91
|
end
|
92
|
-
|
92
|
+
|
93
93
|
return false
|
94
94
|
end
|
95
|
-
|
95
|
+
|
96
96
|
# Though the 'notes' field is merely an editable string, 'add_note'
|
97
97
|
# mimics the behavior of the SysAid web client.
|
98
98
|
def add_note(user, note, time = Time.now)
|
99
99
|
# NOTE: Notes are prepended.
|
100
100
|
new_note = "#{user} (#{time.strftime("%-m/%-d/%y %I:%M %p")}):\n #{note}"
|
101
|
-
|
101
|
+
|
102
102
|
if self.notes
|
103
103
|
self.notes = new_note + "\n=============================\n" + self.notes
|
104
104
|
else
|
@@ -113,9 +113,9 @@ class SysAid::Ticket
|
|
113
113
|
# => true
|
114
114
|
def save
|
115
115
|
SysAid.ensure_logged_in
|
116
|
-
|
116
|
+
|
117
117
|
# Save it via the SOAP API
|
118
|
-
response = SysAid.
|
118
|
+
response = SysAid.call(:save, message: to_xml(false))
|
119
119
|
if response.to_hash[:save_response][:return]
|
120
120
|
# In the case of a new ticket, the SysAid response will be the assigned ID
|
121
121
|
self.id = response.to_hash[:save_response][:return] unless self.id
|
@@ -131,17 +131,17 @@ class SysAid::Ticket
|
|
131
131
|
#
|
132
132
|
# Example:
|
133
133
|
# >> ticket_object.delete
|
134
|
-
# => true
|
134
|
+
# => true
|
135
135
|
def delete
|
136
136
|
SysAid.ensure_logged_in
|
137
137
|
|
138
|
-
SysAid.
|
139
|
-
|
138
|
+
SysAid.call(:delete, message: to_xml(false))
|
139
|
+
|
140
140
|
reset_all_attributes
|
141
141
|
end
|
142
|
-
|
142
|
+
|
143
143
|
private
|
144
|
-
|
144
|
+
|
145
145
|
def to_xml(include_id = true)
|
146
146
|
builder = Builder::XmlMarkup.new
|
147
147
|
|
@@ -206,7 +206,7 @@ class SysAid::Ticket
|
|
206
206
|
|
207
207
|
xml
|
208
208
|
end
|
209
|
-
|
209
|
+
|
210
210
|
# Update instance variables to match what is in response
|
211
211
|
def set_self_from_response(response)
|
212
212
|
self.agreement = response[:agreement]
|
data/lib/sysaid/user.rb
CHANGED
@@ -26,21 +26,15 @@ class SysAid::User
|
|
26
26
|
|
27
27
|
# Loads the latest user information from the SysAid server
|
28
28
|
def refresh
|
29
|
-
|
30
|
-
SysAid.ensure_logged_in
|
31
|
-
|
32
|
-
response = SysAid.client.call(:load_by_string_id, message: to_xml.to_s )
|
33
|
-
if response.to_hash[:load_by_string_id_response][:return]
|
34
|
-
set_self_from_response(response.to_hash[:load_by_string_id_response][:return])
|
35
|
-
return true
|
36
|
-
end
|
29
|
+
SysAid.ensure_logged_in
|
37
30
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
raise SysAidException, "Unable to reach SysAid server, host unreachable: #{e.message}"
|
31
|
+
response = SysAid.call(:load_by_string_id, message: to_xml.to_s )
|
32
|
+
if response.to_hash[:load_by_string_id_response][:return]
|
33
|
+
set_self_from_response(response.to_hash[:load_by_string_id_response][:return])
|
34
|
+
return true
|
43
35
|
end
|
36
|
+
|
37
|
+
return false
|
44
38
|
end
|
45
39
|
|
46
40
|
# Saves a user back to the SysAid server
|
@@ -51,16 +45,12 @@ class SysAid::User
|
|
51
45
|
def save
|
52
46
|
SysAid.ensure_logged_in
|
53
47
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
return false
|
61
|
-
end
|
62
|
-
rescue Savon::SOAPFault => e
|
63
|
-
raise SysAidException, "Unable to save user due to SOAP communications error: #{e.message}"
|
48
|
+
# Save it via the SOAP API
|
49
|
+
response = SysAid.call(:save, message: to_xml(false).to_s )
|
50
|
+
if response.to_hash[:save_response][:return]
|
51
|
+
return true
|
52
|
+
else
|
53
|
+
return false
|
64
54
|
end
|
65
55
|
end
|
66
56
|
|
@@ -72,7 +62,7 @@ class SysAid::User
|
|
72
62
|
def delete
|
73
63
|
SysAid.ensure_logged_in
|
74
64
|
|
75
|
-
SysAid.
|
65
|
+
SysAid.call(:delete, message: to_xml(false).to_s )
|
76
66
|
end
|
77
67
|
|
78
68
|
private
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sysaid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christopher Thielen
|
@@ -62,7 +62,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
62
62
|
version: '0'
|
63
63
|
requirements: []
|
64
64
|
rubyforge_project:
|
65
|
-
rubygems_version: 2.
|
65
|
+
rubygems_version: 2.3.0
|
66
66
|
signing_key:
|
67
67
|
specification_version: 4
|
68
68
|
summary: ruby-sysaid
|