speechpad 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/speechpad/client.rb +14 -14
- data/lib/speechpad/version.rb +1 -1
- data/spec/speechpad_spec.rb +11 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NzczZTUzMTY5YTQ4ZTc0NThhNWUwNjM0MDA5NWRkM2M4ODQ4ZGQyMA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NTMxMjAwOGQ0ZjdmMThmMTY4ZmQxNDkxYzcyMzkzMDQ5OTBhY2NmMA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NTkxZmMzYjBiOWZhZmVkZWI0NDliZjlhMDdlZDM3M2Q1ZjhmNWE0ODIzZWJi
|
10
|
+
Mzg1YjA4YzFkODM0YTVmNTY4NDAxMTEwYzRlZThiNzdlZjk4ZDA1M2M0YzFi
|
11
|
+
OTkwOWQ0ZDgwODdhYjBkZTg1MDYxNWUxZmYyZjBiYTE3MmFlMmY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MDVhZDE1MTQ0MjJlY2YwNjlkYTAzZGQwYzhhMzRhYTYyNTVlNjcxMmU1YmI2
|
14
|
+
M2YyODc2ZmI5NzhjNjg5MzJkMWE4YmM5MzNjZWVmNTg5N2JhYWMyZDFjMDNi
|
15
|
+
NTdlNmJmMmI1ZGEyMTYyZGUzYTI3MGUzMTAyOTNkYmQ2OWVjYTI=
|
data/lib/speechpad/client.rb
CHANGED
@@ -23,9 +23,9 @@ module Speechpad
|
|
23
23
|
# s = Speechpad::Client.new({access_key: "abc123", secret_key: "xyz456"})
|
24
24
|
# s.add_audio_url('https://www.speechpad.com/is_a.mp3')
|
25
25
|
def add_audio_url(url, visible_filename=url, transcribe=true, options={})
|
26
|
-
params = build_params('operation' => 'add_audio_url', 'method' => 'post', 'visible_filename' => visible_filename,
|
27
|
-
'url' => url, 'transcribe' => transcribe)
|
28
|
-
get(params
|
26
|
+
params = build_params({'operation' => 'add_audio_url', 'method' => 'post', 'visible_filename' => visible_filename,
|
27
|
+
'url' => url, 'transcribe' => transcribe}.merge(options))
|
28
|
+
get(params)
|
29
29
|
end
|
30
30
|
|
31
31
|
# Add a new media to the user’s account from a URL, like Youtube.
|
@@ -38,8 +38,8 @@ module Speechpad
|
|
38
38
|
# s = Speechpad::Client.new({access_key: "abc123", secret_key: "xyz456"})
|
39
39
|
# s.add_media_url('http://www.youtube.com/watch?v=meiU6TxysCg')
|
40
40
|
def add_media_url(url, transcribe=true, options={})
|
41
|
-
params = build_params('operation' => 'add_media_url', 'method' => 'post', 'url' => url, 'transcribe' => transcribe)
|
42
|
-
get(params
|
41
|
+
params = build_params({'operation' => 'add_media_url', 'method' => 'post', 'url' => url, 'transcribe' => transcribe}.merge(options))
|
42
|
+
get(params)
|
43
43
|
end
|
44
44
|
|
45
45
|
# Return the transcription status of one or more audio files.
|
@@ -51,8 +51,8 @@ module Speechpad
|
|
51
51
|
# s = Speechpad::Client.new({access_key: "abc123", secret_key: "xyz456"})
|
52
52
|
# s.get_transcription(1234)
|
53
53
|
def get_transcription(audio_id, options={})
|
54
|
-
params = build_params('operation' => 'get_transcription', 'method' => 'get', 'audio_id' => audio_id)
|
55
|
-
get(params
|
54
|
+
params = build_params({'operation' => 'get_transcription', 'method' => 'get', 'audio_id' => audio_id}.merge(options))
|
55
|
+
get(params)
|
56
56
|
end
|
57
57
|
|
58
58
|
# Return the machine transcription status of one or more audio files.
|
@@ -64,8 +64,8 @@ module Speechpad
|
|
64
64
|
# s = Speechpad::Client.new({access_key: "abc123", secret_key: "xyz456"})
|
65
65
|
# s.get_machine_transcription(1234)
|
66
66
|
def get_machine_transcription(audio_id, options={})
|
67
|
-
params = build_params('operation' => 'get_machine_transcription', 'method' => 'get', 'audio_id' => audio_id)
|
68
|
-
get(params
|
67
|
+
params = build_params({'operation' => 'get_machine_transcription', 'method' => 'get', 'audio_id' => audio_id}.merge(options))
|
68
|
+
get(params)
|
69
69
|
end
|
70
70
|
|
71
71
|
|
@@ -78,8 +78,8 @@ module Speechpad
|
|
78
78
|
# s = Speechpad::Client.new({access_key: "abc123", secret_key: "xyz456"})
|
79
79
|
# s.machine_transcription_status(1234)
|
80
80
|
def machine_transcription_status(audio_id, options={})
|
81
|
-
params = build_params('operation' => 'machine_transcription_status', 'method' => 'get', 'audio_id' => audio_id)
|
82
|
-
get(params
|
81
|
+
params = build_params({'operation' => 'machine_transcription_status', 'method' => 'get', 'audio_id' => audio_id}.merge(options))
|
82
|
+
get(params)
|
83
83
|
end
|
84
84
|
|
85
85
|
# Return the transcription status of one or more audio files.
|
@@ -91,8 +91,8 @@ module Speechpad
|
|
91
91
|
# s = Speechpad::Client.new({access_key: "abc123", secret_key: "xyz456"})
|
92
92
|
# s.transcription_status(1234)
|
93
93
|
def transcription_status(audio_id, options={})
|
94
|
-
params = build_params('operation' => 'transcription_status', 'method' => 'get', 'audio_id' => audio_id)
|
95
|
-
get(params
|
94
|
+
params = build_params({'operation' => 'transcription_status', 'method' => 'get', 'audio_id' => audio_id}.merge(options))
|
95
|
+
get(params)
|
96
96
|
end
|
97
97
|
|
98
98
|
# A test call for the Speechpad API (only works on dev).
|
@@ -103,7 +103,7 @@ module Speechpad
|
|
103
103
|
# s = Speechpad::Client.new({access_key: "abc123", secret_key: "xyz456"})
|
104
104
|
# s.test
|
105
105
|
def test(options={})
|
106
|
-
params = build_params('operation' => 'test', 'value' => '123', 'method' => 'get')
|
106
|
+
params = build_params({'operation' => 'test', 'value' => '123', 'method' => 'get'}.merge(options))
|
107
107
|
get(params, options)
|
108
108
|
end
|
109
109
|
|
data/lib/speechpad/version.rb
CHANGED
data/spec/speechpad_spec.rb
CHANGED
@@ -50,19 +50,26 @@ describe Speechpad do
|
|
50
50
|
describe ".get_transcription" do
|
51
51
|
it "should get the transcription of the audo file and return it" do
|
52
52
|
stub_request(:get, "http://dev.speechpad.com/services?access_key=abc123&audio_id=1234&format=json&method=get&operation=get_transcription&service_name=account&service_version=1.0.0&signature=RFYtgGb2t4T5h5Bq5vqdl4KgL5I=×tamp=2014-01-01T00:00:00Z").
|
53
|
-
to_return(:status => 200, :body => '{"error_string":"SUCCESS","response":"Hello!"}' , :headers => {'Content-Type' => 'application/json'})
|
53
|
+
to_return(:status => 200, :body => '{"error_string":"SUCCESS","response":{"content": "Hello!"}}' , :headers => {'Content-Type' => 'application/json'})
|
54
54
|
test = @client.get_transcription(1234)
|
55
|
-
test.response.should eql "Hello!"
|
55
|
+
test.response.content.should eql "Hello!"
|
56
|
+
end
|
57
|
+
|
58
|
+
it "should take optional parameters" do
|
59
|
+
stub_request(:get, "http://dev.speechpad.com/services?access_key=abc123&audio_id=1234&file_format=html&format=json&method=get&operation=get_transcription&service_name=account&service_version=1.0.0&signature=riClrOy69CFgWyflNrsjam9RXKU=×tamp=2014-01-01T00:00:00Z").
|
60
|
+
to_return(:status => 200, :body => '{"error_string":"SUCCESS","response":{"content": "Hello!"}}' , :headers => {'Content-Type' => 'application/json'})
|
61
|
+
test = @client.get_transcription(1234, {"file_format" => "html"})
|
62
|
+
test.error_string.should eql "SUCCESS"
|
56
63
|
end
|
57
64
|
end
|
58
65
|
|
59
66
|
describe ".get_machine_transcription" do
|
60
67
|
it "should get the machine transcription of the audo file and return it" do
|
61
68
|
stub_request(:get, "http://dev.speechpad.com/services?access_key=abc123&audio_id=1234&format=json&method=get&operation=get_machine_transcription&service_name=account&service_version=1.0.0&signature=6yg9RfjBygBzqNVbAmfNFHI1UwE=×tamp=2014-01-01T00:00:00Z").
|
62
|
-
to_return(:status => 200, :body => '{"error_string":"SUCCESS","response":"Hello!"}' , :headers => {'Content-Type' => 'application/json'})
|
69
|
+
to_return(:status => 200, :body => '{"error_string":"SUCCESS","response":{"content": "Hello!"}}' , :headers => {'Content-Type' => 'application/json'})
|
63
70
|
|
64
71
|
test = @client.get_machine_transcription(1234)
|
65
|
-
test.response.should eql "Hello!"
|
72
|
+
test.response.content.should eql "Hello!"
|
66
73
|
end
|
67
74
|
end
|
68
75
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: speechpad
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Upworthy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-02-
|
11
|
+
date: 2014-02-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|