voice_vault 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +3 -0
- data/Gemfile +8 -0
- data/README.md +13 -0
- data/Rakefile +11 -0
- data/example/config.yml.example +5 -0
- data/example/create.rb +49 -0
- data/example/verify.rb +58 -0
- data/lib/voice_vault.rb +9 -0
- data/lib/voice_vault/claimant.rb +38 -0
- data/lib/voice_vault/connection.rb +73 -0
- data/lib/voice_vault/dialogue.rb +90 -0
- data/lib/voice_vault/version.rb +3 -0
- data/spec/claimant_spec.rb +28 -0
- data/spec/dialogue_spec.rb +21 -0
- data/spec/spec_helper.rb +16 -0
- data/spec/support/config.rb +5 -0
- data/spec/vcr_cassettes/claimant.yml +186 -0
- data/spec/vcr_cassettes/dialogue.yml +151 -0
- data/voice_vault.gemspec +19 -0
- metadata +68 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 9390ead1be0a849d1b4b37fa5f0c201808dd7403
|
4
|
+
data.tar.gz: 54ad45c4a5e9408b8bb71ce9cac2250b71da1d44
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 3b5691111aaecd17ef7a6ac73639a65f624354dc5a72615e7922db22f53e370c8f87e3f6abc27fd2dbf2f7e53df69010692041ff5a42f0b050117a8dc6673f77
|
7
|
+
data.tar.gz: df0734e4e3860d1b05f5cb45595334234c76e3d854169cd3ce96a5ff8d66e9315600719c95f4948cf893c3db46d8b5d00020f117a7f956a00b9c4b9bbd45dccc
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# VoiceVault.com API wrapper
|
2
|
+
|
3
|
+
## License
|
4
|
+
|
5
|
+
(The MIT License)
|
6
|
+
|
7
|
+
Copyright © 2014 Bernard Potocki
|
8
|
+
|
9
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ‘Software’), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
data/example/create.rb
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
require_relative '../lib/voice_vault.rb'
|
2
|
+
require 'tempfile'
|
3
|
+
require 'yaml'
|
4
|
+
|
5
|
+
# Input your registration details here (from your self-registration welcome email)
|
6
|
+
config = YAML.load_file('config.yml')
|
7
|
+
|
8
|
+
server_url = config['VIGO_SERVER_URL']
|
9
|
+
credential_id = config['VIGO_CREDENTIAL_ID']
|
10
|
+
credential_password = config['VIGO_CREDENTIAL_PWD']
|
11
|
+
app_id = config['VIGO_APP_ID']
|
12
|
+
configuration_id = config['CONFIGURATION_ID']
|
13
|
+
|
14
|
+
# Create new connection for given credentials
|
15
|
+
connection = VoiceVault::Connection.new(server_url, credential_id, credential_password)
|
16
|
+
|
17
|
+
# Attempt to register a new claimant
|
18
|
+
claimant = VoiceVault::Claimant.create(connection, app_id)
|
19
|
+
puts "Registered claimant id: #{claimant.id}"
|
20
|
+
|
21
|
+
# Start a new dialogue for the claimant
|
22
|
+
dialogue = VoiceVault::Dialogue.create(claimant, configuration_id, reference: 'Ruby REST API sample')
|
23
|
+
puts "Started dialogue id: #{dialogue.id}"
|
24
|
+
|
25
|
+
begin
|
26
|
+
next_prompt = dialogue.prompt
|
27
|
+
|
28
|
+
puts "Requested input: #{next_prompt}."
|
29
|
+
puts "Recording in 3 seconds..."
|
30
|
+
sleep 3
|
31
|
+
|
32
|
+
file = Tempfile.new ["voice_vault", ".wav"]
|
33
|
+
|
34
|
+
system("rec -c 1 --endian little -r 8k -b 16 -V1 #{file.path} trim 0 00:05")
|
35
|
+
|
36
|
+
# Submit the recorded audio file to the new dialogue
|
37
|
+
result = dialogue.submit_phrase file, 'LittleEndian'
|
38
|
+
|
39
|
+
# Poll until processing completes.
|
40
|
+
until result != "TooManyUnprocessedPhrases"
|
41
|
+
sleep 1
|
42
|
+
result = dialogue.update_status
|
43
|
+
end
|
44
|
+
puts dialogue.last_sqm_decision unless dialogue.last_sqm_decision == "NotSet"
|
45
|
+
end while dialogue.status == "Started"
|
46
|
+
|
47
|
+
# Print the final status of the dialogue
|
48
|
+
puts "Dialogue completed. Status = #{dialogue.status}"
|
49
|
+
puts "Reason: #{dialogue.failure_reason}" if dialogue.status == "Failed"
|
data/example/verify.rb
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
require_relative '../lib/voice_vault.rb'
|
2
|
+
require 'tempfile'
|
3
|
+
require 'yaml'
|
4
|
+
|
5
|
+
unless ARGV.size == 1
|
6
|
+
puts("Usage: ruby #{__FILE__} claimant_id")
|
7
|
+
exit
|
8
|
+
end
|
9
|
+
|
10
|
+
claimant_id = ARGV[0]
|
11
|
+
|
12
|
+
# Input your registration details here (from your self-registration welcome email)
|
13
|
+
config = YAML.load_file('config.yml')
|
14
|
+
|
15
|
+
server_url = config['VIGO_SERVER_URL']
|
16
|
+
credential_id = config['VIGO_CREDENTIAL_ID']
|
17
|
+
credential_password = config['VIGO_CREDENTIAL_PWD']
|
18
|
+
configuration_id = config['CONFIGURATION_ID']
|
19
|
+
|
20
|
+
# Create new connection for given credentials
|
21
|
+
connection = VoiceVault::Connection.new(server_url, credential_id, credential_password)
|
22
|
+
|
23
|
+
# Attempt to register a new claimant
|
24
|
+
claimant = VoiceVault::Claimant.new(claimant_id, connection)
|
25
|
+
puts "Registered claimant id: #{claimant.id}"
|
26
|
+
|
27
|
+
# Start a new dialogue for the claimant
|
28
|
+
dialogue = VoiceVault::Dialogue.create(claimant, configuration_id, reference: 'Ruby REST API sample')
|
29
|
+
puts "Started dialogue id: #{dialogue.id}"
|
30
|
+
|
31
|
+
begin
|
32
|
+
next_prompt = dialogue.prompt
|
33
|
+
|
34
|
+
puts "Requested input: #{next_prompt}."
|
35
|
+
puts "Recording in 3 seconds..."
|
36
|
+
sleep 3
|
37
|
+
|
38
|
+
file = Tempfile.new ["voice_vault", ".wav"]
|
39
|
+
|
40
|
+
system("rec -c 1 --endian little -r 8k -b 16 -V1 #{file.path} trim 0 00:05")
|
41
|
+
|
42
|
+
# Submit the recorded audio file to the new dialogue
|
43
|
+
result = dialogue.submit_phrase file, 'LittleEndian'
|
44
|
+
|
45
|
+
# Poll until processing completes.
|
46
|
+
until result != "TooManyUnprocessedPhrases"
|
47
|
+
sleep 1
|
48
|
+
result = dialogue.update_status
|
49
|
+
end
|
50
|
+
puts dialogue.last_sqm_decision unless dialogue.last_sqm_decision == "NotSet"
|
51
|
+
end while dialogue.status == "Started"
|
52
|
+
|
53
|
+
# Print the final status of the dialogue
|
54
|
+
puts "Dialogue completed. Status = #{dialogue.status}"
|
55
|
+
case dialogue.status
|
56
|
+
when 'Failed' then puts "Reason: #{dialogue.failure_reason}"
|
57
|
+
when 'Succeeded' then puts "Verification decission: #{dialogue.verification_decision}"
|
58
|
+
end
|
data/lib/voice_vault.rb
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
module VoiceVault
|
2
|
+
class Error < StandardError; end
|
3
|
+
|
4
|
+
ROOT = File.expand_path(File.dirname(__FILE__))
|
5
|
+
|
6
|
+
autoload :Claimant, "#{ROOT}/voice_vault/claimant"
|
7
|
+
autoload :Connection, "#{ROOT}/voice_vault/connection"
|
8
|
+
autoload :Dialogue, "#{ROOT}/voice_vault/dialogue"
|
9
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module VoiceVault
|
2
|
+
class Claimant
|
3
|
+
|
4
|
+
# Register a new "claimant" to be enrolled within VoiceVault Fusion
|
5
|
+
# The organisation unit ID (GUID) representing the customer for this instance
|
6
|
+
# In email from VoiceVault it's named "VIGO_APP_ID"
|
7
|
+
def self.create(connection, app_id)
|
8
|
+
params = {
|
9
|
+
organisation_unit: app_id
|
10
|
+
}
|
11
|
+
result = connection.post "RegisterClaimant.ashx", params
|
12
|
+
|
13
|
+
raise VoiceVault::Error.new("Failed to register claimant: #{result["message"]}") if result["status_code"] != "0"
|
14
|
+
|
15
|
+
new(result["claimant_id"], connection)
|
16
|
+
end
|
17
|
+
|
18
|
+
attr_reader :id, :connection
|
19
|
+
|
20
|
+
def initialize(id, connection)
|
21
|
+
@id = id
|
22
|
+
@connection = connection
|
23
|
+
end
|
24
|
+
|
25
|
+
# Remove all data from VoiceVault servers
|
26
|
+
def destroy
|
27
|
+
params = {
|
28
|
+
claimant_id: @id
|
29
|
+
}
|
30
|
+
result = @connection.post "DeleteClaiamant.ashx", params
|
31
|
+
|
32
|
+
raise VoiceVault::Error.new("Failed to register claimant: #{result["message"]}") if result["status_code"] != "0"
|
33
|
+
|
34
|
+
result["request_status"]
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
require "net/http"
|
2
|
+
require "uri"
|
3
|
+
require "rexml/document"
|
4
|
+
|
5
|
+
module VoiceVault
|
6
|
+
class Connection
|
7
|
+
include REXML
|
8
|
+
|
9
|
+
FORM_BOUNDARY = "AaB03x"
|
10
|
+
|
11
|
+
attr_reader :server_url, :creds
|
12
|
+
|
13
|
+
# Instantiate the API helper
|
14
|
+
def initialize server_url, credential_id, credential_password
|
15
|
+
@server_url = server_url
|
16
|
+
@default_params = {"username" => credential_id, "password" => credential_password}
|
17
|
+
end
|
18
|
+
|
19
|
+
# Takes care of the HTTP POST to the VoiceVault Fusion REST API
|
20
|
+
# Taken directly from VoiceVault example.
|
21
|
+
def post page, params = {}
|
22
|
+
# Set up our HTTP request
|
23
|
+
uri = URI::join(@server_url, page)
|
24
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
25
|
+
http.use_ssl = true
|
26
|
+
request = Net::HTTP::Post.new(uri.request_uri)
|
27
|
+
|
28
|
+
# Add our credentials to the parameters before we construct the form
|
29
|
+
params.update @default_params
|
30
|
+
|
31
|
+
# If we have audio, we need to construct the multipart form by hand.
|
32
|
+
# Note: gems such as "multipart" or "rest_client" can greatly simplify this process
|
33
|
+
if audio_file = params.delete(:audio_file)
|
34
|
+
post_body = []
|
35
|
+
|
36
|
+
params.each do |k, v|
|
37
|
+
post_body << "--#{FORM_BOUNDARY}\r\n"
|
38
|
+
post_body << "Content-Disposition: form-data; name=\"#{k}\"\r\n\r\n#{v}\r\n"
|
39
|
+
end
|
40
|
+
|
41
|
+
post_body << "--#{FORM_BOUNDARY}\r\n"
|
42
|
+
post_body << "Content-Disposition: form-data; name=\"utterance\"; filename=\"audio.wav\"\r\n"
|
43
|
+
post_body << "Content-Type: audio/wav\r\n\r\n"
|
44
|
+
post_body << audio_file.read
|
45
|
+
post_body << "\r\n--#{FORM_BOUNDARY}--\r\n"
|
46
|
+
|
47
|
+
request.content_type = "multipart/form-data, boundary=#{FORM_BOUNDARY}"
|
48
|
+
request.body = post_body.join
|
49
|
+
else
|
50
|
+
# Much simpler if we're not doing a multipart submission!
|
51
|
+
request.set_form_data(params)
|
52
|
+
end
|
53
|
+
|
54
|
+
# Do the actual HTTP post
|
55
|
+
begin
|
56
|
+
response = http.request(request)
|
57
|
+
|
58
|
+
# And parse the XML response into a hash
|
59
|
+
response_xml = Document.new(response.body)
|
60
|
+
hash = {}
|
61
|
+
response_xml.elements.each("response_info/*") do |e|
|
62
|
+
hash[e.name()] = e.text
|
63
|
+
end
|
64
|
+
|
65
|
+
# Return the populated hash
|
66
|
+
hash
|
67
|
+
rescue => e
|
68
|
+
raise VoiceVault::Error.new(e.message)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,90 @@
|
|
1
|
+
module VoiceVault
|
2
|
+
class Dialogue
|
3
|
+
|
4
|
+
# Begin a new enrollment or verification dialogue
|
5
|
+
def self.create claimant, configuration_id, opts = {}
|
6
|
+
params = {
|
7
|
+
configuration_id: configuration_id,
|
8
|
+
claimant_id: claimant.id,
|
9
|
+
external_ref: opts[:reference],
|
10
|
+
language: opts[:language] || 'EnglishUnitedStates'
|
11
|
+
}
|
12
|
+
result = claimant.connection.post "StartDialogue.ashx", params
|
13
|
+
|
14
|
+
raise VoiceVault::Error.new("Failed to start dialogue: #{result["message"]}") if result["status_code"] != "0"
|
15
|
+
|
16
|
+
new(result["dialogue_id"], claimant, prompt: result["prompt_hint"])
|
17
|
+
end
|
18
|
+
|
19
|
+
attr_reader :id, :connection, :prompt, :status, :failure_reason, :last_sqm_decision, :verification_decision
|
20
|
+
|
21
|
+
def initialize(id, claimant, opts = {})
|
22
|
+
@id = id
|
23
|
+
@claimant = claimant
|
24
|
+
@connection = claimant.connection
|
25
|
+
@prompt = opts[:prompt]
|
26
|
+
@status = opts[:status] || "Started"
|
27
|
+
end
|
28
|
+
|
29
|
+
# Submit audio VoiceVault servers
|
30
|
+
# Supported formats are: 'SmallEndian', 'BigEndian', 'ALaw' and 'MuLaw'
|
31
|
+
def submit_phrase file, format, opts = {}
|
32
|
+
params = {
|
33
|
+
dialogue_id: @id,
|
34
|
+
prompt: opts[:prompt] || @prompt,
|
35
|
+
format: format,
|
36
|
+
audio_file: file
|
37
|
+
}
|
38
|
+
result = @connection.post "SubmitPhrase.ashx", params
|
39
|
+
|
40
|
+
handle_result(result)
|
41
|
+
end
|
42
|
+
|
43
|
+
# Retrieve the status of a dialogue
|
44
|
+
def update_status
|
45
|
+
params = {
|
46
|
+
dialogue_id: @id
|
47
|
+
}
|
48
|
+
result = @connection.post "GetDialogueSummary.ashx", params
|
49
|
+
|
50
|
+
handle_result(result)
|
51
|
+
end
|
52
|
+
|
53
|
+
# Destroy current dialogue - especially important during enrollment dialogues as
|
54
|
+
# only one can be active at the same time.
|
55
|
+
def destroy
|
56
|
+
params = {
|
57
|
+
dialogue_id: @id
|
58
|
+
}
|
59
|
+
result = @connection.post "AbortDialogue.ashx", params
|
60
|
+
|
61
|
+
handle_result(result)
|
62
|
+
end
|
63
|
+
|
64
|
+
# Informs VoiceVault servers that current conversation should be used for
|
65
|
+
# improving claimant pattern.
|
66
|
+
def adapt
|
67
|
+
params = {
|
68
|
+
claimant_id: @claimant.id,
|
69
|
+
dialogue_id: @id
|
70
|
+
}
|
71
|
+
result = @connection.post "AdaptClaiamant.ashx", params
|
72
|
+
|
73
|
+
handle_result(result)
|
74
|
+
end
|
75
|
+
|
76
|
+
private
|
77
|
+
|
78
|
+
def handle_result(result)
|
79
|
+
raise VoiceVault::Error.new("Failed to get dialogue summary: #{result["message"]}") if result["status_code"] != "0"
|
80
|
+
@status = result["dialogue_status"]
|
81
|
+
@prompt = result["prompt_hint"]
|
82
|
+
@failure_reason = result["failure_reason"]
|
83
|
+
@last_sqm_decision = result["last_sqm_decision"]
|
84
|
+
@verification_decision = result["verification_decision"]
|
85
|
+
|
86
|
+
result["request_status"]
|
87
|
+
end
|
88
|
+
|
89
|
+
end
|
90
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe VoiceVault::Claimant, vcr: { cassette_name: 'claimant', record: :new_episodes, match_requests_on: [:method, :uri, :body] } do
|
4
|
+
let(:connection) { VoiceVault::Connection.new(server_url, credential_id, credential_password) }
|
5
|
+
subject { VoiceVault::Claimant.create(connection, app_id) }
|
6
|
+
|
7
|
+
its(:class) { is_expected.to eql(VoiceVault::Claimant) }
|
8
|
+
its(:id) { is_expected.to eql('73c32c2b-c4b2-47ac-94d3-539b0ac838fc') }
|
9
|
+
its(:connection) { eql(connection) }
|
10
|
+
|
11
|
+
context "#create" do
|
12
|
+
it "should raise exception on invalid app id" do
|
13
|
+
expect{ VoiceVault::Claimant.create(connection, "invalid") }.to raise_error(VoiceVault::Error, "Failed to register claimant: Value cannot be null.\nParameter name: organisation_unit")
|
14
|
+
end
|
15
|
+
it "should raise exception on invalid server_url" do
|
16
|
+
connection = VoiceVault::Connection.new("http://invalid.com", credential_id, credential_password)
|
17
|
+
expect{ VoiceVault::Claimant.create(connection, app_id) }.to raise_error(VoiceVault::Error, "SSL_connect returned=1 errno=0 state=SSLv2/v3 read server hello A: unknown protocol")
|
18
|
+
end
|
19
|
+
it "should raise exception on invalid credential_id" do
|
20
|
+
connection = VoiceVault::Connection.new(server_url, "invalid_id", credential_password)
|
21
|
+
expect{ VoiceVault::Claimant.create(connection, app_id) }.to raise_error(VoiceVault::Error, "Failed to register claimant: Error delegating to SOAP service")
|
22
|
+
end
|
23
|
+
it "should raise exception on invalid credential_id" do
|
24
|
+
connection = VoiceVault::Connection.new(server_url, credential_id, "invalid_password")
|
25
|
+
expect{ VoiceVault::Claimant.create(connection, app_id) }.to raise_error(VoiceVault::Error, "Failed to register claimant: Error delegating to SOAP service")
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe VoiceVault::Dialogue, vcr: { cassette_name: 'dialogue', record: :new_episodes, match_requests_on: [:method, :uri, :body] } do
|
4
|
+
let(:connection) { VoiceVault::Connection.new(server_url, credential_id, credential_password) }
|
5
|
+
let(:claimant) { VoiceVault::Claimant.create(connection, app_id) }
|
6
|
+
subject { VoiceVault::Dialogue.create(claimant, configuration_id) }
|
7
|
+
|
8
|
+
its(:class) { is_expected.to eql(VoiceVault::Dialogue) }
|
9
|
+
its(:id) { is_expected.to eql('c19156b8-829b-ab71-b92a-177e49a3c22f') }
|
10
|
+
its(:connection) { is_expected.to eql(connection) }
|
11
|
+
its(:prompt) { is_expected.to eql('2459') }
|
12
|
+
its(:status) { is_expected.to eql('Started') }
|
13
|
+
its(:failure_reason) { is_expected.to be_nil }
|
14
|
+
its(:last_sqm_decision) { is_expected.to be_nil }
|
15
|
+
its(:verification_decision) { is_expected.to be_nil }
|
16
|
+
|
17
|
+
it "#update_status should return status" do
|
18
|
+
expect(subject.update_status).to eql("OK")
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'rspec'
|
2
|
+
require 'rspec/its'
|
3
|
+
require 'vcr'
|
4
|
+
|
5
|
+
require 'voice_vault'
|
6
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
7
|
+
|
8
|
+
RSpec.configure do |c|
|
9
|
+
c.extend VCR::RSpec::Macros
|
10
|
+
end
|
11
|
+
|
12
|
+
VCR.configure do |c|
|
13
|
+
c.cassette_library_dir = 'spec/vcr_cassettes'
|
14
|
+
c.hook_into :webmock
|
15
|
+
c.configure_rspec_metadata!
|
16
|
+
end
|
@@ -0,0 +1,5 @@
|
|
1
|
+
def server_url; ENV['VIGO_SERVER_URL'] || 'https://example.org/'; end
|
2
|
+
def credential_id; ENV['VIGO_CREDENTIAL_ID'] || 'fake_credential_id'; end
|
3
|
+
def credential_password; ENV['VIGO_CREDENTIAL_PWD'] || 'fake_credential_password'; end
|
4
|
+
def app_id; ENV['VIGO_APP_ID'] || 'fake_app_id'; end
|
5
|
+
def configuration_id; ENV['VIGO_CONFIGURATION_ID'] || 'fake_configuration_id'; end
|
@@ -0,0 +1,186 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://invalid.voicevault.net/RestApi000/RegisterClaimant.ashx
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: organisation_unit=fake_app_id&username=fake_credential_id&password=fake_credential_password
|
9
|
+
headers:
|
10
|
+
Accept-Encoding:
|
11
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
12
|
+
Accept:
|
13
|
+
- "*/*"
|
14
|
+
User-Agent:
|
15
|
+
- Ruby
|
16
|
+
Content-Type:
|
17
|
+
- application/x-www-form-urlencoded
|
18
|
+
response:
|
19
|
+
status:
|
20
|
+
code: 200
|
21
|
+
message: OK
|
22
|
+
headers:
|
23
|
+
Cache-Control:
|
24
|
+
- private
|
25
|
+
Content-Type:
|
26
|
+
- text/xml; charset=utf-8
|
27
|
+
Vary:
|
28
|
+
- Accept-Encoding
|
29
|
+
Server:
|
30
|
+
- Microsoft-IIS/8.0
|
31
|
+
X-Aspnet-Version:
|
32
|
+
- 4.0.30319
|
33
|
+
X-Powered-By:
|
34
|
+
- ASP.NET
|
35
|
+
Date:
|
36
|
+
- Fri, 13 Jun 2014 10:42:23 GMT
|
37
|
+
Content-Length:
|
38
|
+
- '300'
|
39
|
+
body:
|
40
|
+
encoding: UTF-8
|
41
|
+
string: |
|
42
|
+
<?xml version="1.0" encoding="ISO-8859-1"?>
|
43
|
+
<response_info xmlns="http://www.voicevault.com">
|
44
|
+
<status_code>0</status_code>
|
45
|
+
<message>success</message>
|
46
|
+
<claimant_id>73c32c2b-c4b2-47ac-94d3-539b0ac838fc</claimant_id>
|
47
|
+
</response_info>
|
48
|
+
http_version:
|
49
|
+
recorded_at: Fri, 13 Jun 2014 10:42:21 GMT
|
50
|
+
- request:
|
51
|
+
method: post
|
52
|
+
uri: https://invalid.voicevault.net/RestApi000/RegisterClaimant.ashx
|
53
|
+
body:
|
54
|
+
encoding: US-ASCII
|
55
|
+
string: organisation_unit=invalid&username=fake_credential_id&password=fake_credential_password
|
56
|
+
headers:
|
57
|
+
Accept-Encoding:
|
58
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
59
|
+
Accept:
|
60
|
+
- "*/*"
|
61
|
+
User-Agent:
|
62
|
+
- Ruby
|
63
|
+
Content-Type:
|
64
|
+
- application/x-www-form-urlencoded
|
65
|
+
response:
|
66
|
+
status:
|
67
|
+
code: 200
|
68
|
+
message: OK
|
69
|
+
headers:
|
70
|
+
Cache-Control:
|
71
|
+
- private
|
72
|
+
Content-Type:
|
73
|
+
- text/xml; charset=utf-8
|
74
|
+
Vary:
|
75
|
+
- Accept-Encoding
|
76
|
+
Server:
|
77
|
+
- Microsoft-IIS/8.0
|
78
|
+
X-Aspnet-Version:
|
79
|
+
- 4.0.30319
|
80
|
+
X-Powered-By:
|
81
|
+
- ASP.NET
|
82
|
+
Date:
|
83
|
+
- Fri, 13 Jun 2014 10:42:23 GMT
|
84
|
+
Content-Length:
|
85
|
+
- '309'
|
86
|
+
body:
|
87
|
+
encoding: UTF-8
|
88
|
+
string: "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n<response_info xmlns=\"http://www.voicevault.com\">\n<status_code>2</status_code>\n<message>Value
|
89
|
+
cannot be null.\r\nParameter name: organisation_unit</message>\n<claimant_id>(null)</claimant_id>\n</response_info>\n"
|
90
|
+
http_version:
|
91
|
+
recorded_at: Fri, 13 Jun 2014 10:42:22 GMT
|
92
|
+
- request:
|
93
|
+
method: post
|
94
|
+
uri: https://invalid.voicevault.net/RestApi000/RegisterClaimant.ashx
|
95
|
+
body:
|
96
|
+
encoding: US-ASCII
|
97
|
+
string: organisation_unit=fake_app_id&username=invalid_id&password=fake_credential_password
|
98
|
+
headers:
|
99
|
+
Accept-Encoding:
|
100
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
101
|
+
Accept:
|
102
|
+
- "*/*"
|
103
|
+
User-Agent:
|
104
|
+
- Ruby
|
105
|
+
Content-Type:
|
106
|
+
- application/x-www-form-urlencoded
|
107
|
+
response:
|
108
|
+
status:
|
109
|
+
code: 200
|
110
|
+
message: OK
|
111
|
+
headers:
|
112
|
+
Cache-Control:
|
113
|
+
- private
|
114
|
+
Content-Type:
|
115
|
+
- text/xml; charset=utf-8
|
116
|
+
Vary:
|
117
|
+
- Accept-Encoding
|
118
|
+
Server:
|
119
|
+
- Microsoft-IIS/8.0
|
120
|
+
X-Aspnet-Version:
|
121
|
+
- 4.0.30319
|
122
|
+
X-Powered-By:
|
123
|
+
- ASP.NET
|
124
|
+
Date:
|
125
|
+
- Fri, 13 Jun 2014 10:42:23 GMT
|
126
|
+
Content-Length:
|
127
|
+
- '289'
|
128
|
+
body:
|
129
|
+
encoding: UTF-8
|
130
|
+
string: |
|
131
|
+
<?xml version="1.0" encoding="ISO-8859-1"?>
|
132
|
+
<response_info xmlns="http://www.voicevault.com">
|
133
|
+
<status_code>1</status_code>
|
134
|
+
<message>Error delegating to SOAP service</message>
|
135
|
+
<claimant_id>(null)</claimant_id>
|
136
|
+
</response_info>
|
137
|
+
http_version:
|
138
|
+
recorded_at: Fri, 13 Jun 2014 10:42:24 GMT
|
139
|
+
- request:
|
140
|
+
method: post
|
141
|
+
uri: https://invalid.voicevault.net/RestApi000/RegisterClaimant.ashx
|
142
|
+
body:
|
143
|
+
encoding: US-ASCII
|
144
|
+
string: organisation_unit=fake_app_id&username=fake_credential_id&password=invalid_password
|
145
|
+
headers:
|
146
|
+
Accept-Encoding:
|
147
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
148
|
+
Accept:
|
149
|
+
- "*/*"
|
150
|
+
User-Agent:
|
151
|
+
- Ruby
|
152
|
+
Content-Type:
|
153
|
+
- application/x-www-form-urlencoded
|
154
|
+
response:
|
155
|
+
status:
|
156
|
+
code: 200
|
157
|
+
message: OK
|
158
|
+
headers:
|
159
|
+
Cache-Control:
|
160
|
+
- private
|
161
|
+
Content-Type:
|
162
|
+
- text/xml; charset=utf-8
|
163
|
+
Vary:
|
164
|
+
- Accept-Encoding
|
165
|
+
Server:
|
166
|
+
- Microsoft-IIS/8.0
|
167
|
+
X-Aspnet-Version:
|
168
|
+
- 4.0.30319
|
169
|
+
X-Powered-By:
|
170
|
+
- ASP.NET
|
171
|
+
Date:
|
172
|
+
- Fri, 13 Jun 2014 10:43:36 GMT
|
173
|
+
Content-Length:
|
174
|
+
- '289'
|
175
|
+
body:
|
176
|
+
encoding: UTF-8
|
177
|
+
string: |
|
178
|
+
<?xml version="1.0" encoding="ISO-8859-1"?>
|
179
|
+
<response_info xmlns="http://www.voicevault.com">
|
180
|
+
<status_code>1</status_code>
|
181
|
+
<message>Error delegating to SOAP service</message>
|
182
|
+
<claimant_id>(null)</claimant_id>
|
183
|
+
</response_info>
|
184
|
+
http_version:
|
185
|
+
recorded_at: Fri, 13 Jun 2014 10:43:37 GMT
|
186
|
+
recorded_with: VCR 2.9.2
|
@@ -0,0 +1,151 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://invalid.voicevault.net/RestApi000/RegisterClaimant.ashx
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: organisation_unit=fake_app_id&username=fake_credential_id&password=fake_credential_password
|
9
|
+
headers:
|
10
|
+
Accept-Encoding:
|
11
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
12
|
+
Accept:
|
13
|
+
- "*/*"
|
14
|
+
User-Agent:
|
15
|
+
- Ruby
|
16
|
+
Content-Type:
|
17
|
+
- application/x-www-form-urlencoded
|
18
|
+
response:
|
19
|
+
status:
|
20
|
+
code: 200
|
21
|
+
message: OK
|
22
|
+
headers:
|
23
|
+
Cache-Control:
|
24
|
+
- private
|
25
|
+
Content-Type:
|
26
|
+
- text/xml; charset=utf-8
|
27
|
+
Vary:
|
28
|
+
- Accept-Encoding
|
29
|
+
Server:
|
30
|
+
- Microsoft-IIS/8.0
|
31
|
+
X-Aspnet-Version:
|
32
|
+
- 4.0.30319
|
33
|
+
X-Powered-By:
|
34
|
+
- ASP.NET
|
35
|
+
Date:
|
36
|
+
- Fri, 13 Jun 2014 10:42:23 GMT
|
37
|
+
Content-Length:
|
38
|
+
- '300'
|
39
|
+
body:
|
40
|
+
encoding: UTF-8
|
41
|
+
string: |
|
42
|
+
<?xml version="1.0" encoding="ISO-8859-1"?>
|
43
|
+
<response_info xmlns="http://www.voicevault.com">
|
44
|
+
<status_code>0</status_code>
|
45
|
+
<message>success</message>
|
46
|
+
<claimant_id>73c32c2b-c4b2-47ac-94d3-539b0ac838fc</claimant_id>
|
47
|
+
</response_info>
|
48
|
+
http_version:
|
49
|
+
recorded_at: Fri, 13 Jun 2014 10:42:21 GMT
|
50
|
+
- request:
|
51
|
+
method: post
|
52
|
+
uri: https://invalid.voicevault.net/RestApi000/StartDialogue.ashx
|
53
|
+
body:
|
54
|
+
encoding: US-ASCII
|
55
|
+
string: configuration_id=fake_configuration_id&claimant_id=73c32c2b-c4b2-47ac-94d3-539b0ac838fc&external_ref&language=EnglishUnitedStates&username=fake_credential_id&password=fake_credential_password
|
56
|
+
headers:
|
57
|
+
Accept-Encoding:
|
58
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
59
|
+
Accept:
|
60
|
+
- "*/*"
|
61
|
+
User-Agent:
|
62
|
+
- Ruby
|
63
|
+
Content-Type:
|
64
|
+
- application/x-www-form-urlencoded
|
65
|
+
response:
|
66
|
+
status:
|
67
|
+
code: 200
|
68
|
+
message: OK
|
69
|
+
headers:
|
70
|
+
Cache-Control:
|
71
|
+
- private
|
72
|
+
Content-Type:
|
73
|
+
- text/xml; charset=utf-8
|
74
|
+
Vary:
|
75
|
+
- Accept-Encoding
|
76
|
+
Server:
|
77
|
+
- Microsoft-IIS/8.0
|
78
|
+
X-Aspnet-Version:
|
79
|
+
- 4.0.30319
|
80
|
+
X-Powered-By:
|
81
|
+
- ASP.NET
|
82
|
+
Date:
|
83
|
+
- Fri, 13 Jun 2014 10:59:45 GMT
|
84
|
+
Content-Length:
|
85
|
+
- '336'
|
86
|
+
body:
|
87
|
+
encoding: UTF-8
|
88
|
+
string: |
|
89
|
+
<?xml version="1.0" encoding="ISO-8859-1"?>
|
90
|
+
<response_info xmlns="http://www.voicevault.com">
|
91
|
+
<status_code>0</status_code>
|
92
|
+
<message>success</message>
|
93
|
+
<dialogue_id>c19156b8-829b-ab71-b92a-177e49a3c22f</dialogue_id>
|
94
|
+
<prompt_hint>2459</prompt_hint>
|
95
|
+
<process_type>Enrol</process_type>
|
96
|
+
</response_info>
|
97
|
+
http_version:
|
98
|
+
recorded_at: Fri, 13 Jun 2014 10:59:46 GMT
|
99
|
+
- request:
|
100
|
+
method: post
|
101
|
+
uri: https://invalid.voicevault.net/RestApi000/GetDialogueSummary.ashx
|
102
|
+
body:
|
103
|
+
encoding: US-ASCII
|
104
|
+
string: dialogue_id=c19156b8-829b-ab71-b92a-177e49a3c22f&username=fake_credential_id&password=fake_credential_password
|
105
|
+
headers:
|
106
|
+
Accept-Encoding:
|
107
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
108
|
+
Accept:
|
109
|
+
- "*/*"
|
110
|
+
User-Agent:
|
111
|
+
- Ruby
|
112
|
+
Content-Type:
|
113
|
+
- application/x-www-form-urlencoded
|
114
|
+
response:
|
115
|
+
status:
|
116
|
+
code: 200
|
117
|
+
message: OK
|
118
|
+
headers:
|
119
|
+
Cache-Control:
|
120
|
+
- private
|
121
|
+
Content-Type:
|
122
|
+
- text/xml; charset=utf-8
|
123
|
+
Vary:
|
124
|
+
- Accept-Encoding
|
125
|
+
Server:
|
126
|
+
- Microsoft-IIS/8.0
|
127
|
+
X-Aspnet-Version:
|
128
|
+
- 4.0.30319
|
129
|
+
X-Powered-By:
|
130
|
+
- ASP.NET
|
131
|
+
Date:
|
132
|
+
- Fri, 13 Jun 2014 11:10:14 GMT
|
133
|
+
Content-Length:
|
134
|
+
- '375'
|
135
|
+
body:
|
136
|
+
encoding: UTF-8
|
137
|
+
string: |
|
138
|
+
<?xml version="1.0" encoding="ISO-8859-1"?>
|
139
|
+
<response_info xmlns="http://www.voicevault.com">
|
140
|
+
<status_code>0</status_code>
|
141
|
+
<message>success</message>
|
142
|
+
<dialogue_status>Started</dialogue_status>
|
143
|
+
<failure_reason>NotSet</failure_reason>
|
144
|
+
<request_status>OK</request_status>
|
145
|
+
<prompt_hint>2459</prompt_hint>
|
146
|
+
<last_sqm_decision>NotSet</last_sqm_decision>
|
147
|
+
<verification_decision>NotApplicable</verification_decision>
|
148
|
+
</response_info>
|
149
|
+
http_version:
|
150
|
+
recorded_at: Fri, 13 Jun 2014 11:10:15 GMT
|
151
|
+
recorded_with: VCR 2.9.2
|
data/voice_vault.gemspec
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "voice_vault/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "voice_vault"
|
7
|
+
s.version = VoiceVault::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Bernard Potocki"]
|
10
|
+
s.email = ["bernard.potocki@imanel.org"]
|
11
|
+
s.homepage = "http://github.com/rebased/voice_vault-ruby"
|
12
|
+
s.summary = %q{Wrapper around VoiceVault.com API}
|
13
|
+
s.description = %q{Wrapper around VoiceVault.com API}
|
14
|
+
|
15
|
+
s.files = `git ls-files`.split("\n")
|
16
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
17
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
18
|
+
s.require_paths = ["lib"]
|
19
|
+
end
|
metadata
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: voice_vault
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Bernard Potocki
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-06-13 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Wrapper around VoiceVault.com API
|
14
|
+
email:
|
15
|
+
- bernard.potocki@imanel.org
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- ".gitignore"
|
21
|
+
- Gemfile
|
22
|
+
- README.md
|
23
|
+
- Rakefile
|
24
|
+
- example/config.yml.example
|
25
|
+
- example/create.rb
|
26
|
+
- example/verify.rb
|
27
|
+
- lib/voice_vault.rb
|
28
|
+
- lib/voice_vault/claimant.rb
|
29
|
+
- lib/voice_vault/connection.rb
|
30
|
+
- lib/voice_vault/dialogue.rb
|
31
|
+
- lib/voice_vault/version.rb
|
32
|
+
- spec/claimant_spec.rb
|
33
|
+
- spec/dialogue_spec.rb
|
34
|
+
- spec/spec_helper.rb
|
35
|
+
- spec/support/config.rb
|
36
|
+
- spec/vcr_cassettes/claimant.yml
|
37
|
+
- spec/vcr_cassettes/dialogue.yml
|
38
|
+
- voice_vault.gemspec
|
39
|
+
homepage: http://github.com/rebased/voice_vault-ruby
|
40
|
+
licenses: []
|
41
|
+
metadata: {}
|
42
|
+
post_install_message:
|
43
|
+
rdoc_options: []
|
44
|
+
require_paths:
|
45
|
+
- lib
|
46
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
47
|
+
requirements:
|
48
|
+
- - ">="
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: '0'
|
51
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
56
|
+
requirements: []
|
57
|
+
rubyforge_project:
|
58
|
+
rubygems_version: 2.2.2
|
59
|
+
signing_key:
|
60
|
+
specification_version: 4
|
61
|
+
summary: Wrapper around VoiceVault.com API
|
62
|
+
test_files:
|
63
|
+
- spec/claimant_spec.rb
|
64
|
+
- spec/dialogue_spec.rb
|
65
|
+
- spec/spec_helper.rb
|
66
|
+
- spec/support/config.rb
|
67
|
+
- spec/vcr_cassettes/claimant.yml
|
68
|
+
- spec/vcr_cassettes/dialogue.yml
|