five9 0.0.5 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -21,9 +21,11 @@ Or install it yourself as:
21
21
  In order to use this you will have to have an active account with [five9](www.five9.com).
22
22
 
23
23
  agent_stats = Five9::AgentStats.new("exampleuser","examplepassword")
24
- agent_stats.setSessionParams(session={rolling_period: "Today", shift_start: 25200000, statistics_range: "CurrentDay", time_zone: -21600000}) //the numbers are in milliseconds.
25
- stats = a.getStatistics(["Total Calls","Avg Handle Time"])//leave empty to return all stats.
26
- updated_stats = a.getStatisticsUpdate
24
+ agent_stats.setSessionParams(session={rolling_period: "Today", shift_start: 25200000, statistics_range: "CurrentDay", time_zone: -21600000}) #the numbers are in milliseconds.
25
+ agent_stats.getStatistics(["Total Calls","Avg Handle Time"]) #leave empty to return all stats.
26
+ puts agent_stats.stats
27
+ agent_stats.getStatisticsUpdate
28
+ puts agent_stats.stats
27
29
 
28
30
 
29
31
  For more details check out [Five9's API](http://www.five9.com/for_developers/call-center-cloud-computing.htm) for more details.
data/five9.gemspec CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |gem|
10
10
  gem.email = ["dhahn@ctatechs.com"]
11
11
  gem.description = %q{Rubygem integration with five9 API}
12
12
  gem.summary = %q{Write a gem summary}
13
- gem.homepage = ""
13
+ gem.homepage = "https://github.com/CorporateTechnologyAdvantage/five9"
14
14
 
15
15
  gem.files = `git ls-files`.split($/)
16
16
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
@@ -1,15 +1,17 @@
1
1
  module Five9
2
2
  class AcdStatus < Statistics
3
- def initialize(username,password,given_wsdl)
3
+ attr_accessor :stats
4
+ def initialize(username,password)
5
+ @stats = nil
4
6
  super(username,password)
5
7
  end
6
8
 
7
9
  def getStatistics(columns=[])
8
- super("ACDStatus",columns)
10
+ @stats = super("ACDStatus",columns)
9
11
  end
10
12
 
11
13
  def getStatisticsUpdate(long_polling_timeout=10000)
12
- super("ACDStatus",long_polling_timeout)
14
+ super("ACDStatus","Skill Name",long_polling_timeout)
13
15
  end
14
16
  end
15
17
  end
@@ -1,15 +1,17 @@
1
1
  module Five9
2
2
  class AgentStats < Statistics
3
+ attr_accessor :stats
3
4
  def initialize(username,password)
5
+ @stats = nil
4
6
  super(username,password)
5
7
  end
6
8
 
7
9
  def getStatistics(columns=[])
8
- super("AgentStatistics",columns)
10
+ @stats = super("AgentStatistics",columns)
9
11
  end
10
12
 
11
13
  def getStatisticsUpdate(long_polling_timeout=10000)
12
- super("AgentStatistics",long_polling_timeout)
14
+ super("AgentStatistics","Username",long_polling_timeout)
13
15
  end
14
16
  end
15
17
  end
@@ -1,15 +1,17 @@
1
1
  module Five9
2
2
  class InboundCampaignStats < Statistics
3
+ attr_accessor :stats
3
4
  def initialize(username,password)
5
+ @stats = nil
4
6
  super(username,password)
5
7
  end
6
8
 
7
9
  def getStatistics(columns=[])
8
- super("InboundCampaignStatistics",columns=[])
10
+ @stats = super("InboundCampaignStatistics",columns)
9
11
  end
10
12
 
11
13
  def getStatisticsUpdate(long_polling_timeout=10000)
12
- super("InboundCampaignStatistics",long_polling_timeout)
14
+ super("InboundCampaignStatistics","Campaign Name",long_polling_timeout)
13
15
  end
14
16
  end
15
17
  end
@@ -21,7 +21,7 @@ module Five9
21
21
  return stats
22
22
  end
23
23
 
24
- def getStatisticsUpdate(statistic_type,long_polling_timeout=10000)
24
+ def getStatisticsUpdate(statistic_type, object_name,long_polling_timeout=10000)
25
25
  begin
26
26
  prev_timestamp = @last_working_timestamp
27
27
  response = @client.request :ser, :getStatisticsUpdate, body: {statisticType: statistic_type, previousTimestamp: prev_timestamp, longPollingTimeout: long_polling_timeout}
@@ -30,6 +30,7 @@ module Five9
30
30
  prev_timestamp = data[0][:get_statistics_update_response][:return][:last_timestamp]
31
31
  stats = data[0][:get_statistics_update_response][:return][:data_update]
32
32
  @last_working_timestamp = prev_timestamp
33
+ updateStats(stats,object_name)
33
34
  rescue TypeError => e
34
35
  p e
35
36
  p e.backtrace if !e.message.include?("No Updated Statistics")
@@ -37,5 +38,17 @@ module Five9
37
38
  end
38
39
  return stats
39
40
  end
41
+
42
+ private
43
+ def updateStats(updated_stats,object_name)
44
+ if updated_stats.class == Hash
45
+ @stats.each {|stat| stat[updated_stats[:column_name]] = updated_stats[:column_value] if updated_stats[:object_name] == stat[object_name]}
46
+ elsif updated_stats.class == Array
47
+ updated_stats.each do |updated_stat|
48
+ @stats.each {|stat| stat[updated_stat[:column_name]] = updated_stat[:column_value] if updated_stat[:object_name] == stat[object_name]}
49
+ end
50
+ end
51
+ updated_stats
52
+ end
40
53
  end
41
54
  end
data/lib/five9/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Five9
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.7"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: five9
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -32,7 +32,7 @@ files:
32
32
  - lib/five9/provision.rb
33
33
  - lib/five9/statistics.rb
34
34
  - lib/five9/version.rb
35
- homepage: ''
35
+ homepage: https://github.com/CorporateTechnologyAdvantage/five9
36
36
  licenses: []
37
37
  post_install_message:
38
38
  rdoc_options: []