proteus_client 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -36,17 +36,19 @@ module ProteusClient
36
36
  { message: response.body }
37
37
  end
38
38
 
39
- def create_video_locations
40
- video_locations =
41
- submit_request_and_parse_json(:post, '/video_locations')
42
- format_video_locations(video_locations)
39
+ def create_video_locations(id = nil)
40
+ params = id ? {id: id} : {}
41
+
42
+ video_locations =
43
+ submit_request_and_parse_json(:post, '/video_locations', params)
44
+ format_video_locations(video_locations)
43
45
  end
44
46
 
45
47
  def create_multiple_video_locations(count)
46
- video_locations =
47
- submit_request_and_parse_json(:post, '/video_locations',
48
- count: count)
49
- video_locations.map { |v| format_video_locations(v) }
48
+ video_locations =
49
+ submit_request_and_parse_json(:post, '/video_locations',
50
+ count: count)
51
+ video_locations.map { |v| format_video_locations(v) }
50
52
  end
51
53
 
52
54
  def create_video(video_locations_id, type)
@@ -58,9 +60,10 @@ module ProteusClient
58
60
  { video_id: body['_id'], url: body['url'] }
59
61
  end
60
62
 
61
- def create_video_versions(video_id, settings = nil)
63
+ def create_video_versions(video_id, output_type, settings = nil)
62
64
  params = {}
63
65
  params[:version_settings] = settings if settings
66
+ params[:output_type] = output_type
64
67
 
65
68
  submit_request(:post, "/videos/#{video_id}/versions", params)
66
69
 
@@ -98,9 +101,9 @@ module ProteusClient
98
101
  @domain["#{route}?#{string_params}"].get()
99
102
  when :post
100
103
  @domain[route].post(params, content_type: :json)
101
- else
102
- raise 'Undefined method'
103
- end
104
+ else
105
+ raise 'Undefined method'
106
+ end
104
107
  end
105
108
 
106
109
  def format_video_locations(video_locations)
@@ -56,6 +56,14 @@ describe ProteusClient::Proxy do
56
56
  { direct: 'direct/4fe0f752831a9d08bb000010.flv',
57
57
  stream: 'stream/4fe0f752831a9d08bb000010.flv'}
58
58
  end
59
+
60
+ it "creates with id sent" do
61
+ id = '4fe0f752831a9d08bb000011'
62
+ stub_create_video_locations_with_id(id)
63
+ response = proteus_client.create_video_locations(id)
64
+
65
+ response[:video_locations_id].should == id
66
+ end
59
67
 
60
68
  end
61
69
 
@@ -108,9 +116,9 @@ describe ProteusClient::Proxy do
108
116
 
109
117
  before(:all) do
110
118
  stub_response_with_params(:post, '/videos/4fe0f752831a9d08bb000010/versions',
111
- 200, '',{})
119
+ 200, '', output_type: 'direct')
112
120
  @response = proteus_client.
113
- create_video_versions('4fe0f752831a9d08bb000010')
121
+ create_video_versions('4fe0f752831a9d08bb000010', 'direct')
114
122
  end
115
123
 
116
124
  it "returns success message" do
@@ -123,9 +131,9 @@ describe ProteusClient::Proxy do
123
131
 
124
132
  before(:all) do
125
133
  stub_response_with_params(:post, '/videos/4fe0f752831a9d08bb000010/versions',
126
- 200, '', version_settings: 'mobile')
134
+ 200, '', version_settings: 'mobile', output_type: 'stream')
127
135
  @response = proteus_client.
128
- create_video_versions('4fe0f752831a9d08bb000010','mobile')
136
+ create_video_versions('4fe0f752831a9d08bb000010', 'stream', 'mobile')
129
137
  end
130
138
 
131
139
  it "returns true" do
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.6
4
+ version: 0.0.7
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-09-27 00:00:00.000000000 Z
12
+ date: 2012-10-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json