woody-decorators 0.4.0 → 0.5.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7e0d1b245b41bb96229c4a58b97d51282548d08d
4
- data.tar.gz: 224d34d9e10c959c6850b213c5ebfde25b57af57
3
+ metadata.gz: 627b8c37e6d7b5cceb180ea1a0fab50ba2c639f8
4
+ data.tar.gz: 1aeebb11bf40e6bdc9184508a329aca83ea22825
5
5
  SHA512:
6
- metadata.gz: 0bf7d1196cddbfc82a300202605cfb2d1735a563bd5ce28478d3e4f884d31490c3ae4db405ca4d3ec0bcae5d7223cabaf26763a12eada5563f7e4c569b7b0941
7
- data.tar.gz: d674eed415e2d3c95f9e0d919a785d5a0f8fdcc8cf58877c739085708cde811ab02726b140d4d45db6ed253cd7619108f209f1a57f5e02f75678171624ae5cfe
6
+ metadata.gz: 3ab23e6acfdf8391307dc79851d221aa1120ee487521a84410a13d98a5ae5b0fbb397ac6628b0736abf07fe884ac781580afd4a7da7808aec3a668efcee34265
7
+ data.tar.gz: 6dc9d86063afaac44ea8780259496c812b1cdfb5b27448a96aee64496df0f020cf1ab23fa99e4b26eb97b5ce1aac87b80a744c6656d13e2123398d7ae7519458
@@ -1,5 +1,5 @@
1
1
  module Woody
2
2
  module Decorators
3
- VERSION = "0.4.0".freeze
3
+ VERSION = "0.5.0".freeze
4
4
  end
5
5
  end
@@ -0,0 +1,49 @@
1
+ require "woody/decorators/base"
2
+
3
+ module Woody
4
+ module Decorators
5
+ class VideoTranscodingState < Base
6
+ def initialize(model, config)
7
+ @config = config
8
+ super(model)
9
+ end
10
+
11
+ def complete?
12
+ @model.state == "complete"
13
+ end
14
+
15
+ def path(filename, render_type = nil, default = "")
16
+ type = render_type ? render_type : attributes.type
17
+ suffix = format_suffix(type)
18
+ complete? ? [s3_base, filename, suffix].join("/") : default
19
+ end
20
+
21
+ private
22
+
23
+ def aws_config
24
+ @aws_config ||= @config.aws
25
+ end
26
+
27
+ def etc_config
28
+ @etc_config ||= @config.elastic_transcoder
29
+ end
30
+
31
+ def format_suffix(type)
32
+ case type
33
+ when "gif", "mp4"
34
+ "#{etc_config['output_suffix']}.#{type}"
35
+ when "thumbnail"
36
+ "#{etc_config['output_suffix']}_00001.png"
37
+ end
38
+ end
39
+
40
+ def s3_base
41
+ [
42
+ aws_config["base_s3_path"],
43
+ aws_config["s3_bucket"],
44
+ etc_config["base_prefix"]
45
+ ].join("/")
46
+ end
47
+ end
48
+ end
49
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: woody-decorators
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ''
@@ -121,6 +121,7 @@ files:
121
121
  - lib/woody/decorators/brand.rb
122
122
  - lib/woody/decorators/challenge.rb
123
123
  - lib/woody/decorators/creator_user.rb
124
+ - lib/woody/decorators/video_transcoding_state.rb
124
125
  - woody-decorators.gemspec
125
126
  homepage: ''
126
127
  licenses: []