proteus_client 0.0.4 → 0.0.5
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.
- data/lib/proteus_client/proxy.rb +17 -18
- data/spec/proteus_client_spec.rb +15 -18
- metadata +2 -2
data/lib/proteus_client/proxy.rb
CHANGED
|
@@ -36,26 +36,26 @@ module ProteusClient
|
|
|
36
36
|
{ message: response.body }
|
|
37
37
|
end
|
|
38
38
|
|
|
39
|
-
def
|
|
40
|
-
|
|
41
|
-
submit_request_and_parse_json(:post, '/
|
|
42
|
-
|
|
39
|
+
def create_video_locations
|
|
40
|
+
video_locations =
|
|
41
|
+
submit_request_and_parse_json(:post, '/video_locations')
|
|
42
|
+
format_video_locations(video_locations)
|
|
43
43
|
end
|
|
44
44
|
|
|
45
|
-
def
|
|
46
|
-
|
|
47
|
-
submit_request_and_parse_json(:post, '/
|
|
45
|
+
def create_multiple_video_locations(count)
|
|
46
|
+
video_locations =
|
|
47
|
+
submit_request_and_parse_json(:post, '/video_locations',
|
|
48
48
|
count: count)
|
|
49
|
-
|
|
49
|
+
video_locations.map { |v| format_video_locations(v) }
|
|
50
50
|
end
|
|
51
51
|
|
|
52
|
-
def create_video(
|
|
52
|
+
def create_video(video_locations_id, type)
|
|
53
53
|
body =
|
|
54
54
|
submit_request_and_parse_json(:post, '/videos',
|
|
55
|
-
|
|
55
|
+
video_locations_id: video_locations_id,
|
|
56
56
|
type: type)
|
|
57
57
|
|
|
58
|
-
{ video_id: body['_id'], url: body['
|
|
58
|
+
{ video_id: body['_id'], url: body['locations_url'] }
|
|
59
59
|
end
|
|
60
60
|
|
|
61
61
|
def create_video_versions(video_id, settings = nil)
|
|
@@ -75,8 +75,8 @@ module ProteusClient
|
|
|
75
75
|
submit_request_and_parse_json(:get_raw, "/videos", ids: video_ids)
|
|
76
76
|
end
|
|
77
77
|
|
|
78
|
-
def
|
|
79
|
-
url = "/
|
|
78
|
+
def get_video_locations(video_locations_id)
|
|
79
|
+
url = "/video_locations/#{video_locations_id}"
|
|
80
80
|
submit_request_and_parse_json(:get, url)
|
|
81
81
|
end
|
|
82
82
|
|
|
@@ -103,12 +103,11 @@ module ProteusClient
|
|
|
103
103
|
end
|
|
104
104
|
end
|
|
105
105
|
|
|
106
|
-
def
|
|
107
|
-
urls = { direct:
|
|
108
|
-
stream:
|
|
109
|
-
upload: video_allocation['url_upload'] }
|
|
106
|
+
def format_video_locations(video_locations)
|
|
107
|
+
urls = { direct: video_locations['url_direct'] ,
|
|
108
|
+
stream: video_locations['url_stream'] }
|
|
110
109
|
|
|
111
|
-
{
|
|
110
|
+
{ video_locations_id: video_locations['_id'], urls: urls }
|
|
112
111
|
end
|
|
113
112
|
|
|
114
113
|
end
|
data/spec/proteus_client_spec.rb
CHANGED
|
@@ -36,35 +36,34 @@ describe ProteusClient::Proxy do
|
|
|
36
36
|
|
|
37
37
|
end
|
|
38
38
|
|
|
39
|
-
context 'call to
|
|
39
|
+
context 'call to create_video_locations'do
|
|
40
40
|
|
|
41
41
|
before(:all) do
|
|
42
|
-
|
|
43
|
-
@response = proteus_client.
|
|
42
|
+
stub_create_video_locations
|
|
43
|
+
@response = proteus_client.create_video_locations
|
|
44
44
|
end
|
|
45
45
|
|
|
46
46
|
it "returns a hash" do
|
|
47
47
|
@response.class.should == Hash
|
|
48
48
|
end
|
|
49
49
|
|
|
50
|
-
it "returns
|
|
51
|
-
@response[:
|
|
50
|
+
it "returns video_locations_id" do
|
|
51
|
+
@response[:video_locations_id].should == '4fe0f752831a9d08bb000010'
|
|
52
52
|
end
|
|
53
53
|
|
|
54
54
|
it "returns urls" do
|
|
55
55
|
@response[:urls].should ==
|
|
56
56
|
{ direct: 'direct/4fe0f752831a9d08bb000010.flv',
|
|
57
|
-
stream: 'stream/4fe0f752831a9d08bb000010.flv'
|
|
58
|
-
upload: 'upload/4fe0f752831a9d08bb000010.flv' }
|
|
57
|
+
stream: 'stream/4fe0f752831a9d08bb000010.flv'}
|
|
59
58
|
end
|
|
60
59
|
|
|
61
60
|
end
|
|
62
61
|
|
|
63
|
-
context 'call to
|
|
62
|
+
context 'call to create_multiple_video_locations' do
|
|
64
63
|
|
|
65
64
|
before(:all) do
|
|
66
|
-
|
|
67
|
-
@response = proteus_client.
|
|
65
|
+
stub_create_multiple_video_locations
|
|
66
|
+
@response = proteus_client.create_multiple_video_locations(2)
|
|
68
67
|
end
|
|
69
68
|
|
|
70
69
|
it "returns an array with two hashes" do
|
|
@@ -73,15 +72,14 @@ describe ProteusClient::Proxy do
|
|
|
73
72
|
@response[0].class.should == Hash
|
|
74
73
|
end
|
|
75
74
|
|
|
76
|
-
it "returns
|
|
77
|
-
@response[0][:
|
|
75
|
+
it "returns video_locations_id" do
|
|
76
|
+
@response[0][:video_locations_id].should == '4fe0f752831a9d08bb000010'
|
|
78
77
|
end
|
|
79
78
|
|
|
80
79
|
it "returns urls" do
|
|
81
80
|
@response[0][:urls].should ==
|
|
82
81
|
{ direct: 'direct/4fe0f752831a9d08bb000010.flv',
|
|
83
|
-
stream: 'stream/4fe0f752831a9d08bb000010.flv'
|
|
84
|
-
upload: 'upload/4fe0f752831a9d08bb000010.flv' }
|
|
82
|
+
stream: 'stream/4fe0f752831a9d08bb000010.flv'}
|
|
85
83
|
end
|
|
86
84
|
|
|
87
85
|
end
|
|
@@ -183,14 +181,14 @@ describe ProteusClient::Proxy do
|
|
|
183
181
|
|
|
184
182
|
end
|
|
185
183
|
|
|
186
|
-
context 'call to
|
|
184
|
+
context 'call to get_video_locations' do
|
|
187
185
|
|
|
188
186
|
context 'with valid arguments' do
|
|
189
187
|
|
|
190
188
|
before(:all) do
|
|
191
|
-
|
|
189
|
+
stub_get_video_locations
|
|
192
190
|
@response = proteus_client.
|
|
193
|
-
|
|
191
|
+
get_video_locations('4fe0f752831a9d08bb000010')
|
|
194
192
|
end
|
|
195
193
|
|
|
196
194
|
it "returns a hash" do
|
|
@@ -200,7 +198,6 @@ describe ProteusClient::Proxy do
|
|
|
200
198
|
it "returns video with correct format" do
|
|
201
199
|
@response['url_direct'].class.should == String
|
|
202
200
|
@response['url_stream'].class.should == String
|
|
203
|
-
@response['url_upload'].class.should == String
|
|
204
201
|
end
|
|
205
202
|
|
|
206
203
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: proteus_client
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.5
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2012-
|
|
12
|
+
date: 2012-09-27 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: json
|