icws 1.0.0 → 2.0.0
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/CHANGELOG.md +1 -0
- data/RAKEFILE +6 -3
- data/README.md +50 -0
- data/RELEASING.md +33 -0
- data/lib/icws/connection.rb +54 -52
- data/lib/icws/status/status.rb +1 -1
- data/lib/icws/status/statusmessage.rb +38 -38
- metadata +4 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 575b2aa69177c2632359c9d1b0298b16c49e1b71
|
4
|
+
data.tar.gz: 3c6e99cb472ffd41cd54057173a30b8e6f2381ab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e47e6b5e566d612c802c8f90d2096c9afcc4ce09133b6e910912b345be5210023a63fcc73d9d5cbd8a3fa3568e741cd8114d1b59711c904d6b546f302d72256a
|
7
|
+
data.tar.gz: 9aa45ee9a97ea8399fc5c1fb9c1f4d2c550f7e5515a068f282090869e6f7c9e98952b9e751f55a7aa83cc17e7aa57b2c347a81efb6c2be98802cd5274b4481e7
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
### Next Release
|
data/RAKEFILE
CHANGED
@@ -1,12 +1,15 @@
|
|
1
1
|
require 'rake/testtask'
|
2
|
+
require 'rubygems'
|
3
|
+
require 'bundler'
|
4
|
+
|
5
|
+
Bundler::GemHelper.install_tasks
|
2
6
|
|
3
7
|
Rake::TestTask.new do |t|
|
4
8
|
t.libs << "test"
|
5
9
|
t.test_files = FileList.new('test/**/*.rb')
|
6
|
-
|
7
|
-
#t.test_files = FileList.new('test/test_connection.rb')
|
10
|
+
# t.test_files = FileList.new('test/*.rb')
|
8
11
|
t.verbose = true
|
9
12
|
end
|
10
13
|
|
11
14
|
desc "Run tests"
|
12
|
-
task :default => :test
|
15
|
+
task :default => :test
|
data/README.md
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
[](http://badge.fury.io/rb/icws)
|
2
|
+
|
3
|
+
A gem that wraps up the ICWS ReST api
|
4
|
+
|
5
|
+
Examples
|
6
|
+
==============
|
7
|
+
|
8
|
+
Making a Connection
|
9
|
+
|
10
|
+
``` ruby
|
11
|
+
connection = ICWS::Connection.new APPLICATIONNAME, SERVER
|
12
|
+
connection.connect USERID, PASSWORD
|
13
|
+
```
|
14
|
+
|
15
|
+
Deleting a user:
|
16
|
+
``` ruby
|
17
|
+
def delete_user(id, connection)
|
18
|
+
user_config = ICWS::Configuration::Users.new connection
|
19
|
+
user_config.delete URI.escape id
|
20
|
+
end
|
21
|
+
```
|
22
|
+
|
23
|
+
Create a Workgroup:
|
24
|
+
|
25
|
+
``` ruby
|
26
|
+
def setup_workgroup(workgroup_name, extension, connection)
|
27
|
+
workgroup_config = ICWS::Configuration::Workgroups.new connection
|
28
|
+
workgroups = workgroup_config.get_all.select {|r| r['configurationId']['id'] == workgroup_name}
|
29
|
+
|
30
|
+
workgroupId = workgroup_name
|
31
|
+
|
32
|
+
if(workgroups.length ==0)
|
33
|
+
new_workgroup = {
|
34
|
+
:queueType => 5,
|
35
|
+
:hasQueue => true,
|
36
|
+
:isActive => true,
|
37
|
+
:extension => extension
|
38
|
+
}
|
39
|
+
|
40
|
+
workgroup_config.create_new workgroupId, new_workgroup
|
41
|
+
end
|
42
|
+
end
|
43
|
+
```
|
44
|
+
|
45
|
+
Set a User's Status
|
46
|
+
|
47
|
+
``` ruby
|
48
|
+
status = ICWS::Status.new connection
|
49
|
+
status.set_user_status URI.escape(id), 'AVAILABLE'
|
50
|
+
```
|
data/RELEASING.md
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# Releasing ICWS
|
2
|
+
|
3
|
+
There're no particular rules about when to release ICWS. Release bug fixes frequenty, features not so frequently and breaking API changes rarely.
|
4
|
+
|
5
|
+
### Release
|
6
|
+
|
7
|
+
Run tests, check that all tests succeed locally.
|
8
|
+
|
9
|
+
```
|
10
|
+
bundle install
|
11
|
+
rake test
|
12
|
+
```
|
13
|
+
|
14
|
+
Check that the last build succeeded in [Travis CI](https://travis-ci.org/tim-vandecasteele/grape-swagger) for all supported platforms.
|
15
|
+
|
16
|
+
Increment the version, modify [icws.gemspec](icws.gemspec).
|
17
|
+
|
18
|
+
* Increment the third number if the release has bug fixes and/or very minor features, only (eg. change `0.7.1` to `0.7.2`).
|
19
|
+
* Increment the second number if the release contains major features or breaking API changes (eg. change `0.7.1` to `0.8.0`).
|
20
|
+
|
21
|
+
Change "Next Release" in [CHANGELOG.md](CHANGELOG.md) to the new version.
|
22
|
+
|
23
|
+
```
|
24
|
+
### 0.7.2 (February 6, 2014)
|
25
|
+
```
|
26
|
+
|
27
|
+
Commit your changes.
|
28
|
+
|
29
|
+
Release.
|
30
|
+
|
31
|
+
```
|
32
|
+
$ rake release
|
33
|
+
```
|
data/lib/icws/connection.rb
CHANGED
@@ -19,69 +19,71 @@ class ICWS
|
|
19
19
|
# @param password [String] the password for the user
|
20
20
|
def connect(user, password)
|
21
21
|
connectResponse = RestClient.post @server +'/icws/connection',
|
22
|
-
{
|
22
|
+
{
|
23
|
+
'__type' => "urn:inin.com:connection:icAuthConnectionRequestSettings",
|
24
|
+
:applicationName => @application_name,
|
23
25
|
:userID => user,
|
24
|
-
:password => password
|
25
|
-
|
26
|
-
|
27
|
-
|
26
|
+
:password => password
|
27
|
+
}.to_json,
|
28
|
+
:content_type => :json,
|
29
|
+
:accept => :json,
|
30
|
+
'Accept-Language' => 'en-us'
|
28
31
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
32
|
+
response = JSON.parse(connectResponse);
|
33
|
+
@cookie = connectResponse.headers[:set_cookie][0]
|
34
|
+
@csrf_token = response['csrfToken']
|
35
|
+
@session_id = response['sessionId']
|
33
36
|
|
34
|
-
|
37
|
+
end
|
35
38
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
39
|
+
# Gets the name of the application.
|
40
|
+
# @return [String] Application name.
|
41
|
+
def application_name
|
42
|
+
@application_name
|
43
|
+
end
|
41
44
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
45
|
+
# Gets the connection token.
|
46
|
+
# @return [String] connection token
|
47
|
+
def token
|
48
|
+
@csrf_token
|
49
|
+
end
|
47
50
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
51
|
+
# Gets the connection cookie.
|
52
|
+
# @return [String] connection cookie
|
53
|
+
def cookie
|
54
|
+
@cookie
|
55
|
+
end
|
53
56
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
57
|
+
# Gets the url of the server
|
58
|
+
# @return [String] the url of the server
|
59
|
+
def server
|
60
|
+
@server
|
61
|
+
end
|
59
62
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
63
|
+
# Gets the version of the server.
|
64
|
+
# @return the version of the server.
|
65
|
+
def version
|
66
|
+
JSON.parse RestClient.get @server+'/icws/connection/version'
|
67
|
+
end
|
65
68
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
69
|
+
# Gets the features of the server.
|
70
|
+
# @return [Array[ICWS::Connection::Features]] the features of the server
|
71
|
+
def features
|
72
|
+
data = JSON.parse RestClient.get @server+'/icws/connection/features'
|
73
|
+
features = data["featureInfoList"].map { |rd| ICWS::Connection::Feature.new(rd["featureId"], rd["version"]) }
|
74
|
+
end
|
72
75
|
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
76
|
+
# Generates a full uri given the resource path.
|
77
|
+
# @param path [String] The path to the ReST resource.
|
78
|
+
# @return [String] The full url.
|
79
|
+
def generate_uri(path)
|
80
|
+
base_uri + path
|
81
|
+
end
|
79
82
|
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
end
|
83
|
+
# Returns the base uri to the server, including the session id
|
84
|
+
# @return [String] The base url with session id.
|
85
|
+
def base_uri
|
86
|
+
@server+'/icws/' + @session_id
|
85
87
|
end
|
86
88
|
end
|
87
89
|
end
|
data/lib/icws/status/status.rb
CHANGED
@@ -13,7 +13,7 @@ class ICWS
|
|
13
13
|
def all_system_statuses
|
14
14
|
status_list = @client.get '/status/status-messages'
|
15
15
|
statuses = []
|
16
|
-
status_list['statusMessageList'].each {|s| statuses.push ICWS::StatusMessage.new(s)}
|
16
|
+
status_list['statusMessageList'].each {|s| statuses.push ICWS::Status::StatusMessage.new(s)}
|
17
17
|
return statuses
|
18
18
|
end
|
19
19
|
|
@@ -1,41 +1,41 @@
|
|
1
1
|
class ICWS
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
def initialize(property_map)
|
19
|
-
@status_id = property_map['statusId']
|
20
|
-
@message_text = property_map['messageText']
|
21
|
-
@icon_uri = property_map['iconUri']
|
22
|
-
@group_tag = property_map['groupTag']
|
23
|
-
@can_have_date = property_map['canHaveDate']
|
24
|
-
@can_have_time = property_map['canHaveTime']
|
25
|
-
@is_do_not_disturb_status = property_map['isDoNotDisturbStatus']
|
26
|
-
@is_selectable_status = property_map['isSelectableStatus']
|
27
|
-
@is_fersistent_status = property_map['isPersistentStatus']
|
28
|
-
@is_forward_status = property_map['isForwardStatus']
|
29
|
-
@is_after_call_work_status = property_map['isAfterCallWorkStatus']
|
30
|
-
@is_acd_status = property_map['isAcdStatus']
|
31
|
-
@is_allow_follow_up_status = property_map['isAllowFollowUpStatus']
|
32
|
-
@system_id = property_map['systemId']
|
33
|
-
end
|
34
|
-
|
35
|
-
def to_s
|
36
|
-
status_id + ', ' + message_text + ',' + icon_uri
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
2
|
+
class Status
|
3
|
+
class StatusMessage
|
4
|
+
attr_reader :status_id
|
5
|
+
attr_reader :message_text
|
6
|
+
attr_reader :icon_uri
|
7
|
+
attr_reader :group_tag
|
8
|
+
attr_reader :can_have_date
|
9
|
+
attr_reader :can_have_time
|
10
|
+
attr_reader :is_do_not_disturb_status
|
11
|
+
attr_reader :is_selectable_status
|
12
|
+
attr_reader :is_persistent_status
|
13
|
+
attr_reader :is_forward_status
|
14
|
+
attr_reader :is_after_call_work_status
|
15
|
+
attr_reader :is_acd_status
|
16
|
+
attr_reader :is_allow_follow_up_status
|
17
|
+
attr_reader :system_id
|
40
18
|
|
19
|
+
def initialize(property_map)
|
20
|
+
@status_id = property_map['statusId']
|
21
|
+
@message_text = property_map['messageText']
|
22
|
+
@icon_uri = property_map['iconUri']
|
23
|
+
@group_tag = property_map['groupTag']
|
24
|
+
@can_have_date = property_map['canHaveDate']
|
25
|
+
@can_have_time = property_map['canHaveTime']
|
26
|
+
@is_do_not_disturb_status = property_map['isDoNotDisturbStatus']
|
27
|
+
@is_selectable_status = property_map['isSelectableStatus']
|
28
|
+
@is_fersistent_status = property_map['isPersistentStatus']
|
29
|
+
@is_forward_status = property_map['isForwardStatus']
|
30
|
+
@is_after_call_work_status = property_map['isAfterCallWorkStatus']
|
31
|
+
@is_acd_status = property_map['isAcdStatus']
|
32
|
+
@is_allow_follow_up_status = property_map['isAllowFollowUpStatus']
|
33
|
+
@system_id = property_map['systemId']
|
34
|
+
end
|
41
35
|
|
36
|
+
def to_s
|
37
|
+
status_id + ', ' + message_text + ',' + icon_uri
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: icws
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin Glinski
|
@@ -44,8 +44,11 @@ executables: []
|
|
44
44
|
extensions: []
|
45
45
|
extra_rdoc_files: []
|
46
46
|
files:
|
47
|
+
- CHANGELOG.md
|
47
48
|
- LICENSE
|
48
49
|
- RAKEFILE
|
50
|
+
- README.md
|
51
|
+
- RELEASING.md
|
49
52
|
- lib/icws/configuration/configurationitem.rb
|
50
53
|
- lib/icws/configuration/roles.rb
|
51
54
|
- lib/icws/configuration/stations.rb
|