att_speech 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 0a802f00a5cdea2f0ea4a748ea6f070433c167a0
4
+ data.tar.gz: c9da1fdce77b113acf0ae97b4b149ee8cea191f0
5
+ SHA512:
6
+ metadata.gz: 3b35b282eaa5edb5c10a531f097822ccb8c0d2749e449ccf67f89cb596182d828cd87c75ae81c7207ae404daf9bc6a9b3d7ac30ea877350a30aac01330a082b1
7
+ data.tar.gz: 5cab056142d4adce2db9088bca364db84ceb9a450d333b1d21289861fca3193c0028412c9ae70f3ab32e21b860c79a230a382441570d0a746d114b8f3511538f
@@ -2,4 +2,6 @@ language: ruby
2
2
  rvm:
3
3
  - 1.9.2
4
4
  - 1.9.3
5
+ - jruby-18mode
6
+ - jruby-19mode
5
7
  # script: bundle exec rspec spec
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.4
1
+ 0.0.5
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "att_speech"
8
- s.version = "0.0.4"
8
+ s.version = "0.0.5"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Jason Goecke, Peter Wilson"]
@@ -93,20 +93,20 @@ class ATTSpeech
93
93
 
94
94
  ##
95
95
  # Allows you to send a string or plain text file and return the text to speech result
96
- # @param [String] string or file_contents to be processed
97
- # @param [String] type of file or object to be processed, may be text/plain, or application/ssml+xml
96
+ # @param [String] text_data string or file_contents to be processed
97
+ # @param [String] options hash with options which will be send to AT&T Speech API
98
98
  #
99
99
  # @return [String] the bytes of the resulting response from the AT&T Speech API
100
- def text_to_speech(file_contents, type='text/plain')
101
- resource = "/speech/v3/textToSpeech"
100
+ def text_to_speech(text_data, options = {})
101
+ resource = '/speech/v3/textToSpeech'
102
+ params = {
103
+ :Authorization => "Bearer #{@access_token}",
104
+ :Content_Type => 'text/plain',
105
+ :Accept => 'audio/x-wav'
106
+ }.merge(options)
102
107
 
103
108
  begin
104
- response = @connection.post( resource,
105
- file_contents,
106
- :Authorization => "Bearer #{@access_token}",
107
- :Content_Type => type,
108
- :Accept => 'audio/x-wav' )
109
-
109
+ response = @connection.post( resource, text_data, params )
110
110
  response.body
111
111
  rescue => e
112
112
  raise RuntimeError, e.to_s
@@ -1,3 +1,3 @@
1
1
  class ATTSpeech
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
@@ -18,6 +18,11 @@ describe "AttSpeech" do
18
18
  :status => ['200', 'OK'],
19
19
  :body => "{\"Recognition\":{\"ResponseId\":\"2b0bdcf4301f5c4aba57e2765b59bcbe\",\"NBest\":[{\"WordScores\":[1,1],\"Confidence\":1,\"Grade\":\"accept\",\"ResultText\":\"Boston celtics.\",\"Words\":[\"Boston\",\"celtics.\"],\"LanguageId\":\"en-us\",\"Hypothesis\":\"Boston celtics.\"}]}}")
20
20
 
21
+ FakeWeb.register_uri(:post,
22
+ "https://api.att.com/speech/v3/textToSpeech",
23
+ :status => ['200', 'OK'],
24
+ :body => nil )
25
+
21
26
  let(:att_speech) { att_speech = ATTSpeech.new('1234', 'abcd', 'SPEECH') }
22
27
  let(:att_speech_hash) { att_speech = ATTSpeech.new({ :api_key => '1234',
23
28
  :secret_key => 'abcd',
@@ -136,4 +141,25 @@ describe "AttSpeech" do
136
141
  result[:recognition][:n_best][:confidence].should eql 1
137
142
  end
138
143
  end
144
+
145
+ context 'text to speech' do
146
+ it 'should request a TTS transaction' do
147
+ text = 'Hello brown cow'
148
+ result = att_speech.text_to_speech text
149
+ FakeWeb.last_request.body.should eql text
150
+ FakeWeb.last_request.get_fields('authorization').should eql ["Bearer 5678"]
151
+ FakeWeb.last_request.get_fields('content-type').should eql ["text/plain"]
152
+ FakeWeb.last_request.get_fields('accept').should eql ["audio/x-wav"]
153
+ end
154
+
155
+ it 'should request a TTS transaction with additional options' do
156
+ text = 'Hello brown cow'
157
+ result = att_speech.text_to_speech text, { :x_foo => 'bar' }
158
+ FakeWeb.last_request.body.should eql text
159
+ FakeWeb.last_request.get_fields('authorization').should eql ["Bearer 5678"]
160
+ FakeWeb.last_request.get_fields('content-type').should eql ["text/plain"]
161
+ FakeWeb.last_request.get_fields('accept').should eql ["audio/x-wav"]
162
+ FakeWeb.last_request.get_fields('x-foo').should eql ["bar"]
163
+ end
164
+ end
139
165
  end
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: att_speech
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
5
- prerelease:
4
+ version: 0.0.5
6
5
  platform: ruby
7
6
  authors:
8
7
  - Jason Goecke, Peter Wilson
@@ -14,183 +13,161 @@ dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: faraday
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: 0.8.1
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - '>='
28
25
  - !ruby/object:Gem::Version
29
26
  version: 0.8.1
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: celluloid
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - <
36
32
  - !ruby/object:Gem::Version
37
33
  version: 0.14.0
38
- - - ! '>='
34
+ - - '>='
39
35
  - !ruby/object:Gem::Version
40
36
  version: 0.11.1
41
37
  type: :runtime
42
38
  prerelease: false
43
39
  version_requirements: !ruby/object:Gem::Requirement
44
- none: false
45
40
  requirements:
46
41
  - - <
47
42
  - !ruby/object:Gem::Version
48
43
  version: 0.14.0
49
- - - ! '>='
44
+ - - '>='
50
45
  - !ruby/object:Gem::Version
51
46
  version: 0.11.1
52
47
  - !ruby/object:Gem::Dependency
53
48
  name: hashie
54
49
  requirement: !ruby/object:Gem::Requirement
55
- none: false
56
50
  requirements:
57
- - - ! '>='
51
+ - - '>='
58
52
  - !ruby/object:Gem::Version
59
53
  version: 1.2.0
60
54
  type: :runtime
61
55
  prerelease: false
62
56
  version_requirements: !ruby/object:Gem::Requirement
63
- none: false
64
57
  requirements:
65
- - - ! '>='
58
+ - - '>='
66
59
  - !ruby/object:Gem::Version
67
60
  version: 1.2.0
68
61
  - !ruby/object:Gem::Dependency
69
62
  name: activesupport
70
63
  requirement: !ruby/object:Gem::Requirement
71
- none: false
72
64
  requirements:
73
- - - ! '>='
65
+ - - '>='
74
66
  - !ruby/object:Gem::Version
75
67
  version: '0'
76
68
  type: :runtime
77
69
  prerelease: false
78
70
  version_requirements: !ruby/object:Gem::Requirement
79
- none: false
80
71
  requirements:
81
- - - ! '>='
72
+ - - '>='
82
73
  - !ruby/object:Gem::Version
83
74
  version: '0'
84
75
  - !ruby/object:Gem::Dependency
85
76
  name: rspec
86
77
  requirement: !ruby/object:Gem::Requirement
87
- none: false
88
78
  requirements:
89
- - - ! '>='
79
+ - - '>='
90
80
  - !ruby/object:Gem::Version
91
81
  version: 2.8.0
92
82
  type: :development
93
83
  prerelease: false
94
84
  version_requirements: !ruby/object:Gem::Requirement
95
- none: false
96
85
  requirements:
97
- - - ! '>='
86
+ - - '>='
98
87
  - !ruby/object:Gem::Version
99
88
  version: 2.8.0
100
89
  - !ruby/object:Gem::Dependency
101
90
  name: yard
102
91
  requirement: !ruby/object:Gem::Requirement
103
- none: false
104
92
  requirements:
105
- - - ! '>='
93
+ - - '>='
106
94
  - !ruby/object:Gem::Version
107
95
  version: '0.7'
108
96
  type: :development
109
97
  prerelease: false
110
98
  version_requirements: !ruby/object:Gem::Requirement
111
- none: false
112
99
  requirements:
113
- - - ! '>='
100
+ - - '>='
114
101
  - !ruby/object:Gem::Version
115
102
  version: '0.7'
116
103
  - !ruby/object:Gem::Dependency
117
104
  name: rdoc
118
105
  requirement: !ruby/object:Gem::Requirement
119
- none: false
120
106
  requirements:
121
- - - ! '>='
107
+ - - '>='
122
108
  - !ruby/object:Gem::Version
123
109
  version: '3.12'
124
110
  type: :development
125
111
  prerelease: false
126
112
  version_requirements: !ruby/object:Gem::Requirement
127
- none: false
128
113
  requirements:
129
- - - ! '>='
114
+ - - '>='
130
115
  - !ruby/object:Gem::Version
131
116
  version: '3.12'
132
117
  - !ruby/object:Gem::Dependency
133
118
  name: bundler
134
119
  requirement: !ruby/object:Gem::Requirement
135
- none: false
136
120
  requirements:
137
- - - ! '>='
121
+ - - '>='
138
122
  - !ruby/object:Gem::Version
139
123
  version: 1.0.0
140
124
  type: :development
141
125
  prerelease: false
142
126
  version_requirements: !ruby/object:Gem::Requirement
143
- none: false
144
127
  requirements:
145
- - - ! '>='
128
+ - - '>='
146
129
  - !ruby/object:Gem::Version
147
130
  version: 1.0.0
148
131
  - !ruby/object:Gem::Dependency
149
132
  name: jeweler
150
133
  requirement: !ruby/object:Gem::Requirement
151
- none: false
152
134
  requirements:
153
- - - ! '>='
135
+ - - '>='
154
136
  - !ruby/object:Gem::Version
155
137
  version: 1.8.4
156
138
  type: :development
157
139
  prerelease: false
158
140
  version_requirements: !ruby/object:Gem::Requirement
159
- none: false
160
141
  requirements:
161
- - - ! '>='
142
+ - - '>='
162
143
  - !ruby/object:Gem::Version
163
144
  version: 1.8.4
164
145
  - !ruby/object:Gem::Dependency
165
146
  name: simplecov
166
147
  requirement: !ruby/object:Gem::Requirement
167
- none: false
168
148
  requirements:
169
- - - ! '>='
149
+ - - '>='
170
150
  - !ruby/object:Gem::Version
171
151
  version: '0'
172
152
  type: :development
173
153
  prerelease: false
174
154
  version_requirements: !ruby/object:Gem::Requirement
175
- none: false
176
155
  requirements:
177
- - - ! '>='
156
+ - - '>='
178
157
  - !ruby/object:Gem::Version
179
158
  version: '0'
180
159
  - !ruby/object:Gem::Dependency
181
160
  name: fakeweb
182
161
  requirement: !ruby/object:Gem::Requirement
183
- none: false
184
162
  requirements:
185
- - - ! '>='
163
+ - - '>='
186
164
  - !ruby/object:Gem::Version
187
165
  version: '0'
188
166
  type: :development
189
167
  prerelease: false
190
168
  version_requirements: !ruby/object:Gem::Requirement
191
- none: false
192
169
  requirements:
193
- - - ! '>='
170
+ - - '>='
194
171
  - !ruby/object:Gem::Version
195
172
  version: '0'
196
173
  description: A Ruby library for consuming v3 of the AT&T Speech API for speech->text,
@@ -226,27 +203,27 @@ files:
226
203
  homepage: http://github.com/jsgoecke/att_speech
227
204
  licenses:
228
205
  - MIT
206
+ metadata: {}
229
207
  post_install_message:
230
208
  rdoc_options: []
231
209
  require_paths:
232
210
  - lib
233
211
  required_ruby_version: !ruby/object:Gem::Requirement
234
- none: false
235
212
  requirements:
236
- - - ! '>='
213
+ - - '>='
237
214
  - !ruby/object:Gem::Version
238
215
  version: '0'
239
216
  required_rubygems_version: !ruby/object:Gem::Requirement
240
- none: false
241
217
  requirements:
242
- - - ! '>='
218
+ - - '>='
243
219
  - !ruby/object:Gem::Version
244
220
  version: '0'
245
221
  requirements: []
246
222
  rubyforge_project:
247
- rubygems_version: 1.8.25
223
+ rubygems_version: 2.0.3
248
224
  signing_key:
249
225
  specification_version: 3
250
226
  summary: A Ruby library for consuming the AT&T Speech API https://developer.att.com/developer/forward.jsp?passedItemId=12500023
251
227
  for speech->text, and text->speech.
252
228
  test_files: []
229
+ has_rdoc: