cielo24 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 +4 -4
- data/.gitignore +1 -0
- data/CHANGELOG +27 -0
- data/README.md +46 -7
- data/lib/cielo24/authentication.rb +6 -2
- data/lib/cielo24/client.rb +8 -1
- data/lib/cielo24/jobs.rb +27 -5
- data/lib/cielo24/version.rb +1 -1
- data/spec/jobs_spec.rb +24 -1
- data/spec/spec_helper.rb +2 -1
- metadata +15 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 688492c209e5e419abe9c75cdbcd5f64e6a1a68a
|
4
|
+
data.tar.gz: 0a7f8ceb04c9c35ad3c770328977b571fe10efe8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 907ddbc758b372ce37d8eaca182e0945e6beb2bff62cfdf640829c2a91f889c4bb0ffd3349789bf0cfd8295a33755c1818e05260c708760bfb968c0be0e40bfa
|
7
|
+
data.tar.gz: 97d8014a43aa4709a58e0bd33ba8c75a3a7116b8a224fce2b0a6bb97210c7d5a0ce6eda4bc578ec77b42e1d7b6c5e4b8199170c09eb17521a800fa0782ce4fd0
|
data/.gitignore
CHANGED
data/CHANGELOG
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
## 0.0.3 - 2014-07-01
|
4
|
+
|
5
|
+
Special thanks to [zackm](https://github.com/zackm) for his contributions on this release. It's pretty much
|
6
|
+
all him!
|
7
|
+
|
8
|
+
### Added
|
9
|
+
|
10
|
+
- The configure method now supports using logins with passwords or with longer
|
11
|
+
term API keys, using the `api_key` option.
|
12
|
+
- Added the `task_status` method.
|
13
|
+
- Added the `get_transcript` method.
|
14
|
+
- `perform_transcription` now supports an options hash for additional Cielo24
|
15
|
+
options.
|
16
|
+
|
17
|
+
### Deprecated
|
18
|
+
|
19
|
+
- Nothing.
|
20
|
+
|
21
|
+
### Removed
|
22
|
+
|
23
|
+
- Nothing.
|
24
|
+
|
25
|
+
### Fixed
|
26
|
+
|
27
|
+
- Nothing.
|
data/README.md
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
# Cielo24
|
2
2
|
|
3
|
-
|
3
|
+
[ ![Codeship Status for commondream/cielo24](https://www.codeship.io/projects/3b4c3d90-e3ac-0131-3a67-06aaa1f2b67c/status)](https://www.codeship.io/projects/25486)
|
4
|
+
|
5
|
+
Cielo24 is a service for creating video captions and transcripts. This library interacts with the Cielo24 API to submit and retrieve captions. Cielo24 API documentation is available [here](http://cielo24.com/static/cielo24/documents/Cielo24ServicesAPI-v1.4.9.pdf).
|
4
6
|
|
5
7
|
This is currently an incomplete implementation fo the Cielo24 API to solve my personal needs. Feel free to send a pull request if you want to complete more of the API.
|
6
8
|
|
@@ -25,14 +27,20 @@ Or install it yourself as:
|
|
25
27
|
The Cielo24 team recommend password based authentication, so to configure your username and password:
|
26
28
|
|
27
29
|
```
|
28
|
-
Cielo24::Client.configure(username: "user", password: "somepass")
|
30
|
+
Cielo24::Client.configure({username: "user", password: "somepass"})
|
31
|
+
```
|
32
|
+
|
33
|
+
Alternatively, you can login with your username and API key:
|
34
|
+
|
35
|
+
```
|
36
|
+
Cielo24::Client.configure({username: "user", securekey: "api_key"})
|
29
37
|
```
|
30
38
|
|
31
39
|
You may also authenticate through the Cielo24 sandbox with the following settings (use your own sandbox username and password):
|
32
40
|
|
33
41
|
```
|
34
42
|
Cielo24::Client.configure(username: "username", password: "password",
|
35
|
-
uri: "https://sandbox.
|
43
|
+
uri: "https://sandbox.cielo24.com", verify_mode: OpenSSL::SSL::VERIFY_NONE)
|
36
44
|
```
|
37
45
|
|
38
46
|
### Submitting a video for captioning:
|
@@ -49,21 +57,52 @@ Captioning defaults to professional fidelity and standard priority.
|
|
49
57
|
### Checking if captions are complete:
|
50
58
|
|
51
59
|
```
|
52
|
-
client = Cielo24::Client.new
|
53
60
|
client.task_complete?(task_id)
|
54
61
|
```
|
55
62
|
|
56
|
-
### Downloading captions
|
63
|
+
### Downloading captions:
|
57
64
|
|
58
65
|
```
|
59
|
-
client = Cielo24::Client.new
|
60
66
|
data = client.get_caption(job_id)
|
61
67
|
```
|
62
68
|
|
69
|
+
#### Optional arguments
|
70
|
+
|
71
|
+
```
|
72
|
+
format = "DFXP" # Defaults to "SRT"
|
73
|
+
options = {:remove_sound_references => true} # add as many or as few options as you like
|
74
|
+
data = client.get_caption(job_id, format, options)
|
75
|
+
```
|
76
|
+
|
77
|
+
### Downloading transcripts:
|
78
|
+
|
79
|
+
```
|
80
|
+
data = client.get_transcript(job_id)
|
81
|
+
```
|
82
|
+
|
83
|
+
#### Optional arguments
|
84
|
+
|
85
|
+
```
|
86
|
+
options = {:remove_sound_references => true}
|
87
|
+
data = client.get_transcript(job_id, options)
|
88
|
+
```
|
89
|
+
|
90
|
+
### Get Job Info:
|
91
|
+
|
92
|
+
```
|
93
|
+
json_data = client.job_info(job_id)
|
94
|
+
```
|
95
|
+
|
96
|
+
### Get Task Status:
|
97
|
+
|
98
|
+
```
|
99
|
+
json_data = client.task_status(task_id)
|
100
|
+
```
|
101
|
+
|
63
102
|
## Contributing
|
64
103
|
|
65
104
|
1. Fork it
|
66
105
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
67
106
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
68
107
|
4. Push to the branch (`git push origin my-new-feature`)
|
69
|
-
5. Create new Pull Request
|
108
|
+
5. Create new Pull Request
|
@@ -3,8 +3,12 @@ module Cielo24
|
|
3
3
|
module Authentication
|
4
4
|
|
5
5
|
# Public: Get a api token for this session.
|
6
|
-
|
7
|
-
|
6
|
+
#
|
7
|
+
# options - a Hash with either of the following sets of keys:
|
8
|
+
# username, password
|
9
|
+
# username, securekey
|
10
|
+
def log_in(options)
|
11
|
+
data = get_json("/api/account/login", options)
|
8
12
|
data["ApiToken"]
|
9
13
|
end
|
10
14
|
end
|
data/lib/cielo24/client.rb
CHANGED
@@ -17,6 +17,7 @@ module Cielo24
|
|
17
17
|
# options - the configuration options for use with Cielo24.
|
18
18
|
# :username - The username to use for authentication.
|
19
19
|
# :password - The password to use for authentication.
|
20
|
+
# :api_key - The API key to use for authentication.
|
20
21
|
# :uri - The uri to use for requests. Defaults to the Cielo24 API URI.
|
21
22
|
def self.configure(options = {})
|
22
23
|
@options = {uri: DEFAULT_URI, version: VERSION, verify_mode: VERIFY_MODE}.merge(options)
|
@@ -30,8 +31,14 @@ module Cielo24
|
|
30
31
|
def initialize
|
31
32
|
self.connection = connect
|
32
33
|
|
34
|
+
login_options = {username: self.class.options[:username]}
|
35
|
+
if self.class.options[:api_key]
|
36
|
+
login_options['securekey'] = self.class.options[:api_key]
|
37
|
+
else
|
38
|
+
login_options['password'] = self.class.options[:password]
|
39
|
+
end
|
33
40
|
# Go ahead and set up the single use token for this session
|
34
|
-
@token = log_in(
|
41
|
+
@token = log_in(login_options)
|
35
42
|
end
|
36
43
|
|
37
44
|
# Internal: Returns an HTTPClient connection object.
|
data/lib/cielo24/jobs.rb
CHANGED
@@ -30,11 +30,13 @@ module Cielo24
|
|
30
30
|
# job_id - The id of a job to attach media to.
|
31
31
|
# fidelity - Should be one of MECHANICAL, PREMIUM, or PROFESSIONAL. Default: PROFESSIONAL
|
32
32
|
# priority - Should be one of ECONOMY, STANDARD, or PRIORITY. Default: STANDARD
|
33
|
+
# options - Additional optional parameters for perform the transcription. See the Cielo24 documentation
|
34
|
+
# for the full list.
|
33
35
|
#
|
34
36
|
# Returns the task id for the transcription.
|
35
|
-
def perform_transcription(job_id, fidelity = "PROFESSIONAL", priority = "STANDARD")
|
36
|
-
|
37
|
-
|
37
|
+
def perform_transcription(job_id, fidelity = "PROFESSIONAL", priority = "STANDARD", options = {})
|
38
|
+
options = options.merge(job_id: job_id, transcription_fidelity: fidelity, priority: priority)
|
39
|
+
data = get_json("/api/job/perform_transcription", options)
|
38
40
|
|
39
41
|
data["TaskId"]
|
40
42
|
end
|
@@ -43,18 +45,27 @@ module Cielo24
|
|
43
45
|
#
|
44
46
|
# job_id - The job to get info about.
|
45
47
|
#
|
46
|
-
# Returns
|
48
|
+
# Returns the job info as JSON
|
47
49
|
def job_info(job_id)
|
48
50
|
get_json("/api/job/info", {job_id: job_id})
|
49
51
|
end
|
50
52
|
|
53
|
+
# Public: Requests the status info for a particular task.
|
54
|
+
#
|
55
|
+
# task_id - The task to get info about.
|
56
|
+
#
|
57
|
+
# Returns the task info as JSON
|
58
|
+
def task_status(task_id)
|
59
|
+
get_json("/api/job/task_status", {task_id: task_id})
|
60
|
+
end
|
61
|
+
|
51
62
|
# Public: Returns whether or not a task has completed.
|
52
63
|
#
|
53
64
|
# task_id - The task to check status for.
|
54
65
|
#
|
55
66
|
# Returns true if the task is complete, false otherwise.
|
56
67
|
def task_complete?(task_id)
|
57
|
-
|
68
|
+
task_status(task_id)["TaskStatus"] == "COMPLETE"
|
58
69
|
end
|
59
70
|
|
60
71
|
# Public: Gets the caption results from a job.
|
@@ -68,5 +79,16 @@ module Cielo24
|
|
68
79
|
def get_caption(job_id, caption_format = "SRT", options = {})
|
69
80
|
get("/api/job/get_caption", options.merge(caption_format: caption_format, job_id: job_id))
|
70
81
|
end
|
82
|
+
|
83
|
+
# Public: Gets the transcript results from a job.
|
84
|
+
#
|
85
|
+
# job_id - The id of the job we're retrieving a transcription for.
|
86
|
+
# options - Optional parameters for requesting transcripts. See the Cielo24 documentation
|
87
|
+
# for the full list of parameters.
|
88
|
+
#
|
89
|
+
# Returns the transcript data as text.
|
90
|
+
def get_transcript(job_id, options = {})
|
91
|
+
get("/api/job/get_transcript", options.merge(job_id: job_id))
|
92
|
+
end
|
71
93
|
end
|
72
94
|
end
|
data/lib/cielo24/version.rb
CHANGED
data/spec/jobs_spec.rb
CHANGED
@@ -62,7 +62,21 @@ describe "Cielo24::Jobs" do
|
|
62
62
|
end
|
63
63
|
end
|
64
64
|
|
65
|
-
describe "
|
65
|
+
describe "#job_info" do
|
66
|
+
it "returns job info" do
|
67
|
+
stub_get_json("/api/job/info", {"JobId" => "JOB123", "JobName" => "A Test Job"})
|
68
|
+
expect(client.job_info(job_id)).to_not be_nil
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
describe "#task_status" do
|
73
|
+
it "returns the task status" do
|
74
|
+
stub_get_json("/api/job/task_status", {"TaskId" => "TASK123", "TaskType" => "JOB_PERFORM_TRANSCRIPT"})
|
75
|
+
expect(client.task_status("TASK123")).to_not be_nil
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
describe "#get_caption" do
|
66
80
|
it "returns the captions" do
|
67
81
|
pending("SANDBOX DOESN'T ALWAYS RETURN CAPTIONS CORRECTLY") if test_sandbox?
|
68
82
|
|
@@ -70,4 +84,13 @@ describe "Cielo24::Jobs" do
|
|
70
84
|
expect(client.get_caption(transcribed_job_id)).to_not be_nil
|
71
85
|
end
|
72
86
|
end
|
87
|
+
|
88
|
+
describe "#get_transcript" do
|
89
|
+
it "returns the transcripts" do
|
90
|
+
pending("SANDBOX DOESN'T ALWAYS RETURN TRANSCRIPTS CORRECTLY") if test_sandbox?
|
91
|
+
|
92
|
+
stub_get("/api/job/get_transcript", "This is some transcript data.")
|
93
|
+
expect(client.get_transcript(transcribed_job_id)).to_not be_nil
|
94
|
+
end
|
95
|
+
end
|
73
96
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,69 +1,69 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cielo24
|
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
|
- Alan Johnson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-02
|
11
|
+
date: 2014-07-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.3'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.3'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: 2.14.1
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - ~>
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 2.14.1
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: httpclient
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - ~>
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: 2.3.4.1
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - ~>
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 2.3.4.1
|
69
69
|
description: Library for submitting and requesting captions from Cielo24.
|
@@ -73,7 +73,8 @@ executables: []
|
|
73
73
|
extensions: []
|
74
74
|
extra_rdoc_files: []
|
75
75
|
files:
|
76
|
-
- .gitignore
|
76
|
+
- ".gitignore"
|
77
|
+
- CHANGELOG
|
77
78
|
- Gemfile
|
78
79
|
- LICENSE.txt
|
79
80
|
- README.md
|
@@ -96,21 +97,20 @@ require_paths:
|
|
96
97
|
- lib
|
97
98
|
required_ruby_version: !ruby/object:Gem::Requirement
|
98
99
|
requirements:
|
99
|
-
- -
|
100
|
+
- - ">="
|
100
101
|
- !ruby/object:Gem::Version
|
101
102
|
version: '0'
|
102
103
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
103
104
|
requirements:
|
104
|
-
- -
|
105
|
+
- - ">="
|
105
106
|
- !ruby/object:Gem::Version
|
106
107
|
version: '0'
|
107
108
|
requirements: []
|
108
109
|
rubyforge_project:
|
109
|
-
rubygems_version: 2.
|
110
|
+
rubygems_version: 2.2.2
|
110
111
|
signing_key:
|
111
112
|
specification_version: 4
|
112
113
|
summary: Submit and request captions through Cielo24.
|
113
114
|
test_files:
|
114
115
|
- spec/jobs_spec.rb
|
115
116
|
- spec/spec_helper.rb
|
116
|
-
has_rdoc:
|