vzaar 1.3.1 → 1.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/.gitignore +1 -0
- data/examples/spec_helper.rb +0 -1
- data/examples/upload_audio_spec.rb +36 -0
- data/examples/upload_video_spec.rb +21 -7
- data/examples/video_list_spec.rb +31 -8
- data/lib/vzaar.rb +1 -0
- data/lib/vzaar/api.rb +18 -1
- data/lib/vzaar/request/process_audio.rb +15 -0
- data/lib/vzaar/resources/video_collection.rb +5 -3
- data/lib/vzaar/version.rb +1 -1
- data/spec/support/burial_short.wav +0 -0
- metadata +37 -33
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
NDcwYTZmZWYzZmMwM2I5N2M0YjM0MjRmMGU0Y2MwOWE5MDg2MWYxZg==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 4e149cb5a25c313d942932a742e4730b7e1123ee
|
4
|
+
data.tar.gz: 0e0ffebfdba59fb4365bbc97b640d5753c56e3a8
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
MTE2MDQ3YmE5OTI3MGFiMWEzNDM5Y2JlMTViMzY4NzcwNjE3NzVlOTM3ODdi
|
11
|
-
NmIzODA1ZWMzOGRhMDcyY2RlNzcxM2U5YWZjMGFiNWRkNjcwN2E=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
MDdkNDIyNTBhYjlmMmVmMTBhNDc4YjEwYjYwOTQ1ODY0NTRjM2ZkNzdkNDU3
|
14
|
-
MzZjMGViYTMxNzRlY2E3N2RmZjJiMTUyZWVhOTg0ZjdhMWM4YjM1ODg3N2Fh
|
15
|
-
ZmFiM2IwZmE3YTJmYjAxNGY4ZGRlMzM4MzExZDc3MzRiZGEyYjg=
|
6
|
+
metadata.gz: f2f2bfe487a22452b22cdc27629e127d5d44ae60363a5c7756f9c70049cb38da39ee6bf0bc30b0696469992fddd64063b54e16f69b10d051331b8fa6d1bf85f1
|
7
|
+
data.tar.gz: 345eca563b521c5c6d1ef85fdedeee24d6946d252bfee47c8a5bd55741ccd4f8699e84009f050631e0eecfbcbac1bf95cfb3d8c837da06d4a43a5b0b1b5634f9
|
data/.gitignore
CHANGED
data/examples/spec_helper.rb
CHANGED
@@ -0,0 +1,36 @@
|
|
1
|
+
require_relative './spec_helper'
|
2
|
+
|
3
|
+
describe "Upload Audio" do
|
4
|
+
|
5
|
+
context "File uploads" do
|
6
|
+
file_path = "./spec/support/burial_short.wav"
|
7
|
+
desc = "Upload audio"
|
8
|
+
|
9
|
+
context "Authenticated User" do
|
10
|
+
context "RW token" do
|
11
|
+
before(:all) do
|
12
|
+
api = _api(login: user1["login"],
|
13
|
+
application_token: user1["rw_token"])
|
14
|
+
|
15
|
+
title = "api-test-#{rand_str}"
|
16
|
+
@res = api.upload_audio(path: file_path, title: title, description: desc, bitrate: 192)
|
17
|
+
end
|
18
|
+
|
19
|
+
specify { expect(@res.http_status_code).to eq 201 }
|
20
|
+
specify { expect(@res.id.to_s).to match(/^[0-9]+$/) }
|
21
|
+
end
|
22
|
+
|
23
|
+
context "RO token" do
|
24
|
+
it_behaves_like "RO only", user1["login"], user1["ro_token"], -> (api) do
|
25
|
+
api.upload_audio(path: file_path, description: desc, bitrate: 192)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
context "when user is unauthenticated" do
|
31
|
+
it_behaves_like "Unauthenticated", -> (api) do
|
32
|
+
api.upload_audio(path: file_path, title: "woof", description: desc, bitrate: 192)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -8,16 +8,30 @@ describe "Upload Video" do
|
|
8
8
|
|
9
9
|
context "Authenticated User" do
|
10
10
|
context "RW token" do
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
describe "xml" do
|
12
|
+
before(:all) do
|
13
|
+
api = _api(login: user1["login"],
|
14
|
+
application_token: user1["rw_token"])
|
14
15
|
|
15
|
-
|
16
|
-
|
16
|
+
title = "api-test-#{rand_str}"
|
17
|
+
@res = api.upload_video(path: file_path, title: title, description: desc)
|
18
|
+
end
|
19
|
+
|
20
|
+
specify { expect(@res.http_status_code).to eq 201 }
|
21
|
+
specify { expect(@res.id.to_s).to match(/^[0-9]+$/) }
|
17
22
|
end
|
18
23
|
|
19
|
-
|
20
|
-
|
24
|
+
describe "json" do
|
25
|
+
before(:all) do
|
26
|
+
api = _api(login: user1["login"],
|
27
|
+
application_token: user1["rw_token"])
|
28
|
+
|
29
|
+
title = "api-test-#{rand_str}"
|
30
|
+
@res = api.upload_video(path: file_path, title: title, description: desc, format: :json)
|
31
|
+
end
|
32
|
+
|
33
|
+
specify { expect(@res["id"].to_s).to match(/^[0-9]+$/) }
|
34
|
+
end
|
21
35
|
end
|
22
36
|
|
23
37
|
context "RO token" do
|
data/examples/video_list_spec.rb
CHANGED
@@ -2,18 +2,41 @@ require_relative './spec_helper'
|
|
2
2
|
|
3
3
|
describe "Video List" do
|
4
4
|
context "when user is unauthenticated" do
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
context "when Public API Feeds is enabled" do
|
6
|
+
describe "params" do
|
7
|
+
before(:all) do
|
8
|
+
@api = unauthenticated_api
|
9
|
+
end
|
8
10
|
|
11
|
+
describe "status" do
|
12
|
+
context "when multiple values are passed" do
|
13
|
+
before do
|
14
|
+
@res = @api.video_list(user_with_public_api["login"], params: { status: "replaced,deleted" })
|
15
|
+
end
|
16
|
+
it_behaves_like "200 OK"
|
17
|
+
end
|
9
18
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
19
|
+
context "valid param" do
|
20
|
+
before do
|
21
|
+
@res = @api.video_list(user_with_public_api["login"], params: { status: "processing" })
|
22
|
+
end
|
23
|
+
it_behaves_like "200 OK"
|
24
|
+
end
|
25
|
+
|
26
|
+
context "when invalid param" do
|
27
|
+
before do
|
28
|
+
@res = @api.video_list(user_with_public_api["login"], params: { status: "boom" })
|
29
|
+
end
|
30
|
+
it_behaves_like "422 Failure"
|
31
|
+
end
|
32
|
+
end
|
14
33
|
end
|
34
|
+
end
|
15
35
|
|
16
|
-
|
36
|
+
context "when Public API Feeds is disabled" do
|
37
|
+
it_behaves_like "Unauthenticated", -> (api) do
|
38
|
+
api.video_list(user1["login"])
|
39
|
+
end
|
17
40
|
end
|
18
41
|
end
|
19
42
|
end
|
data/lib/vzaar.rb
CHANGED
data/lib/vzaar/api.rb
CHANGED
@@ -27,7 +27,7 @@ module Vzaar
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def videos(opts={})
|
30
|
-
video_list(conn.login, { authenticated: true
|
30
|
+
video_list(conn.login, opts.merge({ authenticated: true }))
|
31
31
|
end
|
32
32
|
|
33
33
|
def delete_video(video_id, opts={})
|
@@ -46,6 +46,17 @@ module Vzaar
|
|
46
46
|
Request::ProcessVideo.new(conn, opts).execute
|
47
47
|
end
|
48
48
|
|
49
|
+
def process_audio(opts={})
|
50
|
+
Request::ProcessAudio.new(conn, opts).execute
|
51
|
+
end
|
52
|
+
|
53
|
+
def upload_audio(opts={})
|
54
|
+
uploader = Uploader.new(conn, signature, opts)
|
55
|
+
uploader.upload do |u|
|
56
|
+
process_audio(u.processing_params)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
49
60
|
def upload_video(opts={})
|
50
61
|
uploader = Uploader.new(conn, signature, opts)
|
51
62
|
uploader.upload do |u|
|
@@ -70,5 +81,11 @@ module Vzaar
|
|
70
81
|
_opts = opts.merge({ guid: sig.guid, key: sig.key, url: url })
|
71
82
|
Request::LinkUpload.new(conn, _opts).execute
|
72
83
|
end
|
84
|
+
|
85
|
+
def s3_upload(file_path)
|
86
|
+
uploader = Uploader.new(conn, signature, path: file_path)
|
87
|
+
uploader.upload
|
88
|
+
uploader.processing_params
|
89
|
+
end
|
73
90
|
end
|
74
91
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Vzaar
|
2
|
+
module Request
|
3
|
+
class ProcessAudio < ProcessVideo
|
4
|
+
endpoint '/api/audios'
|
5
|
+
|
6
|
+
private
|
7
|
+
|
8
|
+
def get_opts
|
9
|
+
raise Vzaar::Error, "Guid required to process video." unless options[:guid]
|
10
|
+
h = options.dup.delete_if { |k,v| v.nil? }
|
11
|
+
{ vzaar_api: { audio: h }}
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -6,9 +6,11 @@ module Vzaar
|
|
6
6
|
def initialize(xml_body, status_code)
|
7
7
|
@http_status_code = status_code.to_i
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
if @http_status_code == 200
|
10
|
+
doc = Nokogiri::XML(xml_body)
|
11
|
+
doc.xpath("//videos/video").each do |xml|
|
12
|
+
push(VideoCollectionItem.new(xml.to_s))
|
13
|
+
end
|
12
14
|
end
|
13
15
|
end
|
14
16
|
end
|
data/lib/vzaar/version.rb
CHANGED
Binary file
|
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.
|
4
|
+
version: 1.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ed James
|
@@ -9,160 +9,160 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-11-
|
12
|
+
date: 2014-11-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- - ~>
|
18
|
+
- - "~>"
|
19
19
|
- !ruby/object:Gem::Version
|
20
20
|
version: '1.6'
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
|
-
- - ~>
|
25
|
+
- - "~>"
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: '1.6'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: httpclient
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
|
-
- - ~>
|
32
|
+
- - "~>"
|
33
33
|
- !ruby/object:Gem::Version
|
34
34
|
version: '2.3'
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
|
-
- - ~>
|
39
|
+
- - "~>"
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: '2.3'
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: oauth
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
|
-
- - ~>
|
46
|
+
- - "~>"
|
47
47
|
- !ruby/object:Gem::Version
|
48
48
|
version: '0.4'
|
49
49
|
type: :runtime
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
|
-
- - ~>
|
53
|
+
- - "~>"
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
version: '0.4'
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: bundler
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
59
59
|
requirements:
|
60
|
-
- - ~>
|
60
|
+
- - "~>"
|
61
61
|
- !ruby/object:Gem::Version
|
62
62
|
version: '1.3'
|
63
63
|
type: :development
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
|
-
- - ~>
|
67
|
+
- - "~>"
|
68
68
|
- !ruby/object:Gem::Version
|
69
69
|
version: '1.3'
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: fuubar
|
72
72
|
requirement: !ruby/object:Gem::Requirement
|
73
73
|
requirements:
|
74
|
-
- - ~>
|
74
|
+
- - "~>"
|
75
75
|
- !ruby/object:Gem::Version
|
76
76
|
version: '1.2'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
79
|
version_requirements: !ruby/object:Gem::Requirement
|
80
80
|
requirements:
|
81
|
-
- - ~>
|
81
|
+
- - "~>"
|
82
82
|
- !ruby/object:Gem::Version
|
83
83
|
version: '1.2'
|
84
84
|
- !ruby/object:Gem::Dependency
|
85
85
|
name: rake
|
86
86
|
requirement: !ruby/object:Gem::Requirement
|
87
87
|
requirements:
|
88
|
-
- - ~>
|
88
|
+
- - "~>"
|
89
89
|
- !ruby/object:Gem::Version
|
90
90
|
version: '0'
|
91
91
|
type: :development
|
92
92
|
prerelease: false
|
93
93
|
version_requirements: !ruby/object:Gem::Requirement
|
94
94
|
requirements:
|
95
|
-
- - ~>
|
95
|
+
- - "~>"
|
96
96
|
- !ruby/object:Gem::Version
|
97
97
|
version: '0'
|
98
98
|
- !ruby/object:Gem::Dependency
|
99
99
|
name: growl
|
100
100
|
requirement: !ruby/object:Gem::Requirement
|
101
101
|
requirements:
|
102
|
-
- - ~>
|
102
|
+
- - "~>"
|
103
103
|
- !ruby/object:Gem::Version
|
104
104
|
version: '1.0'
|
105
105
|
type: :development
|
106
106
|
prerelease: false
|
107
107
|
version_requirements: !ruby/object:Gem::Requirement
|
108
108
|
requirements:
|
109
|
-
- - ~>
|
109
|
+
- - "~>"
|
110
110
|
- !ruby/object:Gem::Version
|
111
111
|
version: '1.0'
|
112
112
|
- !ruby/object:Gem::Dependency
|
113
113
|
name: guard-rspec
|
114
114
|
requirement: !ruby/object:Gem::Requirement
|
115
115
|
requirements:
|
116
|
-
- - ~>
|
116
|
+
- - "~>"
|
117
117
|
- !ruby/object:Gem::Version
|
118
118
|
version: '4.0'
|
119
119
|
type: :development
|
120
120
|
prerelease: false
|
121
121
|
version_requirements: !ruby/object:Gem::Requirement
|
122
122
|
requirements:
|
123
|
-
- - ~>
|
123
|
+
- - "~>"
|
124
124
|
- !ruby/object:Gem::Version
|
125
125
|
version: '4.0'
|
126
126
|
- !ruby/object:Gem::Dependency
|
127
127
|
name: rspec
|
128
128
|
requirement: !ruby/object:Gem::Requirement
|
129
129
|
requirements:
|
130
|
-
- - ~>
|
130
|
+
- - "~>"
|
131
131
|
- !ruby/object:Gem::Version
|
132
132
|
version: '2.14'
|
133
133
|
type: :development
|
134
134
|
prerelease: false
|
135
135
|
version_requirements: !ruby/object:Gem::Requirement
|
136
136
|
requirements:
|
137
|
-
- - ~>
|
137
|
+
- - "~>"
|
138
138
|
- !ruby/object:Gem::Version
|
139
139
|
version: '2.14'
|
140
140
|
- !ruby/object:Gem::Dependency
|
141
141
|
name: vcr
|
142
142
|
requirement: !ruby/object:Gem::Requirement
|
143
143
|
requirements:
|
144
|
-
- - ~>
|
144
|
+
- - "~>"
|
145
145
|
- !ruby/object:Gem::Version
|
146
146
|
version: '2.7'
|
147
147
|
type: :development
|
148
148
|
prerelease: false
|
149
149
|
version_requirements: !ruby/object:Gem::Requirement
|
150
150
|
requirements:
|
151
|
-
- - ~>
|
151
|
+
- - "~>"
|
152
152
|
- !ruby/object:Gem::Version
|
153
153
|
version: '2.7'
|
154
154
|
- !ruby/object:Gem::Dependency
|
155
155
|
name: webmock
|
156
156
|
requirement: !ruby/object:Gem::Requirement
|
157
157
|
requirements:
|
158
|
-
- - ~>
|
158
|
+
- - "~>"
|
159
159
|
- !ruby/object:Gem::Version
|
160
160
|
version: '1.16'
|
161
161
|
type: :development
|
162
162
|
prerelease: false
|
163
163
|
version_requirements: !ruby/object:Gem::Requirement
|
164
164
|
requirements:
|
165
|
-
- - ~>
|
165
|
+
- - "~>"
|
166
166
|
- !ruby/object:Gem::Version
|
167
167
|
version: '1.16'
|
168
168
|
description: A Ruby gem for the vzaar API
|
@@ -173,11 +173,11 @@ executables: []
|
|
173
173
|
extensions: []
|
174
174
|
extra_rdoc_files: []
|
175
175
|
files:
|
176
|
-
- .gitignore
|
177
|
-
- .rspec
|
178
|
-
- .ruby-gemset
|
179
|
-
- .ruby-version
|
180
|
-
- .travis.yml
|
176
|
+
- ".gitignore"
|
177
|
+
- ".rspec"
|
178
|
+
- ".ruby-gemset"
|
179
|
+
- ".ruby-version"
|
180
|
+
- ".travis.yml"
|
181
181
|
- Gemfile
|
182
182
|
- Guardfile
|
183
183
|
- LICENSE
|
@@ -193,6 +193,7 @@ files:
|
|
193
193
|
- examples/readme.md
|
194
194
|
- examples/signature_spec.rb
|
195
195
|
- examples/spec_helper.rb
|
196
|
+
- examples/upload_audio_spec.rb
|
196
197
|
- examples/upload_thumbnail_spec.rb
|
197
198
|
- examples/upload_video_spec.rb
|
198
199
|
- examples/user_details_spec.rb
|
@@ -210,6 +211,7 @@ files:
|
|
210
211
|
- lib/vzaar/request/generate_thumbnail.rb
|
211
212
|
- lib/vzaar/request/link_upload.rb
|
212
213
|
- lib/vzaar/request/multipart.rb
|
214
|
+
- lib/vzaar/request/process_audio.rb
|
213
215
|
- lib/vzaar/request/process_video.rb
|
214
216
|
- lib/vzaar/request/signature.rb
|
215
217
|
- lib/vzaar/request/upload_status.rb
|
@@ -274,6 +276,7 @@ files:
|
|
274
276
|
- spec/fixtures/vcr_cassettes/whoami-fail.yml
|
275
277
|
- spec/fixtures/vcr_cassettes/whoami-success.yml
|
276
278
|
- spec/spec_helper.rb
|
279
|
+
- spec/support/burial_short.wav
|
277
280
|
- spec/support/cfx.jpeg
|
278
281
|
- spec/support/cfx.png
|
279
282
|
- spec/support/pic.jpg
|
@@ -299,20 +302,20 @@ require_paths:
|
|
299
302
|
- lib
|
300
303
|
required_ruby_version: !ruby/object:Gem::Requirement
|
301
304
|
requirements:
|
302
|
-
- -
|
305
|
+
- - ">="
|
303
306
|
- !ruby/object:Gem::Version
|
304
307
|
version: '1.9'
|
305
308
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
306
309
|
requirements:
|
307
|
-
- -
|
310
|
+
- - ">="
|
308
311
|
- !ruby/object:Gem::Version
|
309
312
|
version: '0'
|
310
313
|
requirements: []
|
311
314
|
rubyforge_project:
|
312
|
-
rubygems_version: 2.
|
315
|
+
rubygems_version: 2.4.2
|
313
316
|
signing_key:
|
314
317
|
specification_version: 4
|
315
|
-
summary: vzaar-1.
|
318
|
+
summary: vzaar-1.4.1
|
316
319
|
test_files:
|
317
320
|
- spec/fixtures/vcr_cassettes/account_type-fail.yml
|
318
321
|
- spec/fixtures/vcr_cassettes/account_type-success.yml
|
@@ -349,6 +352,7 @@ test_files:
|
|
349
352
|
- spec/fixtures/vcr_cassettes/whoami-fail.yml
|
350
353
|
- spec/fixtures/vcr_cassettes/whoami-success.yml
|
351
354
|
- spec/spec_helper.rb
|
355
|
+
- spec/support/burial_short.wav
|
352
356
|
- spec/support/cfx.jpeg
|
353
357
|
- spec/support/cfx.png
|
354
358
|
- spec/support/pic.jpg
|