wes-data-api 8.1.0 → 9.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/wes/data/api.rb +1 -1
- data/lib/wes/data/api/model/video.rb +49 -8
- data/lib/wes/data/api/model/video_version.rb +20 -0
- data/lib/wes/data/api/routes.rb +1 -0
- data/lib/wes/data/api/video_transcoding_state.rb +8 -6
- data/lib/wes/data/api/video_version.rb +39 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: de5ad3766b808f03e5c9b09412fb919db6b4e8aa
|
4
|
+
data.tar.gz: 2d8de2f18b25de0994efc30934939770b7cb49c3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 79c77cbe0becf15e2ffb232e1ccacf82af2c64ea56c711403b93f1e06cc44f2171ebdc1188355ed18b3ff1aa81ea2a17f401fc47ca3c0d0eb2f578b2345e8019
|
7
|
+
data.tar.gz: 050640bb1d5b1b6f7a703a36c90cc968b34a703f0056261aafd4c984e9c185a6710b423257481678af2ae3cc6591253c9efec7988abbc3019a6b6cdd7633e824
|
data/lib/wes/data/api.rb
CHANGED
@@ -2,6 +2,8 @@ require "wes/data/api/model/base"
|
|
2
2
|
require "wes/data/api/model/creator_user"
|
3
3
|
require "wes/data/api/video_transcoding_state"
|
4
4
|
require "wes/data/api/model/submission"
|
5
|
+
require "wes/data/api/model/video_version"
|
6
|
+
require "wes/data/api/submission"
|
5
7
|
|
6
8
|
module Wes
|
7
9
|
module Data
|
@@ -33,22 +35,61 @@ module Wes
|
|
33
35
|
end
|
34
36
|
|
35
37
|
def submission(fetch: false)
|
36
|
-
|
37
|
-
|
38
|
+
if fetch
|
39
|
+
fetch_submission
|
40
|
+
else
|
41
|
+
es::Data::API::Model::Submission.new(
|
42
|
+
@attributes.submission.first
|
43
|
+
)
|
44
|
+
end
|
38
45
|
end
|
39
46
|
|
40
|
-
def
|
47
|
+
def current_version(fetch: false)
|
48
|
+
if fetch
|
49
|
+
fetch_current_version
|
50
|
+
else
|
51
|
+
Wes::Data::API::Model::VideoVersion.new(
|
52
|
+
@attributes.current_version.first
|
53
|
+
)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def transcoding_state(type, fetch = false)
|
58
|
+
if fetch
|
59
|
+
fetch_transcoding_state(type)
|
60
|
+
else
|
61
|
+
Wes::Data::API::Model::VideoTranscodingState.new(
|
62
|
+
find_transcoding_state(type)
|
63
|
+
)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
private
|
68
|
+
|
69
|
+
def fetch_current_version
|
70
|
+
Wes::Data::API::VideoVersion.current(id)
|
71
|
+
end
|
72
|
+
|
73
|
+
def fetch_submission
|
74
|
+
Wes::Data::API::Submission.find(
|
75
|
+
:id,
|
76
|
+
@attributes.submission_id
|
77
|
+
)
|
78
|
+
end
|
79
|
+
|
80
|
+
def fetch_transcoding_state(type)
|
81
|
+
return nil unless current_version
|
41
82
|
Wes::Data::API::VideoTranscodingState.find(
|
42
83
|
id,
|
84
|
+
current_version.id,
|
43
85
|
type
|
44
86
|
)
|
45
87
|
end
|
46
88
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
client.get(route).first
|
89
|
+
def find_transcoding_state(type)
|
90
|
+
@attributes.transcoding_states.find do |state|
|
91
|
+
state["type"] == type
|
92
|
+
end
|
52
93
|
end
|
53
94
|
end
|
54
95
|
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require "wes/data/api/model/base"
|
2
|
+
|
3
|
+
module Wes
|
4
|
+
module Data
|
5
|
+
module API
|
6
|
+
module Model
|
7
|
+
class VideoVersion < Base
|
8
|
+
def update(changes)
|
9
|
+
route = [routes.video, @attributes.video_id, routes.version, id].join("/")
|
10
|
+
@attributes = client.put(
|
11
|
+
route, @attributes.to_h.merge(changes)
|
12
|
+
).first
|
13
|
+
|
14
|
+
self
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/lib/wes/data/api/routes.rb
CHANGED
@@ -8,19 +8,21 @@ module Wes
|
|
8
8
|
class << self
|
9
9
|
include Base
|
10
10
|
|
11
|
-
def find(video_id, type)
|
12
|
-
attributes = data(video_id, type).first
|
11
|
+
def find(video_id, video_version_id, type)
|
12
|
+
attributes = data(video_id, video_version_id, type).first
|
13
13
|
attributes.nil? ? nil : model_klass.new(attributes)
|
14
14
|
end
|
15
15
|
|
16
16
|
private
|
17
17
|
|
18
|
-
def data(video_id, type)
|
19
|
-
client.get(
|
18
|
+
def data(video_id, video_version_id, type)
|
19
|
+
client.get(
|
20
|
+
format("%s?type=%s", route(video_id, video_version_id), type)
|
21
|
+
)
|
20
22
|
end
|
21
23
|
|
22
|
-
def route(video_id,
|
23
|
-
[routes.video, video_id, routes.
|
24
|
+
def route(video_id, video_version_id)
|
25
|
+
[routes.video, video_id, routes.version, video_version_id, routes.transcoding_state].join("/")
|
24
26
|
end
|
25
27
|
|
26
28
|
def model_klass
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require "wes/data/api/base"
|
2
|
+
require "wes/data/api/model/video"
|
3
|
+
|
4
|
+
module Wes
|
5
|
+
module Data
|
6
|
+
module API
|
7
|
+
class VideoVersion
|
8
|
+
class << self
|
9
|
+
include Base
|
10
|
+
|
11
|
+
def create(video_id, options)
|
12
|
+
attributes = client.post(route(video_id), options).first
|
13
|
+
attributes.nil? ? nil : model_klass.new(attributes)
|
14
|
+
end
|
15
|
+
|
16
|
+
def find(video_id, key)
|
17
|
+
route = format("%s/%s", route(video_id), key)
|
18
|
+
attributes = client.get(route).first
|
19
|
+
attributes.nil? ? nil : model_klass.new(attributes)
|
20
|
+
end
|
21
|
+
|
22
|
+
def current(video_id)
|
23
|
+
find(video_id, "latest")
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def route(video_id)
|
29
|
+
[routes.video, video_id, routes.version].join("/")
|
30
|
+
end
|
31
|
+
|
32
|
+
def model_klass
|
33
|
+
Wes::Data::API::Model::VideoVersion
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wes-data-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 9.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ''
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-06-
|
11
|
+
date: 2016-06-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -139,6 +139,7 @@ files:
|
|
139
139
|
- lib/wes/data/api/model/submission.rb
|
140
140
|
- lib/wes/data/api/model/video.rb
|
141
141
|
- lib/wes/data/api/model/video_transcoding_state.rb
|
142
|
+
- lib/wes/data/api/model/video_version.rb
|
142
143
|
- lib/wes/data/api/request.rb
|
143
144
|
- lib/wes/data/api/response.rb
|
144
145
|
- lib/wes/data/api/reward.rb
|
@@ -146,6 +147,7 @@ files:
|
|
146
147
|
- lib/wes/data/api/submission.rb
|
147
148
|
- lib/wes/data/api/video.rb
|
148
149
|
- lib/wes/data/api/video_transcoding_state.rb
|
150
|
+
- lib/wes/data/api/video_version.rb
|
149
151
|
- wes-data-api.gemspec
|
150
152
|
homepage: ''
|
151
153
|
licenses: []
|