wes-data-api 5.5.0 → 5.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 40810ee00b791376c6280505b3acf8485e7d4629
4
- data.tar.gz: 63b74d7d0f071cd04f2a761b4c1e530872d04102
3
+ metadata.gz: 1237c0bc989faa7594f124be26c50d83c2cb3d8c
4
+ data.tar.gz: 7822b30ed72f13bfb1b6325d5d231e7251288a4c
5
5
  SHA512:
6
- metadata.gz: 70e0ad5c5071d1b6e36b46f739eb313d8e5eada0781970ec56d8e76d8ba768bd538214e82fc8a0456ec6e07eb705b9048294ea3c9e08c57e1b798630d6108d48
7
- data.tar.gz: 332c28b217286178d87f7787574b6146899f50dc219b3c74c5b86f3f79924b910d9d0a67a99bd706bb467cf8682d344f91562fcaa3990ad779670b7381e3b2b5
6
+ metadata.gz: 7ed0209489e5184115a86e7720a76cb9c6ae3e0936e30e3f901091975cf2c0a42835132c2df96a46bf3b1c9800439a58e948b9dfc609f092109cb76752bc9127
7
+ data.tar.gz: d8fabd52644beebdf5fabd386cc147acda63ae769b3b07c4116ed1b9d0edf8ebbb2d834664f563fe917cdf34325532ee95143a2894f2d2bb07aa2423efda3a0a
@@ -1,5 +1,6 @@
1
1
  require "wes/data/api/model/base"
2
2
  require "wes/data/api/model/creator_user"
3
+ require "wes/data/api/model/video_transcoding_state"
3
4
 
4
5
  module Wes
5
6
  module Data
@@ -13,38 +14,12 @@ module Wes
13
14
  : Wes::Data::API::Model::CreatorUser.new(attributes)
14
15
  end
15
16
 
16
- def gif
17
- @gif_state ||= video_state("gif", ".gif")
18
- end
19
-
20
17
  def set_caption(edit)
21
18
  update(:caption => edit)
22
19
  end
23
20
 
24
- def thumbnail
25
- @thumbnail_state ||= video_state("gif", "_00001.png")
26
- end
27
-
28
- def web_format
29
- @web_state ||= video_state("mp4", ".mp4")
30
- end
31
-
32
- private
33
-
34
- def filename_hash
35
- file_name.split(".").first
36
- end
37
-
38
- def filename_suffix
39
- configuration.transcoded_video_filename_suffix
40
- end
41
-
42
- def generate_filename(suffix)
43
- "#{filename_hash}/#{filename_suffix}#{suffix}"
44
- end
45
-
46
21
  def update(changes)
47
- route = [routes.billing, id].join("/")
22
+ route = [routes.video, id].join("/")
48
23
  @attributes = client.put(
49
24
  route, @attributes.to_h.merge(changes)
50
25
  ).first
@@ -52,14 +27,11 @@ module Wes
52
27
  self
53
28
  end
54
29
 
55
- def video_state(type, suffix)
56
- route = [routes.video, id, "state", type].join("/")
57
- video_state = client.get(route).first
58
- video_transcoded?(video_state) ? generate_filename(suffix) : nil
59
- end
60
-
61
- def video_transcoded?(video_state)
62
- video_state && video_state.state == "complete"
30
+ def transcoding_state(type)
31
+ Wes::Data::API::VideoTranscodingState.find(
32
+ id,
33
+ type
34
+ )
63
35
  end
64
36
  end
65
37
  end
@@ -0,0 +1,12 @@
1
+ require "wes/data/api/model/base"
2
+
3
+ module Wes
4
+ module Data
5
+ module API
6
+ module Model
7
+ class VideoTranscodingState < Base
8
+ end
9
+ end
10
+ end
11
+ end
12
+ end
@@ -5,21 +5,22 @@ module Wes
5
5
  class << self
6
6
  def hash
7
7
  OpenStruct.new(
8
- :billing => "billing",
9
- :brand => "brand",
10
- :brand_user => "brand-user",
11
- :brands => "brands",
12
- :challenge => "challenge",
13
- :challenges => "challenges",
14
- :collectives => "collectives",
15
- :creator_user => "creator-user",
16
- :creator_users => "creator-users",
17
- :rewards => "rewards",
18
- :reward => "reward",
19
- :submission => "submission",
20
- :submissions => "submissions",
21
- :video => "video",
22
- :videos => "videos"
8
+ :billing => "billing",
9
+ :brand => "brand",
10
+ :brand_user => "brand-user",
11
+ :brands => "brands",
12
+ :challenge => "challenge",
13
+ :challenges => "challenges",
14
+ :collectives => "collectives",
15
+ :creator_user => "creator-user",
16
+ :creator_users => "creator-users",
17
+ :rewards => "rewards",
18
+ :reward => "reward",
19
+ :submission => "submission",
20
+ :submissions => "submissions",
21
+ :video => "video",
22
+ :videos => "videos",
23
+ :transcoding_state => "transcoding-state"
23
24
  )
24
25
  end
25
26
  end
@@ -0,0 +1,33 @@
1
+ require "wes/data/api/base"
2
+ require "wes/data/api/model/video_transcoding_state"
3
+
4
+ module Wes
5
+ module Data
6
+ module API
7
+ class VideoTranscodingState
8
+ class << self
9
+ include Base
10
+
11
+ def find(video_id, type)
12
+ attributes = data(video_id, type).first
13
+ attributes.nil? ? nil : model_klass.new(attributes)
14
+ end
15
+
16
+ private
17
+
18
+ def data(video_id, type)
19
+ client.get(route(video_id, type))
20
+ end
21
+
22
+ def route(video_id, type)
23
+ [routes.video, video_id, routes.transcoding_state, type].join("/")
24
+ end
25
+
26
+ def model_klass
27
+ Wes::Data::API::Model::VideoTranscodingState
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
data/lib/wes/data/api.rb CHANGED
@@ -5,7 +5,7 @@ require "wes/data/api/configuration"
5
5
  module Wes
6
6
  module Data
7
7
  module API
8
- VERSION = "5.5.0".freeze
8
+ VERSION = "5.6.0".freeze
9
9
  end
10
10
  end
11
11
  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: 5.5.0
4
+ version: 5.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ''
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-05-12 00:00:00.000000000 Z
11
+ date: 2016-05-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -138,12 +138,14 @@ files:
138
138
  - lib/wes/data/api/model/reward.rb
139
139
  - lib/wes/data/api/model/submission.rb
140
140
  - lib/wes/data/api/model/video.rb
141
+ - lib/wes/data/api/model/video_transcoding_state.rb
141
142
  - lib/wes/data/api/request.rb
142
143
  - lib/wes/data/api/response.rb
143
144
  - lib/wes/data/api/reward.rb
144
145
  - lib/wes/data/api/routes.rb
145
146
  - lib/wes/data/api/submission.rb
146
147
  - lib/wes/data/api/video.rb
148
+ - lib/wes/data/api/video_transcoding_state.rb
147
149
  - wes-data-api.gemspec
148
150
  homepage: ''
149
151
  licenses: []