sysaid 0.3.0 → 0.3.1
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 +17 -8
- data/lib/sysaid/activity.rb +1 -2
- data/lib/sysaid/user.rb +10 -6
- 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: 2d418e910f545a0ec051edba6e5a6e922099e563
|
4
|
+
data.tar.gz: 87e00dad201543cf04e081e4e7727fc4374cb96e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 39c8f122024da00d30d6f1af474812908753735fee455ced3964c110080653d524aa3b756c4ae2f5de63473b6f5d30a365b712fc98ce4960327b67ec88637884
|
7
|
+
data.tar.gz: 8126e7f98dcb4983ba5bf5e40e62f218d4f6b5bc2645b0a340aa65da9f0bec77f985ee8f1518f361ce9c140f56a50556421b25b19281ba2013380e17c59b113e
|
data/lib/sysaid.rb
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
require 'savon'
|
2
2
|
|
3
|
+
# Custom error class used for throwing exceptions to this gem's user
|
4
|
+
class SysAidException < StandardError
|
5
|
+
end
|
6
|
+
|
3
7
|
# The main SysAid class
|
4
8
|
class SysAid
|
5
9
|
@@logged_in = false
|
@@ -52,17 +56,22 @@ class SysAid
|
|
52
56
|
@@server_settings = { :account => account, :username => username, :password => password, :wsdl_uri => wsdl_uri, :debug => debug }
|
53
57
|
end
|
54
58
|
|
55
|
-
|
59
|
+
begin
|
60
|
+
@@client = Savon.client(wsdl: @@server_settings[:wsdl_uri], log: @@server_settings[:debug])
|
56
61
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
62
|
+
# login
|
63
|
+
unless @@server_settings[:account].nil?
|
64
|
+
# Call login
|
65
|
+
response = @@client.call(:login, message: { accountId: @@server_settings[:account], userName: @@server_settings[:username], password: @@server_settings[:password] })
|
61
66
|
|
62
|
-
|
63
|
-
|
67
|
+
# Retrieve response
|
68
|
+
@@session_id = response.to_hash[:login_response][:return]
|
64
69
|
|
65
|
-
|
70
|
+
@@logged_in = true
|
71
|
+
end
|
72
|
+
rescue Net::ReadTimeout => e
|
73
|
+
# This isn't the API timeout, this is a normal socket timeout error.
|
74
|
+
raise SysAidException, "Unable to log into SysAid server: #{e.message}"
|
66
75
|
end
|
67
76
|
end
|
68
77
|
end
|
data/lib/sysaid/activity.rb
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
require 'date'
|
2
2
|
|
3
3
|
class SysAid::Activity
|
4
|
-
attr_accessor :ciid, :cust_int1, :cust_int2, :cust_int3, :cust_int4, :cust_list1, :cust_list2, :description, :from_time,
|
5
|
-
:id, :sr_id, :to_time, :user
|
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
|
6
5
|
|
7
6
|
def initialize
|
8
7
|
reset_all_attributes
|
data/lib/sysaid/user.rb
CHANGED
@@ -26,13 +26,17 @@ class SysAid::User
|
|
26
26
|
|
27
27
|
# Loads the latest user information from the SysAid server
|
28
28
|
def refresh
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
29
|
+
begin
|
30
|
+
response = SysAid.client.call(:load_by_string_id, message: to_xml.to_s )
|
31
|
+
if response.to_hash[:load_by_string_id_response][:return]
|
32
|
+
set_self_from_response(response.to_hash[:load_by_string_id_response][:return])
|
33
|
+
return true
|
34
|
+
end
|
34
35
|
|
35
|
-
|
36
|
+
return false
|
37
|
+
rescue SocketError => e
|
38
|
+
raise SysAidException, "Unable to fetch user information from SysAid server: #{e.message}"
|
39
|
+
end
|
36
40
|
end
|
37
41
|
|
38
42
|
# Saves a user back to the SysAid server
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christopher Thielen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-02-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: savon
|