queri 0.0.2 → 0.0.3

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.
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
@@ -0,0 +1,20 @@
1
+ require 'spec_helper'
2
+
3
+ describe Queri::Stats::AnsweredCalls::ServiceLevelAgreement do
4
+ let(:report_class) { Queri::Stats::AnsweredCalls::ServiceLevelAgreement }
5
+ let(:xml_code) { report_class.xml_code }
6
+
7
+ before { Queri.configure_with(File.join(File.dirname(__FILE__), '..', '..', 'config.yml')) }
8
+
9
+ it_behaves_like "a report class"
10
+
11
+ it_behaves_like "a report method"
12
+
13
+ it_behaves_like "a queuemetrics report"
14
+
15
+ it_behaves_like "a stats report"
16
+
17
+ describe "An instance of", Queri::Stats::AnsweredCalls::ServiceLevelAgreement do
18
+ it_behaves_like "a composite aggregate report instance"
19
+ end
20
+ end
@@ -0,0 +1,27 @@
1
+ require 'spec_helper'
2
+
3
+ describe Queri::Stats::AnsweredCalls::Transfers do
4
+ let(:report_class) { Queri::Stats::AnsweredCalls::Transfers }
5
+ let(:xml_code) { report_class.xml_code }
6
+
7
+ before do
8
+ Queri.configure_with(File.join(File.dirname(__FILE__), '..', '..', 'config.yml'))
9
+ Queri.stub(:send_request).and_return(
10
+ [["Transfer to", "N. Calls", " ", "..."],
11
+ ["211", "121", "10.0%", ""],
12
+ ["311", "122", "10.0%", ""]]
13
+ )
14
+ end
15
+
16
+ it_behaves_like "a report class"
17
+
18
+ it_behaves_like "a report method"
19
+
20
+ it_behaves_like "a queuemetrics report"
21
+
22
+ it_behaves_like "a stats report"
23
+
24
+ describe "An instance of", Queri::Stats::AnsweredCalls::Transfers do
25
+ it_behaves_like "a composite aggregate report instance"
26
+ end
27
+ end
@@ -0,0 +1,20 @@
1
+ require 'spec_helper'
2
+
3
+ describe Queri::Stats::DetailsOfAgentSessionsAndPauses::DetailOfAgentPauses do
4
+ let(:report_class) { Queri::Stats::DetailsOfAgentSessionsAndPauses::DetailOfAgentPauses }
5
+ let(:xml_code) { report_class.xml_code }
6
+
7
+ before { Queri.configure_with(File.join(File.dirname(__FILE__), '..', '..', 'config.yml')) }
8
+
9
+ it_behaves_like "a report class"
10
+
11
+ it_behaves_like "a report method"
12
+
13
+ it_behaves_like "a queuemetrics report"
14
+
15
+ it_behaves_like "a stats report"
16
+
17
+ describe "An instance of", Queri::Stats::DetailsOfAgentSessionsAndPauses::DetailOfAgentPauses do
18
+ it_behaves_like "a composite agent-level report instance"
19
+ end
20
+ end
@@ -0,0 +1,20 @@
1
+ require 'spec_helper'
2
+
3
+ describe Queri::Stats::DetailsOfAgentSessionsAndPauses::DetailOfAgentSessions do
4
+ let(:report_class) { Queri::Stats::DetailsOfAgentSessionsAndPauses::DetailOfAgentSessions }
5
+ let(:xml_code) { report_class.xml_code }
6
+
7
+ before { Queri.configure_with(File.join(File.dirname(__FILE__), '..', '..', 'config.yml')) }
8
+
9
+ it_behaves_like "a report class"
10
+
11
+ it_behaves_like "a report method"
12
+
13
+ it_behaves_like "a queuemetrics report"
14
+
15
+ it_behaves_like "a stats report"
16
+
17
+ describe "An instance of", Queri::Stats::DetailsOfAgentSessionsAndPauses::DetailOfAgentSessions do
18
+ it_behaves_like "a composite agent-level report instance"
19
+ end
20
+ end
@@ -0,0 +1,7 @@
1
+ require 'spec_helper'
2
+
3
+ describe Queri::Stats::DetailsOfAgentSessionsAndPauses do
4
+ let(:report_class) { Queri::Stats::DetailsOfAgentSessionsAndPauses }
5
+
6
+ it_behaves_like "a report class"
7
+ end
@@ -4,6 +4,8 @@ describe Queri::Stats::UnansweredCalls::AllCalls do
4
4
  let(:report_class) { Queri::Stats::UnansweredCalls::AllCalls }
5
5
  let(:xml_code) { report_class.xml_code }
6
6
 
7
+ before { Queri.configure_with(File.join(File.dirname(__FILE__), '..', '..', 'config.yml')) }
8
+
7
9
  it_behaves_like "a report class"
8
10
 
9
11
  it_behaves_like "a report method"
@@ -0,0 +1,37 @@
1
+ shared_examples "a composite agent-level report instance" do
2
+ let(:queues) { ["10000"] }
3
+ let(:period_start) { Time.now - 7200 }
4
+ let(:period_end) { Time.now - 3600 }
5
+
6
+ before do
7
+ @client = double(XMLRPC::Client)
8
+ @client.stub(:call).and_return( {xml_code => [report_class.keys]} )
9
+ end
10
+
11
+ subject { report_class.new(queues, period_start, period_end) }
12
+
13
+ it { should_not respond_to :response= }
14
+
15
+ describe "#response" do
16
+ subject { report_class.new(queues, period_start, period_end).response }
17
+
18
+ it "should respond" do
19
+ XMLRPC::Client.stub(:new).and_return(@client)
20
+ expect{ subject }.to_not raise_error
21
+ end
22
+
23
+ it "should be a Hash" do
24
+ XMLRPC::Client.stub(:new).and_return(@client)
25
+ subject.should be_a Hash
26
+ end
27
+
28
+ context "for a period during which records are saved" do
29
+ let(:period_start) { most_recent_11_am_hour }
30
+ let(:period_end) { most_recent_12_pm_hour }
31
+
32
+ it "should contain Arrays" do
33
+ subject.each {|_,v| v.should be_a Array}
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,38 @@
1
+ shared_examples "a composite aggregate report instance" do
2
+ let(:queues) { ["10000"] }
3
+ let(:period_start) { Time.now - 7200 }
4
+ let(:period_end) { Time.now - 3600 }
5
+
6
+ before do
7
+ @client = double(XMLRPC::Client)
8
+ @client.stub(:call).and_return( {xml_code => []} )
9
+ end
10
+
11
+ subject { report_class.new(queues, period_start, period_end) }
12
+
13
+ it { should_not respond_to :response= }
14
+
15
+ describe "#response" do
16
+ subject { report_class.new(queues, period_start, period_end).response }
17
+
18
+ it "should respond" do
19
+ XMLRPC::Client.stub(:new).and_return(@client)
20
+ expect{ subject }.to_not raise_error
21
+ end
22
+
23
+ it "should be an Array" do
24
+ XMLRPC::Client.stub(:new).and_return(@client)
25
+ subject.should be_a Array
26
+ end
27
+
28
+ context "for a period during which records are saved" do
29
+ let(:period_start) { most_recent_11_am_hour }
30
+ let(:period_end) { most_recent_12_pm_hour }
31
+
32
+ it "should contain Hashes" do
33
+ subject.should_not be_empty
34
+ subject.each {|obj| obj.should be_a Hash}
35
+ end
36
+ end
37
+ end
38
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: queri
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brad Rice
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-19 00:00:00.000000000 Z
11
+ date: 2014-01-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -75,6 +75,20 @@ files:
75
75
  - lib/queri/stats/answered_calls.rb
76
76
  - lib/queri/stats/answered_calls/agents_on_queue.rb
77
77
  - lib/queri/stats/answered_calls/all_calls.rb
78
+ - lib/queri/stats/answered_calls/answered_calls_by_direction.rb
79
+ - lib/queri/stats/answered_calls/answered_calls_by_queue.rb
80
+ - lib/queri/stats/answered_calls/answered_calls_by_stints.rb
81
+ - lib/queri/stats/answered_calls/calls_fully_within_the_given_time_interval.rb
82
+ - lib/queri/stats/answered_calls/disconnection_causes.rb
83
+ - lib/queri/stats/answered_calls/dnis_used.rb
84
+ - lib/queri/stats/answered_calls/ivr_selection.rb
85
+ - lib/queri/stats/answered_calls/music_on_hold_by_agent.rb
86
+ - lib/queri/stats/answered_calls/queue_position.rb
87
+ - lib/queri/stats/answered_calls/service_level_agreement.rb
88
+ - lib/queri/stats/answered_calls/transfers.rb
89
+ - lib/queri/stats/details_of_agent_sessions_and_pauses/detail_of_agent_pauses.rb
90
+ - lib/queri/stats/details_of_agent_sessions_and_pauses/detail_of_agent_sessions.rb
91
+ - lib/queri/stats/details_of_agents_sessions_and_pauses.rb
78
92
  - lib/queri/stats/unanswered_calls.rb
79
93
  - lib/queri/stats/unanswered_calls/all_calls.rb
80
94
  - lib/queri/version.rb
@@ -88,13 +102,28 @@ files:
88
102
  - spec/stats/agents_and_sessions/agents_and_sessions_spec.rb
89
103
  - spec/stats/answered_calls/agents_on_queue_spec.rb
90
104
  - spec/stats/answered_calls/all_calls_spec.rb
105
+ - spec/stats/answered_calls/answered_calls_by_direction_spec.rb
106
+ - spec/stats/answered_calls/answered_calls_by_queue_spec.rb
107
+ - spec/stats/answered_calls/answered_calls_by_stints_spec.rb
91
108
  - spec/stats/answered_calls/answered_calls_spec.rb
109
+ - spec/stats/answered_calls/calls_fully_within_the_given_time_interval_spec.rb
110
+ - spec/stats/answered_calls/disconnection_causes_spec.rb
111
+ - spec/stats/answered_calls/dnis_used_spec.rb
112
+ - spec/stats/answered_calls/ivr_selection_spec.rb
113
+ - spec/stats/answered_calls/music_on_hold_by_agent_spec.rb
114
+ - spec/stats/answered_calls/queue_position_spec.rb
115
+ - spec/stats/answered_calls/service_level_agreement_spec.rb
116
+ - spec/stats/answered_calls/transfers_spec.rb
117
+ - spec/stats/details_of_agent_sessions_and_pauses/detail_of_agent_pauses_spec.rb
118
+ - spec/stats/details_of_agent_sessions_and_pauses/detail_of_agent_sessions_spec.rb
119
+ - spec/stats/details_of_agent_sessions_and_pauses/details_of_agent_sessions_and_pauses_spec.rb
92
120
  - spec/stats/stats_spec.rb
93
121
  - spec/stats/unanswered_calls/all_calls_spec.rb
94
122
  - spec/stats/unanswered_calls/unanswered_calls_spec.rb
95
- - spec/support/constantize.rb
96
123
  - spec/support/shared/shared_examples_for_agent_level_report_instance.rb
97
124
  - spec/support/shared/shared_examples_for_aggregate_report_instance.rb
125
+ - spec/support/shared/shared_examples_for_composite_agent_level_report_instance.rb
126
+ - spec/support/shared/shared_examples_for_composite_aggregate_report_instance.rb
98
127
  - spec/support/shared/shared_examples_for_private_constant.rb
99
128
  - spec/support/shared/shared_examples_for_queuemetrics_report.rb
100
129
  - spec/support/shared/shared_examples_for_realtime_report.rb
@@ -137,13 +166,28 @@ test_files:
137
166
  - spec/stats/agents_and_sessions/agents_and_sessions_spec.rb
138
167
  - spec/stats/answered_calls/agents_on_queue_spec.rb
139
168
  - spec/stats/answered_calls/all_calls_spec.rb
169
+ - spec/stats/answered_calls/answered_calls_by_direction_spec.rb
170
+ - spec/stats/answered_calls/answered_calls_by_queue_spec.rb
171
+ - spec/stats/answered_calls/answered_calls_by_stints_spec.rb
140
172
  - spec/stats/answered_calls/answered_calls_spec.rb
173
+ - spec/stats/answered_calls/calls_fully_within_the_given_time_interval_spec.rb
174
+ - spec/stats/answered_calls/disconnection_causes_spec.rb
175
+ - spec/stats/answered_calls/dnis_used_spec.rb
176
+ - spec/stats/answered_calls/ivr_selection_spec.rb
177
+ - spec/stats/answered_calls/music_on_hold_by_agent_spec.rb
178
+ - spec/stats/answered_calls/queue_position_spec.rb
179
+ - spec/stats/answered_calls/service_level_agreement_spec.rb
180
+ - spec/stats/answered_calls/transfers_spec.rb
181
+ - spec/stats/details_of_agent_sessions_and_pauses/detail_of_agent_pauses_spec.rb
182
+ - spec/stats/details_of_agent_sessions_and_pauses/detail_of_agent_sessions_spec.rb
183
+ - spec/stats/details_of_agent_sessions_and_pauses/details_of_agent_sessions_and_pauses_spec.rb
141
184
  - spec/stats/stats_spec.rb
142
185
  - spec/stats/unanswered_calls/all_calls_spec.rb
143
186
  - spec/stats/unanswered_calls/unanswered_calls_spec.rb
144
- - spec/support/constantize.rb
145
187
  - spec/support/shared/shared_examples_for_agent_level_report_instance.rb
146
188
  - spec/support/shared/shared_examples_for_aggregate_report_instance.rb
189
+ - spec/support/shared/shared_examples_for_composite_agent_level_report_instance.rb
190
+ - spec/support/shared/shared_examples_for_composite_aggregate_report_instance.rb
147
191
  - spec/support/shared/shared_examples_for_private_constant.rb
148
192
  - spec/support/shared/shared_examples_for_queuemetrics_report.rb
149
193
  - spec/support/shared/shared_examples_for_realtime_report.rb
@@ -1,27 +0,0 @@
1
- module Constantize
2
- def constantize(camel_cased_word)
3
- names = camel_cased_word.split('::')
4
- names.shift if names.empty? || names.first.empty?
5
-
6
- names.inject(Object) do |constant, name|
7
- if constant == Object
8
- constant.const_get(name)
9
- else
10
- candidate = constant.const_get(name)
11
- next candidate if constant.const_defined?(name, false)
12
- next candidate unless Object.const_defined?(name)
13
-
14
- # Go down the ancestors to check it it's owned
15
- # directly before we reach Object or the end of ancestors.
16
- constant = constant.ancestors.inject do |const, ancestor|
17
- break const if ancestor == Object
18
- break ancestor if ancestor.const_defined?(name, false)
19
- const
20
- end
21
-
22
- # owner is in Object, so raise
23
- constant.const_get(name, false)
24
- end
25
- end
26
- end
27
- end