five9 0.0.5

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.
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in five9.gemspec
4
+ gemspec
5
+ require 'savon'
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 David Hahn
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,37 @@
1
+ # Five9
2
+
3
+ This RubyGem is a ruby integration for the five9 API. Currently, it is only partly integrated with the statistics API. The end goal is to have a full integration.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'five9'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install five9
18
+
19
+ ## Usage
20
+
21
+ In order to use this you will have to have an active account with [five9](www.five9.com).
22
+
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
27
+
28
+
29
+ For more details check out [Five9's API](http://www.five9.com/for_developers/call-center-cloud-computing.htm) for more details.
30
+
31
+ ## Contributing
32
+
33
+ 1. Fork it
34
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
35
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
36
+ 4. Push to the branch (`git push origin my-new-feature`)
37
+ 5. Create new Pull Request
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,19 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'five9/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "five9"
8
+ gem.version = Five9::VERSION
9
+ gem.authors = ["David Hahn"]
10
+ gem.email = ["dhahn@ctatechs.com"]
11
+ gem.description = %q{Rubygem integration with five9 API}
12
+ gem.summary = %q{Write a gem summary}
13
+ gem.homepage = ""
14
+
15
+ gem.files = `git ls-files`.split($/)
16
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
+ gem.require_paths = ["lib"]
19
+ end
@@ -0,0 +1,12 @@
1
+ require "five9/version"
2
+ require "five9/base"
3
+ require "five9/provision"
4
+ require "five9/statistics"
5
+ require "five9/agent_stats.rb"
6
+ require "five9/inbound_campaign_stats.rb"
7
+ require "five9/acd_status.rb"
8
+
9
+
10
+ module Five9
11
+ # Your code goes here...
12
+ end
@@ -0,0 +1,15 @@
1
+ module Five9
2
+ class AcdStatus < Statistics
3
+ def initialize(username,password,given_wsdl)
4
+ super(username,password)
5
+ end
6
+
7
+ def getStatistics(columns=[])
8
+ super("ACDStatus",columns)
9
+ end
10
+
11
+ def getStatisticsUpdate(long_polling_timeout=10000)
12
+ super("ACDStatus",long_polling_timeout)
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ module Five9
2
+ class AgentStats < Statistics
3
+ def initialize(username,password)
4
+ super(username,password)
5
+ end
6
+
7
+ def getStatistics(columns=[])
8
+ super("AgentStatistics",columns)
9
+ end
10
+
11
+ def getStatisticsUpdate(long_polling_timeout=10000)
12
+ super("AgentStatistics",long_polling_timeout)
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,11 @@
1
+ require 'savon'
2
+ module Five9
3
+ class Base
4
+ def initialize(username,password,given_wsdl)
5
+ @client = Savon::Client.new do
6
+ wsdl.document = given_wsdl + username
7
+ http.auth.basic(username,password)
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,15 @@
1
+ module Five9
2
+ class InboundCampaignStats < Statistics
3
+ def initialize(username,password)
4
+ super(username,password)
5
+ end
6
+
7
+ def getStatistics(columns=[])
8
+ super("InboundCampaignStatistics",columns=[])
9
+ end
10
+
11
+ def getStatisticsUpdate(long_polling_timeout=10000)
12
+ super("InboundCampaignStatistics",long_polling_timeout)
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,4 @@
1
+ module Five9
2
+ class Provision < Base
3
+ end
4
+ end
@@ -0,0 +1,41 @@
1
+ module Five9
2
+ class Statistics < Base
3
+ def initialize(username,password)
4
+ super(username,password,"https://api.five9.com/wssupervisor/SupervisorWebService?wsdl&user=")
5
+ @last_working_timestamp = nil
6
+ end
7
+
8
+ def setSessionParams(options)
9
+ @client.request :ser, :setSessionParameters, body: {viewSettings: {rollingPeriod: options[:rolling_period], shiftStart: options[:shift_start], statisticsRange: options[:statistics_range],timeZone: options[:time_zone]}}
10
+ end
11
+
12
+ def getStatistics(statistic_type,columns=[])
13
+ stats = []
14
+ response = @client.request :getStatistics, body: {statisticType: statistic_type, columnNames: {values: { data: columns}}}
15
+ data = response.to_array
16
+ @last_working_timestamp = data[0][:get_statistics_response][:return][:timestamp]
17
+ headers = data[0][:get_statistics_response][:return][:columns][:values][:data]
18
+ data[0][:get_statistics_response][:return][:rows].each do |row|
19
+ stats.push Hash[headers.zip row[:values][:data]]
20
+ end
21
+ return stats
22
+ end
23
+
24
+ def getStatisticsUpdate(statistic_type,long_polling_timeout=10000)
25
+ begin
26
+ prev_timestamp = @last_working_timestamp
27
+ response = @client.request :ser, :getStatisticsUpdate, body: {statisticType: statistic_type, previousTimestamp: prev_timestamp, longPollingTimeout: long_polling_timeout}
28
+ data = response.to_array
29
+ raise TypeError, "No Updated Statistics" if data[0][:get_statistics_update_response][:return].nil?
30
+ prev_timestamp = data[0][:get_statistics_update_response][:return][:last_timestamp]
31
+ stats = data[0][:get_statistics_update_response][:return][:data_update]
32
+ @last_working_timestamp = prev_timestamp
33
+ rescue TypeError => e
34
+ p e
35
+ p e.backtrace if !e.message.include?("No Updated Statistics")
36
+ return false
37
+ end
38
+ return stats
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,3 @@
1
+ module Five9
2
+ VERSION = "0.0.5"
3
+ end
metadata ADDED
@@ -0,0 +1,59 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: five9
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.5
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - David Hahn
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-04-08 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: Rubygem integration with five9 API
15
+ email:
16
+ - dhahn@ctatechs.com
17
+ executables: []
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - .gitignore
22
+ - Gemfile
23
+ - LICENSE.txt
24
+ - README.md
25
+ - Rakefile
26
+ - five9.gemspec
27
+ - lib/five9.rb
28
+ - lib/five9/acd_status.rb
29
+ - lib/five9/agent_stats.rb
30
+ - lib/five9/base.rb
31
+ - lib/five9/inbound_campaign_stats.rb
32
+ - lib/five9/provision.rb
33
+ - lib/five9/statistics.rb
34
+ - lib/five9/version.rb
35
+ homepage: ''
36
+ licenses: []
37
+ post_install_message:
38
+ rdoc_options: []
39
+ require_paths:
40
+ - lib
41
+ required_ruby_version: !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ! '>='
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ required_rubygems_version: !ruby/object:Gem::Requirement
48
+ none: false
49
+ requirements:
50
+ - - ! '>='
51
+ - !ruby/object:Gem::Version
52
+ version: '0'
53
+ requirements: []
54
+ rubyforge_project:
55
+ rubygems_version: 1.8.24
56
+ signing_key:
57
+ specification_version: 3
58
+ summary: Write a gem summary
59
+ test_files: []