clarify 1.1.1 → 2.0.0.alpha.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -16
- data/.rspec +2 -0
- data/.simplecov +3 -0
- data/.travis.yml +7 -0
- data/CHANGELOG.md +4 -0
- data/Dockerfile +11 -0
- data/Gemfile +2 -2
- data/LICENSE +1 -1
- data/README.md +202 -47
- data/Rakefile +62 -4
- data/clarify.gemspec +10 -7
- data/cucumber.yml +1 -0
- data/features/create-bundles.feature +10 -0
- data/features/delete-bundle.feature +7 -0
- data/features/identity-steps.feature +6 -0
- data/features/list-bundles.feature +13 -0
- data/features/search-bundles.feature +10 -0
- data/features/step_definitions/curied_url_steps.rb +6 -0
- data/features/step_definitions/error_steps.rb +4 -0
- data/features/step_definitions/http_verification_step.rb +4 -0
- data/features/step_definitions/identity_steps.rb +12 -0
- data/features/step_definitions/list_steps.rb +76 -0
- data/features/support/env.rb +36 -0
- data/features/support/lib/curies.rb +19 -0
- data/features/support/lib/customer.rb +41 -0
- data/features/support/lib/exceptions.rb +27 -0
- data/features/support/lib/names.rb +16 -0
- data/lib/clarify.rb +16 -14
- data/lib/clarify/bundle_repository.rb +26 -0
- data/lib/clarify/client.rb +51 -0
- data/lib/clarify/collection_iterator.rb +27 -0
- data/lib/clarify/configuration.rb +29 -7
- data/lib/clarify/errors.rb +22 -0
- data/lib/clarify/response.rb +29 -0
- data/lib/clarify/response_factory.rb +34 -0
- data/lib/clarify/responses/bundle.rb +11 -0
- data/lib/clarify/responses/collection.rb +31 -0
- data/lib/clarify/responses/no_body.rb +13 -0
- data/lib/clarify/responses/search_collection.rb +18 -0
- data/lib/clarify/responses/tracks.rb +15 -0
- data/lib/clarify/rest_client.rb +129 -0
- data/lib/clarify/version.rb +3 -1
- data/spec/clarify/bundle_repository_spec.rb +37 -0
- data/spec/clarify/client_spec.rb +93 -0
- data/spec/clarify/collection_iterator_spec.rb +86 -0
- data/spec/clarify/configuration_spec.rb +77 -0
- data/spec/clarify/errors_spec.rb +15 -0
- data/spec/clarify/response_factory_spec.rb +51 -0
- data/spec/clarify/response_spec.rb +69 -0
- data/spec/clarify/responses/bundle_spec.rb +8 -0
- data/spec/clarify/responses/collection_spec.rb +58 -0
- data/spec/clarify/responses/search_collection_spec.rb +40 -0
- data/spec/clarify/responses/tracks_spec.rb +18 -0
- data/spec/clarify/rest_client_spec.rb +222 -0
- data/spec/spec_helper.rb +4 -9
- data/src_readme/README_no_output.md +186 -0
- data/src_readme/examples/bundle_create.rb +11 -0
- data/src_readme/examples/bundle_fetch.rb +9 -0
- data/src_readme/examples/bundles_list_fetch.rb +11 -0
- data/src_readme/examples/bundles_paged_over.rb +8 -0
- data/src_readme/examples/bundles_search.rb +20 -0
- data/src_readme/examples/list_bundles.rb +6 -0
- data/src_readme/examples/searches_paged_over.rb +10 -0
- data/src_readme/examples/setup.rb +5 -0
- data/src_readme/make.rb +56 -0
- data/src_readme/readme.md.erb +55 -0
- metadata +127 -62
- data/LICENSE.txt +0 -24
- data/examples/create.rb +0 -14
- data/examples/delete.rb +0 -12
- data/examples/list.rb +0 -14
- data/examples/search.rb +0 -26
- data/examples/test.rb +0 -15
- data/lib/clarify/bundle.rb +0 -40
- data/lib/clarify/metadata.rb +0 -26
- data/lib/clarify/request.rb +0 -37
- data/lib/clarify/search.rb +0 -10
- data/lib/clarify/track.rb +0 -40
- data/spec/lib/clarify/bundle_spec.rb +0 -43
- data/spec/lib/clarify/configuration_spec.rb +0 -19
- data/spec/lib/clarify/metadata_spec.rb +0 -36
- data/spec/lib/clarify/search_spec.rb +0 -22
- data/spec/lib/clarify/track_spec.rb +0 -81
data/LICENSE.txt
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
Copyright (c) 2014 Clarify, Inc.
|
2
|
-
|
3
|
-
Written by Nola Stowe @rubygeek
|
4
|
-
|
5
|
-
MIT License
|
6
|
-
|
7
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
8
|
-
a copy of this software and associated documentation files (the
|
9
|
-
"Software"), to deal in the Software without restriction, including
|
10
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
11
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
12
|
-
permit persons to whom the Software is furnished to do so, subject to
|
13
|
-
the following conditions:
|
14
|
-
|
15
|
-
The above copyright notice and this permission notice shall be
|
16
|
-
included in all copies or substantial portions of the Software.
|
17
|
-
|
18
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
19
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
20
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
21
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
22
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
23
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
24
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/examples/create.rb
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
require 'clarify'
|
2
|
-
|
3
|
-
# This assumes that you set up your key in the environment using: export CLARIFY_API_KEY=abcde12345
|
4
|
-
Clarify.configure do |config|
|
5
|
-
# config.api_key = 'CLARIFY_API_KEY'
|
6
|
-
# if key in ENV
|
7
|
-
config.api_key = ENV['CLARIFY_API_KEY']
|
8
|
-
end
|
9
|
-
|
10
|
-
client = Clarify::Bundle.new
|
11
|
-
|
12
|
-
bundle = client.create(:name => "Dorothy and the Wizard of Oz",
|
13
|
-
:media_url => "http://media.clarify.io/audio/books/dorothyandthewizardinoz_01_baum_64kb.mp3")
|
14
|
-
puts bundle.data[:id]
|
data/examples/delete.rb
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
|
2
|
-
require 'clarify'
|
3
|
-
|
4
|
-
# This assumes that you set up your key in the environment using: export CLARIFY_API_KEY=abcde12345
|
5
|
-
Clarify.configure do |config|
|
6
|
-
# config.api_key = 'CLARIFY_API_KEY'
|
7
|
-
# if key in ENV
|
8
|
-
config.api_key = ENV['CLARIFY_API_KEY']
|
9
|
-
end
|
10
|
-
|
11
|
-
client = Clarify::Bundle.new
|
12
|
-
client.delete("abc123")
|
data/examples/list.rb
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
|
2
|
-
require 'clarify'
|
3
|
-
|
4
|
-
# This assumes that you set up your key in the environment using: export CLARIFY_API_KEY=abcde12345
|
5
|
-
Clarify.configure do |config|
|
6
|
-
# config.api_key = 'CLARIFY_API_KEY'
|
7
|
-
# if key in ENV
|
8
|
-
config.api_key = ENV['CLARIFY_API_KEY']
|
9
|
-
end
|
10
|
-
|
11
|
-
client = Clarify::Bundle.new
|
12
|
-
|
13
|
-
bundles = client.find_all.data[:_links][:items]
|
14
|
-
bundles.each { |bundle| puts bundle[:href] }
|
data/examples/search.rb
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
|
2
|
-
require 'clarify'
|
3
|
-
|
4
|
-
# This assumes that you set up your key in the environment using: export CLARIFY_API_KEY=abcde12345
|
5
|
-
Clarify.configure do |config|
|
6
|
-
# config.api_key = 'CLARIFY_API_KEY'
|
7
|
-
# if key in ENV
|
8
|
-
config.api_key = ENV['CLARIFY_API_KEY']
|
9
|
-
end
|
10
|
-
|
11
|
-
client = Clarify::Search.new
|
12
|
-
results = client.perform(:query => "dorothy").data
|
13
|
-
bundles = results[:_links][:items]
|
14
|
-
|
15
|
-
_bundle = Clarify::Bundle.new
|
16
|
-
|
17
|
-
bundles.each do |bundle|
|
18
|
-
_id = bundle[:href][12..44]
|
19
|
-
test = _bundle.find(_id)
|
20
|
-
puts test.data[:name]
|
21
|
-
i = bundles.find_index(bundle)
|
22
|
-
matches = results[:item_results][i][:term_results][0][:matches][0][:hits]
|
23
|
-
matches.each do |match|
|
24
|
-
puts match[:start].to_s + " -- " + match[:end].to_s
|
25
|
-
end
|
26
|
-
end
|
data/examples/test.rb
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
|
2
|
-
require 'clarify'
|
3
|
-
|
4
|
-
# This assumes that you set up your key in the environment using: export CLARIFY_API_KEY=abcde12345
|
5
|
-
Clarify.configure do |config|
|
6
|
-
# config.api_key = 'CLARIFY_API_KEY'
|
7
|
-
# if key in ENV
|
8
|
-
config.api_key = ENV['CLARIFY_API_KEY']
|
9
|
-
end
|
10
|
-
|
11
|
-
client = Clarify::Bundle.new
|
12
|
-
|
13
|
-
bundle = client.create(:name => "Harvard Sentences",
|
14
|
-
:media_url => "http://media.clarify.io/audio/samples/harvard-sentences-1.wav")
|
15
|
-
print bundle.data[:id]
|
data/lib/clarify/bundle.rb
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
require_relative 'request'
|
2
|
-
|
3
|
-
module Clarify
|
4
|
-
class Bundle < Request
|
5
|
-
|
6
|
-
def bundle_url
|
7
|
-
"/v#{version}/bundles"
|
8
|
-
end
|
9
|
-
|
10
|
-
def create(query={})
|
11
|
-
response = self.class.post("#{bundle_url}",
|
12
|
-
body: query,
|
13
|
-
headers: self.headers)
|
14
|
-
build_response(response)
|
15
|
-
end
|
16
|
-
|
17
|
-
def find(bundle_id, args={})
|
18
|
-
raise ArgumentError, "Missing bundle id" if bundle_id.nil?
|
19
|
-
response = self.class.get("#{bundle_url}/#{bundle_id}", query: args, headers: headers)
|
20
|
-
build_response(response)
|
21
|
-
end
|
22
|
-
|
23
|
-
def find_all(args={})
|
24
|
-
response = self.class.get("#{bundle_url}", headers: headers)
|
25
|
-
build_response(response)
|
26
|
-
end
|
27
|
-
|
28
|
-
def delete(bundle_id)
|
29
|
-
response = self.class.delete("#{bundle_url}/#{bundle_id}", headers: headers)
|
30
|
-
build_response(response)
|
31
|
-
end
|
32
|
-
|
33
|
-
def update(bundle_id, query={})
|
34
|
-
response = self.class.put("#{bundle_url}/#{bundle_id}",
|
35
|
-
body: query, headers: headers)
|
36
|
-
build_response(response)
|
37
|
-
end
|
38
|
-
|
39
|
-
end
|
40
|
-
end
|
data/lib/clarify/metadata.rb
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
require_relative 'request'
|
2
|
-
|
3
|
-
module Clarify
|
4
|
-
class Metadata < Request
|
5
|
-
|
6
|
-
def find(bundle_id)
|
7
|
-
raise ArgumentError, "Missing bundle id" if bundle_id.nil?
|
8
|
-
response = self.class.get("/#{version_name}/bundles/#{bundle_id}/metadata", headers: headers)
|
9
|
-
build_response(response)
|
10
|
-
end
|
11
|
-
|
12
|
-
def delete(bundle_id)
|
13
|
-
raise ArgumentError, "Missing bundle id" if bundle_id.nil?
|
14
|
-
response = self.class.delete("/#{version_name}/bundles/#{bundle_id}/metadata", headers: headers)
|
15
|
-
build_response(response)
|
16
|
-
end
|
17
|
-
|
18
|
-
def update(bundle_id, data="")
|
19
|
-
raise ArgumentError, "Missing bundle id" if bundle_id.nil?
|
20
|
-
response = self.class.put("/#{version_name}/bundles/#{bundle_id}/metadata",
|
21
|
-
body: {data: data} , headers: headers)
|
22
|
-
build_response(response)
|
23
|
-
end
|
24
|
-
|
25
|
-
end
|
26
|
-
end
|
data/lib/clarify/request.rb
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
require 'httparty'
|
2
|
-
require 'json'
|
3
|
-
|
4
|
-
module Clarify
|
5
|
-
|
6
|
-
Response = Struct.new(:status, :data)
|
7
|
-
|
8
|
-
class Request
|
9
|
-
include HTTParty
|
10
|
-
base_uri "https://api.clarify.io/"
|
11
|
-
version = 1
|
12
|
-
|
13
|
-
#uncomment below for httparty debugging
|
14
|
-
#debug_output
|
15
|
-
|
16
|
-
attr_accessor :version, :api_key
|
17
|
-
|
18
|
-
def initialize
|
19
|
-
@api_key = Clarify.configuration.api_key
|
20
|
-
end
|
21
|
-
|
22
|
-
def headers
|
23
|
-
{"Authorization" => "Bearer #{@api_key}",
|
24
|
-
"User-Agent" => "clarify-gem/#{Clarify::VERSION}/#{Gem.ruby_version.version}"}
|
25
|
-
end
|
26
|
-
|
27
|
-
def build_response(response)
|
28
|
-
if response.code != 204 #http code for no content
|
29
|
-
body = JSON.parse(response.parsed_response, symbolize_names: true)
|
30
|
-
else
|
31
|
-
body = ""
|
32
|
-
end
|
33
|
-
Response.new(response.code, body)
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
data/lib/clarify/search.rb
DELETED
data/lib/clarify/track.rb
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
require_relative 'request'
|
2
|
-
|
3
|
-
module Clarify
|
4
|
-
class Track < Request
|
5
|
-
|
6
|
-
def all(bundle_id)
|
7
|
-
raise ArgumentError, "Missing bundle id" if bundle_id.nil?
|
8
|
-
response = self.class.get("/#{version_name}/bundles/#{bundle_id}/tracks", headers: headers)
|
9
|
-
build_response(response)
|
10
|
-
end
|
11
|
-
|
12
|
-
def add(bundle_id, media_url)
|
13
|
-
raise ArgumentError, "Missing bundle id" if bundle_id.nil?
|
14
|
-
raise ArgumentError, "Missing media_url" if media_url.nil?
|
15
|
-
response = self.class.post("/#{version_name}/bundles/#{bundle_id}/tracks", body: {media_url: media_url}, headers: headers)
|
16
|
-
build_response(response)
|
17
|
-
end
|
18
|
-
|
19
|
-
def delete(bundle_id, track="")
|
20
|
-
raise ArgumentError, "Missing bundle id" if bundle_id.nil?
|
21
|
-
response = self.class.delete("/#{version_name}/bundles/#{bundle_id}/tracks", query: {track: track}, headers: headers)
|
22
|
-
build_response(response)
|
23
|
-
end
|
24
|
-
|
25
|
-
def delete_by_id(bundle_id, track_id)
|
26
|
-
raise ArgumentError, "Missing bundle id" if bundle_id.nil?
|
27
|
-
raise ArgumentError, "Missing track id" if track_id.nil?
|
28
|
-
response = self.class.delete("/#{version_name}/bundles/#{bundle_id}/tracks/#{track_id}", headers: headers)
|
29
|
-
build_response(response)
|
30
|
-
end
|
31
|
-
|
32
|
-
def find(bundle_id, track_id)
|
33
|
-
raise ArgumentError, "Missing bundle id" if bundle_id.nil?
|
34
|
-
raise ArgumentError, "Missing track id" if track_id.nil?
|
35
|
-
response = self.class.get("/#{version_name}/bundles/#{bundle_id}/tracks/#{track_id}", headers: headers)
|
36
|
-
build_response(response)
|
37
|
-
end
|
38
|
-
|
39
|
-
end
|
40
|
-
end
|
@@ -1,43 +0,0 @@
|
|
1
|
-
module Clarify
|
2
|
-
|
3
|
-
describe Bundle do
|
4
|
-
before do
|
5
|
-
@response = Bundle.new.create
|
6
|
-
@bundle_id = @response.data[:id]
|
7
|
-
end
|
8
|
-
|
9
|
-
after do
|
10
|
-
Bundle.new.delete(@bundle_id)
|
11
|
-
end
|
12
|
-
|
13
|
-
it "should create a new bundle with all blank values" do
|
14
|
-
expect(@response.data).to include(:_class, :_links, :id)
|
15
|
-
end
|
16
|
-
|
17
|
-
it "should retrieve the bundle created" do
|
18
|
-
response = Bundle.new.find(@bundle_id)
|
19
|
-
expect(response.status).to eql 200
|
20
|
-
end
|
21
|
-
|
22
|
-
it "should find all bundles" do
|
23
|
-
response = Bundle.new.find_all
|
24
|
-
expect(response.status).to eql 200
|
25
|
-
end
|
26
|
-
|
27
|
-
it "should update a bundle" do
|
28
|
-
response = Bundle.new.update(@bundle_id, {name: "test"})
|
29
|
-
expect(response.status).to eql 202
|
30
|
-
expect(response.data.keys).to include(:_class, :_links, :id)
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
context "deleting a bundle" do
|
35
|
-
it "should delete the bundle" do
|
36
|
-
response = Bundle.new.create
|
37
|
-
Bundle.new.delete(response.data[:id])
|
38
|
-
expect(Bundle.new.find(response.data[:id]).status).to be 404
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
end
|
43
|
-
|
@@ -1,19 +0,0 @@
|
|
1
|
-
module Clarify
|
2
|
-
describe Config do
|
3
|
-
before do
|
4
|
-
Clarify.configure do |config|
|
5
|
-
config.api_key = ENV['CLARIFY_API_KEY']
|
6
|
-
config.version = 5
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
10
|
-
it "should set the api_key in configuration" do
|
11
|
-
expect(Request.new.api_key).to eql(ENV['CLARIFY_API_KEY'])
|
12
|
-
end
|
13
|
-
|
14
|
-
it "should set the version number in the configuration" do
|
15
|
-
expect(Request.new.version_name).to eql("v5")
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
@@ -1,36 +0,0 @@
|
|
1
|
-
module Clarify
|
2
|
-
|
3
|
-
describe Metadata do
|
4
|
-
before do
|
5
|
-
bundle = Bundle.new.create
|
6
|
-
@bundle_id = bundle.data[:id]
|
7
|
-
end
|
8
|
-
|
9
|
-
after do
|
10
|
-
Bundle.new.delete(@bundle_id)
|
11
|
-
end
|
12
|
-
|
13
|
-
it "should retrieve the metadata for bundle" do
|
14
|
-
metadata = Metadata.new.find(@bundle_id)
|
15
|
-
expect(metadata.status).to eql 200
|
16
|
-
end
|
17
|
-
|
18
|
-
it "should update a bundle" do
|
19
|
-
metadata = Metadata.new.update(@bundle_id, '{"meta": 1}')
|
20
|
-
expect(metadata.status).to eql 202
|
21
|
-
expect(metadata.data.keys).to include(:_class, :_links)
|
22
|
-
end
|
23
|
-
|
24
|
-
it "should delete the metadata" do
|
25
|
-
Metadata.new.update(@bundle_id, '{"meta": 1}')
|
26
|
-
metadata_before = Metadata.new.find(@bundle_id)
|
27
|
-
expect(metadata_before.data[:data].keys).to include :meta
|
28
|
-
|
29
|
-
metadata_after = Metadata.new.delete(@bundle_id)
|
30
|
-
expect(metadata_after.status).to eq 204
|
31
|
-
expect(metadata_after.data).to be_empty
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
end
|
36
|
-
|
@@ -1,22 +0,0 @@
|
|
1
|
-
module Clarify
|
2
|
-
|
3
|
-
describe Search do
|
4
|
-
before do
|
5
|
-
@response = Bundle.new.create
|
6
|
-
@bundle_id = @response.data[:id]
|
7
|
-
@media_url = "http://media.clarify.io/audio/samples/harvard-sentences-1.wav"
|
8
|
-
@response = Track.new.add(@bundle_id, @media_url)
|
9
|
-
end
|
10
|
-
|
11
|
-
after do
|
12
|
-
Bundle.new.delete(@bundle_id)
|
13
|
-
end
|
14
|
-
|
15
|
-
it "should search for a word in speech" do
|
16
|
-
response = Search.new.perform({query: "cat"})
|
17
|
-
expect(response.data[:item_results].first[:term_results].first[:matches].first[:hits].size).to eql 2
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
end
|
22
|
-
|
@@ -1,81 +0,0 @@
|
|
1
|
-
module Clarify
|
2
|
-
|
3
|
-
describe Track do
|
4
|
-
|
5
|
-
before do
|
6
|
-
bundle = Bundle.new.create
|
7
|
-
@bundle_id = bundle.data[:id]
|
8
|
-
end
|
9
|
-
|
10
|
-
after do
|
11
|
-
Bundle.new.delete(@bundle_id)
|
12
|
-
end
|
13
|
-
|
14
|
-
context "adding tracks and getting tracks for bundle" do
|
15
|
-
before do
|
16
|
-
@media_url = "http://media.clarify.io/audio/samples/harvard-sentences-1.wav"
|
17
|
-
@response = Track.new.add(@bundle_id, @media_url)
|
18
|
-
end
|
19
|
-
it "should be successful" do
|
20
|
-
expect(@response.status).to eql 201
|
21
|
-
expect(@response.data.keys).to include(:_class, :_links)
|
22
|
-
end
|
23
|
-
it "should list track in bundle" do
|
24
|
-
response = Track.new.all(@bundle_id)
|
25
|
-
expect(response.data[:tracks]).to be_an_instance_of(Array)
|
26
|
-
expect(response.data[:tracks][0][:media_url]).to eql @media_url
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
context "adding a track and deleting all tracks for bundle" do
|
31
|
-
before do
|
32
|
-
@media_url = "http://media.clarify.io/audio/samples/harvard-sentences-1.wav"
|
33
|
-
@add_response = Track.new.add(@bundle_id, @media_url)
|
34
|
-
@del_response = Track.new.delete(@bundle_id)
|
35
|
-
end
|
36
|
-
it "should be successful" do
|
37
|
-
expect(@del_response.status).to eql 204
|
38
|
-
end
|
39
|
-
it "should not be in bundle" do
|
40
|
-
response = Track.new.all(@bundle_id)
|
41
|
-
expect(response.data[:tracks]).to be_empty
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
context "adding a track and finding by track_id" do
|
46
|
-
before do
|
47
|
-
media_url = "http://media.clarify.io/audio/samples/harvard-sentences-1.wav"
|
48
|
-
Track.new.add(@bundle_id, media_url)
|
49
|
-
|
50
|
-
all_tracks = Track.new.all(@bundle_id)
|
51
|
-
|
52
|
-
@track_id = all_tracks.data[:tracks].first[:id]
|
53
|
-
@find_response = Track.new.find(@bundle_id, @track_id)
|
54
|
-
end
|
55
|
-
it "should be successful" do
|
56
|
-
expect(@find_response.status).to eql 200
|
57
|
-
end
|
58
|
-
it "should have some keys and duration value" do
|
59
|
-
expect(@find_response.data.keys).to include(:audio_channel,:audio_language, :duration)
|
60
|
-
expect(@find_response.data[:duration]).to eql 64.422875
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
context "adding a track and deleting by delete_by_id " do
|
65
|
-
before do
|
66
|
-
media_url = "http://media.clarify.io/audio/samples/harvard-sentences-1.wav"
|
67
|
-
Track.new.add(@bundle_id, media_url)
|
68
|
-
|
69
|
-
all_tracks = Track.new.all(@bundle_id)
|
70
|
-
|
71
|
-
@track_id = all_tracks.data[:tracks].first[:id]
|
72
|
-
@find_response = Track.new.delete_by_id(@bundle_id, @track_id)
|
73
|
-
end
|
74
|
-
it "should be successful" do
|
75
|
-
expect(@find_response.status).to eql 204
|
76
|
-
end
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
end
|
81
|
-
|