nuance 0.0.5 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,16 @@
1
+ # 0.0.8
2
+
3
+ * release of 0.0.7, something messed up when I pushed to rubygems and I was not able to yank...
4
+
5
+ # 0.0.7
6
+
7
+ * Nuance finally got a valid cert, so we don't need to use the custom cacert bundle any more
8
+ * Allow you to disable SSL when instantiating object, and at transcription method call.
9
+
10
+ # 0.0.6
11
+
12
+ * Unable to disable ssl verification, boolean is hard :)
13
+
14
+ # 0.0.5
15
+
16
+ * Added support to ensure codec is passed to Nuance API
@@ -3,7 +3,7 @@ module Nuance
3
3
  include Celluloid
4
4
  Celluloid.logger = nil
5
5
 
6
- attr_reader :base_uri
6
+ attr_reader :base_uri, :ssl_verify
7
7
 
8
8
  ##
9
9
  # Creates an ATTSpeech object
@@ -20,12 +20,14 @@ module Nuance
20
20
  raise ArgumentError, ':app_key must be set' if !options[:app_key]
21
21
  raise ArgumentError, ':id must be set' if !options[:id]
22
22
 
23
- @base_uri = options[:base_uri] || 'https://dictation.nuancemobility.net'
24
- @app_id = options[:app_id] || ENV['NUANCE_APP_ID']
25
- @app_key = options[:app_key] || ENV['NUANCE_APP_KEY']
26
- @id = options[:id] || rand(100000000)
27
- @logging = options[:logging] || false
28
- @resource = "/NMDPAsrCmdServlet/dictation?appId=#{@app_id}&appKey=#{@app_key}&id=#{@id}"
23
+ @base_uri = options[:base_uri] || 'https://dictation.nuancemobility.net'
24
+ @app_id = options[:app_id] || ENV['NUANCE_APP_ID']
25
+ @app_key = options[:app_key] || ENV['NUANCE_APP_KEY']
26
+ @id = options[:id] || rand(100000000)
27
+ @logging = options[:logging] || false
28
+ @resource = "/NMDPAsrCmdServlet/dictation?appId=#{@app_id}&appKey=#{@app_key}&id=#{@id}"
29
+ @ssl_verify = options[:ssl_verify].nil? ? true : options[:ssl_verify]
30
+
29
31
  self
30
32
  end
31
33
 
@@ -45,17 +47,13 @@ module Nuance
45
47
  @accept_topic = options[:accept_topic] || 'Dictation'
46
48
  @accept_language = options[:language] || 'en_US'
47
49
  @accept = options[:accept] || 'application/xml'
50
+ @ssl_verify = options[:ssl_verify].nil? ? @ssl_verify : options[:ssl_verify]
48
51
 
49
- @ssl_verify = options[:ssl_verify] || true
50
52
  raise ArgumentError, ':content_type must be valid' if !content_type_valid?(options[:content_type])
51
53
  raise ArgumentError, ':file_contents must be present' if !options[:file_contents]
52
54
  raise ArgumentError, ':language must be valid' if !language_valid?(options[:language])
53
55
 
54
- if options[:content_type].nil?
55
- @content_type = options[:content_type] || "audio/x-wav;codec=pcm;bit=16;rate=#{sample_rate(options[:file_contents]).to_s}"
56
- else
57
- @content_type = options[:content_type]
58
- end
56
+ @content_type = options[:content_type].nil? ? "audio/x-wav;codec=pcm;bit=16;rate=#{sample_rate(options[:file_contents]).to_s}" : options[:content_type]
59
57
 
60
58
  create_connection
61
59
 
@@ -159,7 +157,7 @@ module Nuance
159
157
  ##
160
158
  # Creates the Faraday connection object
161
159
  def create_connection
162
- @connection = Faraday.new(:url => @base_uri, :ssl => { :verify => @ssl_verify, :ca_file => 'lib/nuance/dictation-base64.cer' }) do |faraday|
160
+ @connection = Faraday.new(:url => @base_uri, :ssl => { :verify => @ssl_verify }) do |faraday|
163
161
  faraday.adapter Faraday.default_adapter
164
162
  end
165
163
  end
@@ -1,3 +1,3 @@
1
1
  module Nuance
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.8"
3
3
  end
@@ -218,5 +218,25 @@ describe Nuance::Transcription do
218
218
  nuance_transcription.sample_rate(file_contents).should eql 8000
219
219
  end
220
220
  end
221
+
222
+ describe '#ssl ' do
223
+ it 'should validate SSL by default' do
224
+ nuance_transcription = Nuance::Transcription.new({ :app_id => @options[:app_id],
225
+ :app_key => @options[:app_key],
226
+ :id => @options[:id]
227
+ })
228
+ nuance_transcription.ssl_verify.should eql true
229
+ end
230
+
231
+
232
+ it 'should allow you to disable SSL validation' do
233
+ nuance_transcription = Nuance::Transcription.new({ :app_id => @options[:app_id],
234
+ :app_key => @options[:app_key],
235
+ :id => @options[:id],
236
+ :ssl_verify => false
237
+ })
238
+ nuance_transcription.ssl_verify.should eql false
239
+ end
240
+ end
221
241
  end
222
242
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nuance
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -252,10 +252,10 @@ files:
252
252
  - LICENSE.txt
253
253
  - README.md
254
254
  - Rakefile
255
+ - changelog.md
255
256
  - examples/DT-202c.wav
256
257
  - examples/transcribe.rb
257
258
  - lib/nuance.rb
258
- - lib/nuance/dictation-base64.cer
259
259
  - lib/nuance/text_to_speech.rb
260
260
  - lib/nuance/transcription.rb
261
261
  - lib/nuance/version.rb
@@ -279,7 +279,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
279
279
  version: '0'
280
280
  segments:
281
281
  - 0
282
- hash: -4357327388774372871
282
+ hash: -756648638227091763
283
283
  required_rubygems_version: !ruby/object:Gem::Requirement
284
284
  none: false
285
285
  requirements:
@@ -288,7 +288,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
288
288
  version: '0'
289
289
  segments:
290
290
  - 0
291
- hash: -4357327388774372871
291
+ hash: -756648638227091763
292
292
  requirements: []
293
293
  rubyforge_project:
294
294
  rubygems_version: 1.8.23
@@ -1,30 +0,0 @@
1
- -----BEGIN CERTIFICATE-----
2
- MIIFLTCCBBWgAwIBAgIDAcXvMA0GCSqGSIb3DQEBBQUAMEAxCzAJBgNVBAYTAlVT
3
- MRcwFQYDVQQKEw5HZW9UcnVzdCwgSW5jLjEYMBYGA1UEAxMPR2VvVHJ1c3QgU1NM
4
- IENBMB4XDTEyMTAyNDEzMTA0NFoXDTE0MTEyNjE0MTA1NVowgbkxKTAnBgNVBAUT
5
- IHk5Sk5Db3ZoUGJOQ2EvaUJNZE9jNGthWWhqNjhhSTliMQswCQYDVQQ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