vzaar 1.2.3 → 1.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/vzaar/request/process_video.rb +18 -52
- data/lib/vzaar/version.rb +1 -1
- data/spec/vzaar/request/process_video.rb +36 -0
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7ead17a9da83c804eed68c6c5216fcfc2a829a4b
|
4
|
+
data.tar.gz: 7e4937420e0b0d14218869924fb5c1427e85aff7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ff7a580c3554b96b9b680e18416fa5af97b93636e214d487eaef344832d89ec2f639770674dc50340cb0ab087f1c2b2eec620a438332f5df25315cca73d1229d
|
7
|
+
data.tar.gz: c2400435c3e52772e60e09861a30b295a94cafa5dc271c0579ab1e011639e02bdaaebc85984b0050a1df99c410fd19c94cee893ddf10e243fd8ae2ccbf1a5a63
|
@@ -9,73 +9,39 @@ module Vzaar
|
|
9
9
|
private
|
10
10
|
|
11
11
|
def json_body
|
12
|
-
|
13
|
-
"vzaar_api" => {
|
14
|
-
"video" => {
|
15
|
-
"guid" => options[:guid],
|
16
|
-
"title" => options[:title],
|
17
|
-
"description" => options[:description],
|
18
|
-
"profile" => options[:profile],
|
19
|
-
"transcoding" => options[:transcoding],
|
20
|
-
"replace_id" => options[:replace_id]
|
21
|
-
}
|
22
|
-
}
|
23
|
-
}.delete_if { |k,v| v.nil? }
|
24
|
-
|
25
|
-
if include_encoding_options?
|
26
|
-
return h.merge({ "encoding" => {
|
27
|
-
"width" => options[:width],
|
28
|
-
"bitrate" => options[:bitrate]
|
29
|
-
}
|
30
|
-
})
|
31
|
-
end
|
32
|
-
h
|
33
|
-
end
|
34
|
-
|
35
|
-
def include_encoding_options?
|
36
|
-
options[:profile] == 6 && options[:width] && options[:bitrate]
|
12
|
+
get_opts.to_json
|
37
13
|
end
|
38
14
|
|
39
15
|
def xml_body
|
40
16
|
request_xml = %{
|
41
17
|
<?xml version="1.0" encoding="UTF-8"?>
|
42
|
-
|
43
|
-
<video>
|
44
|
-
<guid>#{options[:guid]}</guid>
|
45
|
-
<title>#{options[:title]}</title>
|
46
|
-
<description>#{options[:description]}</description>
|
47
|
-
<profile>#{options[:profile]}</profile>
|
18
|
+
#{hash_to_xml(get_opts)}
|
48
19
|
}
|
49
20
|
|
50
|
-
|
51
|
-
|
52
|
-
<transcoding>#{options[:transcoding]}</transcoding>
|
53
|
-
}
|
54
|
-
end
|
21
|
+
request_xml
|
22
|
+
end
|
55
23
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
end
|
24
|
+
def get_opts
|
25
|
+
raise Vzaar::Error, "Guid required to process video." unless options[:guid]
|
26
|
+
|
27
|
+
h = options.dup.delete_if { |k,v| v.nil? }
|
61
28
|
|
62
29
|
if include_encoding_options?
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
</encoding>
|
68
|
-
}
|
30
|
+
width = h.delete(:width)
|
31
|
+
bitrate = h.delete(:bitrate)
|
32
|
+
|
33
|
+
h[:encoding] = {width: width, bitrate: bitrate}
|
69
34
|
end
|
70
35
|
|
71
|
-
|
72
|
-
|
73
|
-
|
36
|
+
{ vzaar_api: {
|
37
|
+
video: h
|
38
|
+
}
|
74
39
|
}
|
75
|
-
|
76
|
-
request_xml
|
77
40
|
end
|
78
41
|
|
42
|
+
def include_encoding_options?
|
43
|
+
options[:profile] == 6 && options[:width] && options[:bitrate]
|
44
|
+
end
|
79
45
|
end
|
80
46
|
end
|
81
47
|
end
|
data/lib/vzaar/version.rb
CHANGED
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require './lib/vzaar/request/process_video'
|
3
|
+
|
4
|
+
describe Vzaar::Request::ProcessVideo do
|
5
|
+
subject { described_class.new nil, opts }
|
6
|
+
|
7
|
+
describe "#get_opts" do
|
8
|
+
context "when options received are missing guid" do
|
9
|
+
let(:opts) { {} }
|
10
|
+
|
11
|
+
it "should raise an exception" do
|
12
|
+
expect { subject.send(:get_opts) }.to raise_error Vzaar::Error, "Guid required to process video."
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
shared_examples "options have the guid" do
|
17
|
+
it "should format the hash" do
|
18
|
+
expect(subject.send(:get_opts)).to eq(expected_opts)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
context "when options received contain the guid" do
|
23
|
+
let(:opts) { { guid: "testguid", title: "sometitle" } }
|
24
|
+
let(:expected_opts) { { vzaar_api: { video: opts } } }
|
25
|
+
|
26
|
+
it_behaves_like "options have the guid"
|
27
|
+
end
|
28
|
+
|
29
|
+
context "when options have guid and encoding information" do
|
30
|
+
let(:opts) { { guid: "testguid", title: "sometitle", profile: 6, width: 10, bitrate: 20 } }
|
31
|
+
let(:expected_opts) { { vzaar_api: { video: { guid: "testguid", title: "sometitle", profile: 6, encoding: { width: 10, bitrate: 20 } } } } }
|
32
|
+
|
33
|
+
it_behaves_like "options have the guid"
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vzaar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ed James
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-07-
|
12
|
+
date: 2014-07-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|
@@ -267,6 +267,7 @@ files:
|
|
267
267
|
- spec/vzaar/api_xml_spec.rb
|
268
268
|
- spec/vzaar/connection_spec.rb
|
269
269
|
- spec/vzaar/request/base_spec.rb
|
270
|
+
- spec/vzaar/request/process_video.rb
|
270
271
|
- spec/vzaar/request/url_spec.rb
|
271
272
|
- spec/vzaar/resources/account_type_spec.rb
|
272
273
|
- spec/vzaar/resources/signature_spec.rb
|
@@ -296,7 +297,7 @@ rubyforge_project:
|
|
296
297
|
rubygems_version: 2.2.2
|
297
298
|
signing_key:
|
298
299
|
specification_version: 4
|
299
|
-
summary: vzaar-1.2.
|
300
|
+
summary: vzaar-1.2.4
|
300
301
|
test_files:
|
301
302
|
- spec/fixtures/vcr_cassettes/account_type-fail.yml
|
302
303
|
- spec/fixtures/vcr_cassettes/account_type-success.yml
|
@@ -340,6 +341,7 @@ test_files:
|
|
340
341
|
- spec/vzaar/api_xml_spec.rb
|
341
342
|
- spec/vzaar/connection_spec.rb
|
342
343
|
- spec/vzaar/request/base_spec.rb
|
344
|
+
- spec/vzaar/request/process_video.rb
|
343
345
|
- spec/vzaar/request/url_spec.rb
|
344
346
|
- spec/vzaar/resources/account_type_spec.rb
|
345
347
|
- spec/vzaar/resources/signature_spec.rb
|