queri 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +38 -2
  3. data/lib/queri.rb +1 -1
  4. data/lib/queri/stats/answered_calls/answered_calls_by_direction.rb +74 -0
  5. data/lib/queri/stats/answered_calls/answered_calls_by_queue.rb +74 -0
  6. data/lib/queri/stats/answered_calls/answered_calls_by_stints.rb +73 -0
  7. data/lib/queri/stats/answered_calls/calls_fully_within_the_given_time_interval.rb +82 -0
  8. data/lib/queri/stats/answered_calls/disconnection_causes.rb +73 -0
  9. data/lib/queri/stats/answered_calls/dnis_used.rb +73 -0
  10. data/lib/queri/stats/answered_calls/ivr_selection.rb +77 -0
  11. data/lib/queri/stats/answered_calls/music_on_hold_by_agent.rb +72 -0
  12. data/lib/queri/stats/answered_calls/queue_position.rb +73 -0
  13. data/lib/queri/stats/answered_calls/service_level_agreement.rb +73 -0
  14. data/lib/queri/stats/answered_calls/transfers.rb +73 -0
  15. data/lib/queri/stats/details_of_agent_sessions_and_pauses/detail_of_agent_pauses.rb +81 -0
  16. data/lib/queri/stats/details_of_agent_sessions_and_pauses/detail_of_agent_sessions.rb +81 -0
  17. data/lib/queri/stats/details_of_agents_sessions_and_pauses.rb +11 -0
  18. data/lib/queri/version.rb +1 -1
  19. data/spec/queri_spec.rb +1 -1
  20. data/spec/realtime/agents_spec.rb +2 -0
  21. data/spec/realtime/queues_spec.rb +2 -0
  22. data/spec/spec_helper.rb +0 -2
  23. data/spec/stats/agents_and_sessions/agent_availability_spec.rb +2 -0
  24. data/spec/stats/answered_calls/agents_on_queue_spec.rb +2 -0
  25. data/spec/stats/answered_calls/all_calls_spec.rb +2 -0
  26. data/spec/stats/answered_calls/answered_calls_by_direction_spec.rb +22 -0
  27. data/spec/stats/answered_calls/answered_calls_by_queue_spec.rb +22 -0
  28. data/spec/stats/answered_calls/answered_calls_by_stints_spec.rb +22 -0
  29. data/spec/stats/answered_calls/calls_fully_within_the_given_time_interval_spec.rb +20 -0
  30. data/spec/stats/answered_calls/disconnection_causes_spec.rb +20 -0
  31. data/spec/stats/answered_calls/dnis_used_spec.rb +22 -0
  32. data/spec/stats/answered_calls/ivr_selection_spec.rb +22 -0
  33. data/spec/stats/answered_calls/music_on_hold_by_agent_spec.rb +20 -0
  34. data/spec/stats/answered_calls/queue_position_spec.rb +22 -0
  35. data/spec/stats/answered_calls/service_level_agreement_spec.rb +20 -0
  36. data/spec/stats/answered_calls/transfers_spec.rb +27 -0
  37. data/spec/stats/details_of_agent_sessions_and_pauses/detail_of_agent_pauses_spec.rb +20 -0
  38. data/spec/stats/details_of_agent_sessions_and_pauses/detail_of_agent_sessions_spec.rb +20 -0
  39. data/spec/stats/details_of_agent_sessions_and_pauses/details_of_agent_sessions_and_pauses_spec.rb +7 -0
  40. data/spec/stats/unanswered_calls/all_calls_spec.rb +2 -0
  41. data/spec/support/shared/shared_examples_for_composite_agent_level_report_instance.rb +37 -0
  42. data/spec/support/shared/shared_examples_for_composite_aggregate_report_instance.rb +38 -0
  43. metadata +48 -4
  44. data/spec/support/constantize.rb +0 -27
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c8ff886a7b69a9fdfe36380d9203f402fb8ed330
4
- data.tar.gz: 8ee9d637892fe1cf67970193e4ddaf8e9389f9a3
3
+ metadata.gz: 612927a2b34f04be0e348fe2e912d394c76f090f
4
+ data.tar.gz: 4190fbb0234b4030c19d99c27b657f46ed04aa83
5
5
  SHA512:
6
- metadata.gz: d7d5dd17f5d435eaf4aa22c97273af719770e3b44bf67b955ef7300010951c14444021a362618313802aef9b5acf478ac8a9785d6a3c06a238a8ad9f80a06799
7
- data.tar.gz: 031a8cfe9662fdb113fdada643bbdd209b6a2b603a4c9df3aac027150d97ea4f48099e5d4bdfcd126788bc870440dba790c30088f0c2b06eb4aee014df258c2a
6
+ metadata.gz: 94e0ac64d458d469c8cf265ba2ba992ce9dff4b6db946a92b86352540159a886923ca83d29b4f51e9c864cef890ef680df96a05ea2448d2cc7da4e3bb43b7601
7
+ data.tar.gz: 5dbf0d3d62ccfa59d13b0585fe29646ef9b30da8ba7460debc9a2aeff502894936817c5056fa0d09005eace22ecc95c725a6fe3f0d27962d0710ee7a2d55c294
data/README.md CHANGED
@@ -26,7 +26,7 @@ Configurations for connecting to a Queuemetrics XMLRPC client are needed to send
26
26
 
27
27
  You can set these configurations with the following:
28
28
 
29
- Queri::configure({username: "new\_user", password: "new\_password"})
29
+ Queri::configure({username: "new_user", password: "new_password"})
30
30
 
31
31
  or with a local YAML file:
32
32
 
@@ -38,7 +38,7 @@ or with a local YAML file:
38
38
  period_start = Time.now - 3600
39
39
  period_end = Time.now
40
40
  Queri::Stats::AgentsAndSessions::AgentAvailability.new( queues, period_start, period_end )
41
- #=> report\_object
41
+ #=> report_object
42
42
 
43
43
  These report objects respond to the method #response, which returns either an Array or a Hash, depending on whether the report is an agent-level or aggregate analysis.
44
44
  Keys for this response can be found by calling ::keys on the object class. ::key\_translations for the object class returns a hash associating these keys with the raw data keys returned from the XMLRPC client.
@@ -52,6 +52,20 @@ Currently returns analyses from two methods: QM.stats and QM.realtime.
52
52
  * AnsweredCalls
53
53
  * AgentsOnQueue
54
54
  * AllCalls
55
+ * AnsweredCallsByDirection
56
+ * AnsweredCallsByQueue
57
+ * AnsweredCallsByStints
58
+ * CallsFullyWithinGivenTimeInterval
59
+ * DisconnectionCauses
60
+ * DnisUsed
61
+ * IvrSelection
62
+ * MusicOnHoldByAgent
63
+ * QueuePosition
64
+ * ServiceLevelAgreement
65
+ * Transfers
66
+ * DetailsOfAgentSessionsAndPauses
67
+ * DetailOfAgentSessions
68
+ * DetailOfAgentPauses
55
69
  * UnansweredCalls
56
70
  * AllCalls
57
71
  * Realtime
@@ -70,7 +84,9 @@ Any subclass of Queri::Realtime will accept timestamps for period, but they will
70
84
 
71
85
  Returned values vary between agent-level and aggregate reports.
72
86
  Agent-level reports return an Array of Hashes, each Hash corresponding to an agent's metrics for the requested analysis.
87
+ Composite agent-level reports return a Hash associating agent usernames with an Array of Hashes (each record for the requested analysis).
73
88
  Aggregate reports return a single Hash; the composite metrics for the requested analysis.
89
+ Composite aggregate reports return an Array of Hashes, each Hash corresponding to various criteria for the composite metrics of the request analysis.
74
90
  * Agent-level reports
75
91
  * Stats
76
92
  * AgentsAndSessions
@@ -80,12 +96,32 @@ Aggregate reports return a single Hash; the composite metrics for the requested
80
96
  * Realtime
81
97
  * Agents
82
98
  * Queues
99
+ * Composite agent-level reports
100
+ * Stats
101
+ * AnsweredCalls
102
+ * MusicOnHoldByAgent
103
+ * DetailsOfAgentSessionsAndPauses
104
+ * DetailOfAgentSessions
105
+ * DetailOfAgentPauses
83
106
  * Aggregate reports
84
107
  * Stats
85
108
  * AnsweredCalls
86
109
  * AllCalls
110
+ * CallsFullyWithinGivenTimeInterval
87
111
  * UnansweredCalls
88
112
  * AllCalls
113
+ * Composite aggregate reports
114
+ * Stats
115
+ * AnsweredCalls
116
+ * AnsweredCallsByDirection
117
+ * AnsweredCallsByQueue
118
+ * AnsweredCallsByStints
119
+ * DisconnectionCauses
120
+ * DnisUsed
121
+ * IvrSelection
122
+ * QueuePosition
123
+ * ServiceLevelAgreement
124
+ * Transfers
89
125
 
90
126
  ## Contributing
91
127
 
data/lib/queri.rb CHANGED
@@ -56,7 +56,7 @@ module Queri
56
56
  end
57
57
 
58
58
  def self.send_request *args
59
- raise LoadError, "client configs not set. Assign by passing a hash to Queri.configure or a yaml file path to Queri.configure_with" if (@config.nil? || @config.empty?)
59
+ raise LoadError, "client configs not set. Assign by passing a hash to Queri.configure or a yaml file path to Queri.configure_with" if @@server.nil?
60
60
  request = Request.new(*args)
61
61
  response = @@server.call(*request.parameters)
62
62
  return response[request.report.class.xml_code]
@@ -0,0 +1,74 @@
1
+ module Queri
2
+ class Stats
3
+ class AnsweredCalls
4
+ class AnsweredCallsByDirection
5
+ attr_reader :response
6
+
7
+ class << self
8
+ def xml_code
9
+ AnsweredCalls.xml_code + ".AnsweredcallsByDirection"
10
+ end
11
+
12
+ def query_method
13
+ Stats.query_method
14
+ end
15
+
16
+ def key_translations
17
+ Hash[
18
+ :direction_icon, "&nbsp;",
19
+ :direction, "Direction",
20
+ :number_of_calls, "N. Calls",
21
+ :percentage_of_calls, "&nbsp;",
22
+ :placeholder_for_bar_graph, "..."
23
+ ]
24
+ end
25
+
26
+ def keys
27
+ key_translations.keys
28
+ end
29
+
30
+ end
31
+
32
+ def initialize *args
33
+ raise ArgumentError, "expected arguments: queues(Array), period_start(Time), period_end(Time)" unless valid_args?(args)
34
+ @queues, @period_start, @period_end = normalize_times(*args)
35
+ @response = parse_response
36
+ end
37
+
38
+ private
39
+
40
+ def valid_args? args
41
+ valid = true
42
+ valid = false if args[0].class != Array
43
+ valid = false if args[1].class != Time
44
+ valid = false if args[2].class != Time
45
+ if valid and args[0].empty?
46
+ raise ArgumentError, "queues array cannot be empty"
47
+ end
48
+ return valid
49
+ end
50
+
51
+ def normalize_times queues, period_start, period_end
52
+ if period_start > period_end
53
+ tmp = period_start
54
+ period_start = period_end
55
+ period_end = tmp
56
+ end
57
+ return [queues, period_start, period_end]
58
+ end
59
+
60
+ def parse_response
61
+ r = Queri.send_request(@queues, self, @period_start, @period_end)
62
+ xml_keys_to_human_readable_keys = self.class.key_translations.invert
63
+ new_keys = r.shift.map {|k| xml_keys_to_human_readable_keys[k]}
64
+ agent_metrics = []
65
+ r.each do |agent|
66
+ agent_metrics << Hash[new_keys.zip(agent)]
67
+ end
68
+ return agent_metrics
69
+ end
70
+
71
+ end
72
+ end
73
+ end
74
+ end
@@ -0,0 +1,74 @@
1
+ module Queri
2
+ class Stats
3
+ class AnsweredCalls
4
+ class AnsweredCallsByQueue
5
+ attr_reader :response
6
+
7
+ class << self
8
+ def xml_code
9
+ AnsweredCalls.xml_code + ".AnsweredcallsByQueue"
10
+ end
11
+
12
+ def query_method
13
+ Stats.query_method
14
+ end
15
+
16
+ def key_translations
17
+ Hash[
18
+ :empty_column, "&nbsp;",
19
+ :queue, "Queue",
20
+ :number_of_calls, "N. Calls",
21
+ :percentage_of_calls, "&nbsp;",
22
+ :placeholder_for_bar_graph, "..."
23
+ ]
24
+ end
25
+
26
+ def keys
27
+ key_translations.keys
28
+ end
29
+
30
+ end
31
+
32
+ def initialize *args
33
+ raise ArgumentError, "expected arguments: queues(Array), period_start(Time), period_end(Time)" unless valid_args?(args)
34
+ @queues, @period_start, @period_end = normalize_times(*args)
35
+ @response = parse_response
36
+ end
37
+
38
+ private
39
+
40
+ def valid_args? args
41
+ valid = true
42
+ valid = false if args[0].class != Array
43
+ valid = false if args[1].class != Time
44
+ valid = false if args[2].class != Time
45
+ if valid and args[0].empty?
46
+ raise ArgumentError, "queues array cannot be empty"
47
+ end
48
+ return valid
49
+ end
50
+
51
+ def normalize_times queues, period_start, period_end
52
+ if period_start > period_end
53
+ tmp = period_start
54
+ period_start = period_end
55
+ period_end = tmp
56
+ end
57
+ return [queues, period_start, period_end]
58
+ end
59
+
60
+ def parse_response
61
+ r = Queri.send_request(@queues, self, @period_start, @period_end)
62
+ xml_keys_to_human_readable_keys = self.class.key_translations.invert
63
+ new_keys = r.shift.map {|k| xml_keys_to_human_readable_keys[k]}
64
+ agent_metrics = []
65
+ r.each do |agent|
66
+ agent_metrics << Hash[new_keys.zip(agent)]
67
+ end
68
+ return agent_metrics
69
+ end
70
+
71
+ end
72
+ end
73
+ end
74
+ end
@@ -0,0 +1,73 @@
1
+ module Queri
2
+ class Stats
3
+ class AnsweredCalls
4
+ class AnsweredCallsByStints
5
+ attr_reader :response
6
+
7
+ class << self
8
+ def xml_code
9
+ AnsweredCalls.xml_code + ".StintsOk"
10
+ end
11
+
12
+ def query_method
13
+ Stats.query_method
14
+ end
15
+
16
+ def key_translations
17
+ Hash[
18
+ :number_of_stints, "Number of stints",
19
+ :number_of_calls, "N. Calls",
20
+ :percentage_of_calls, "&nbsp;",
21
+ :placeholder_for_bar_graph, "..."
22
+ ]
23
+ end
24
+
25
+ def keys
26
+ key_translations.keys
27
+ end
28
+
29
+ end
30
+
31
+ def initialize *args
32
+ raise ArgumentError, "expected arguments: queues(Array), period_start(Time), period_end(Time)" unless valid_args?(args)
33
+ @queues, @period_start, @period_end = normalize_times(*args)
34
+ @response = parse_response
35
+ end
36
+
37
+ private
38
+
39
+ def valid_args? args
40
+ valid = true
41
+ valid = false if args[0].class != Array
42
+ valid = false if args[1].class != Time
43
+ valid = false if args[2].class != Time
44
+ if valid and args[0].empty?
45
+ raise ArgumentError, "queues array cannot be empty"
46
+ end
47
+ return valid
48
+ end
49
+
50
+ def normalize_times queues, period_start, period_end
51
+ if period_start > period_end
52
+ tmp = period_start
53
+ period_start = period_end
54
+ period_end = tmp
55
+ end
56
+ return [queues, period_start, period_end]
57
+ end
58
+
59
+ def parse_response
60
+ r = Queri.send_request(@queues, self, @period_start, @period_end)
61
+ xml_keys_to_human_readable_keys = self.class.key_translations.invert
62
+ new_keys = r.shift.map {|k| xml_keys_to_human_readable_keys[k]}
63
+ agent_metrics = []
64
+ r.each do |agent|
65
+ agent_metrics << Hash[new_keys.zip(agent)]
66
+ end
67
+ return agent_metrics
68
+ end
69
+
70
+ end
71
+ end
72
+ end
73
+ end
@@ -0,0 +1,82 @@
1
+ module Queri
2
+ class Stats
3
+ class AnsweredCalls
4
+ class CallsFullyWithinTheGivenTimeInterval
5
+ attr_reader :response
6
+
7
+ class << self
8
+ def xml_code
9
+ AnsweredCalls.xml_code + ".RiassFullyWithin"
10
+ end
11
+
12
+ def query_method
13
+ Stats.query_method
14
+ end
15
+
16
+ def key_translations
17
+ Hash[
18
+ :calls_fully_within_the_given_time_interval, "Calls fully within the given time interval:",
19
+ :calls_answered, "N. calls answered by operators:",
20
+ :average_call_length, "Average call length:",
21
+ :minimum_call_length, "Min call length:",
22
+ :maximum_call_length, "Max call length:",
23
+ :total_call_length, "Total call length:",
24
+ :average_call_waiting_time, "Average call waiting time:",
25
+ :minimum_call_waiting_time, "Min waiting time:",
26
+ :maximum_call_waiting_time, "Max waiting time:",
27
+ :total_call_waiting_time, "Total waiting time:",
28
+ :average_initial_queue_position, "Average initial position",
29
+ :minimum_initial_queue_position, "Min initial position",
30
+ :maximum_initial_queue_position, "Max initial position",
31
+ :queue_position_coverage, "Coverage"
32
+ ]
33
+ end
34
+
35
+ def keys
36
+ key_translations.keys
37
+ end
38
+ end
39
+
40
+ def initialize *args
41
+ raise ArgumentError, "expected arguments: queues(Array), period_start(Time), period_end(Time)" unless valid_args?(args)
42
+ @queues, @period_start, @period_end = normalize_times(*args)
43
+ @response = parse_response
44
+ end
45
+
46
+ private
47
+
48
+ def valid_args? args
49
+ valid = true
50
+ valid = false if args[0].class != Array
51
+ valid = false if args[1].class != Time
52
+ valid = false if args[2].class != Time
53
+ if valid and args[0].empty?
54
+ raise ArgumentError, "queues array cannot be empty"
55
+ end
56
+ return valid
57
+ end
58
+
59
+ def normalize_times queues, period_start, period_end
60
+ if period_start > period_end
61
+ tmp = period_start
62
+ period_start = period_end
63
+ period_end = tmp
64
+ end
65
+ return [queues, period_start, period_end]
66
+ end
67
+
68
+ def parse_response
69
+ r = Queri.send_request(@queues, self, @period_start, @period_end)
70
+ xml_keys_to_human_readable_keys = self.class.key_translations.invert
71
+ r.each_with_index do |metric,i|
72
+ if i > 0
73
+ metric[0] = xml_keys_to_human_readable_keys[ metric[0] ]
74
+ end
75
+ end
76
+ r.shift
77
+ Hash[*r.flatten]
78
+ end
79
+ end
80
+ end
81
+ end
82
+ end
@@ -0,0 +1,73 @@
1
+ module Queri
2
+ class Stats
3
+ class AnsweredCalls
4
+ class DisconnectionCauses
5
+ attr_reader :response
6
+
7
+ class << self
8
+ def xml_code
9
+ AnsweredCalls.xml_code + ".DisconnectionCauses"
10
+ end
11
+
12
+ def query_method
13
+ Stats.query_method
14
+ end
15
+
16
+ def key_translations
17
+ Hash[
18
+ :disconnection_cause, "Cause",
19
+ :number_of_calls, "N. Calls",
20
+ :percentage_of_calls, "&nbsp;",
21
+ :placeholder_for_bar_graph, "..."
22
+ ]
23
+ end
24
+
25
+ def keys
26
+ key_translations.keys
27
+ end
28
+
29
+ end
30
+
31
+ def initialize *args
32
+ raise ArgumentError, "expected arguments: queues(Array), period_start(Time), period_end(Time)" unless valid_args?(args)
33
+ @queues, @period_start, @period_end = normalize_times(*args)
34
+ @response = parse_response
35
+ end
36
+
37
+ private
38
+
39
+ def valid_args? args
40
+ valid = true
41
+ valid = false if args[0].class != Array
42
+ valid = false if args[1].class != Time
43
+ valid = false if args[2].class != Time
44
+ if valid and args[0].empty?
45
+ raise ArgumentError, "queues array cannot be empty"
46
+ end
47
+ return valid
48
+ end
49
+
50
+ def normalize_times queues, period_start, period_end
51
+ if period_start > period_end
52
+ tmp = period_start
53
+ period_start = period_end
54
+ period_end = tmp
55
+ end
56
+ return [queues, period_start, period_end]
57
+ end
58
+
59
+ def parse_response
60
+ r = Queri.send_request(@queues, self, @period_start, @period_end)
61
+ xml_keys_to_human_readable_keys = self.class.key_translations.invert
62
+ new_keys = r.shift.map {|k| xml_keys_to_human_readable_keys[k]}
63
+ agent_metrics = []
64
+ r.each do |agent|
65
+ agent_metrics << Hash[new_keys.zip(agent)]
66
+ end
67
+ return agent_metrics
68
+ end
69
+
70
+ end
71
+ end
72
+ end
73
+ end