active_encode 0.1.0 → 0.1.1

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: 03c144b848e422a6f99d8f102dc0fce7efe3a8aa
4
- data.tar.gz: 7b4617a90685806b2d0fc7434955828bb7ebf0cd
3
+ metadata.gz: b4cc9a23af554f70fe254b6c08dd9422e0799c5e
4
+ data.tar.gz: 7c4ba992d65bd57c36767cbcd386b35a645a0b8c
5
5
  SHA512:
6
- metadata.gz: d3a4a5d7f9b0edc0ea63022fe360c99e70953dc4adfd6cf6419e10c4940db68767a7a5715d5f075da27c4ad1630a6dfbf6fb3054f6c1c6a8d5f9194e7a3bd381
7
- data.tar.gz: e2661ed0ebdd2e3b1eb16e85d63c5e812494fa2c538c944286629fe43b33c145a7d0de825e96b800e754c5d02216e247492e44c857a24c6686f7c62023a70cb3
6
+ metadata.gz: 07f0ac6c7f1f0bd3a794ca21ae31ecacd311dbd2cba15b6e878706fe6c7a11b4c481fd538391d8564b28f4de37bc5d4ff91dd14125f64b642f2b4e166b721d9d
7
+ data.tar.gz: 5fd817093bab2eb625ac4098f256fb4597ac316b8d747fb003e64f7aeafc6faa2f79d74c50c5692bcb611339dc9d605b646286bd3c8bb6fbbe465d9124b850dd
@@ -29,9 +29,6 @@ Metrics/CyclomaticComplexity:
29
29
  Exclude:
30
30
  - 'lib/active_encode/engine_adapters/*'
31
31
 
32
- Style/FileName:
33
- Exclude:
34
-
35
32
  Style/IndentationConsistency:
36
33
  EnforcedStyle: rails
37
34
 
@@ -43,6 +40,10 @@ Style/CollectionMethods:
43
40
  detect: 'find'
44
41
  find_all: 'select'
45
42
 
43
+ Style/FileName: # https://github.com/bbatsov/rubocop/issues/2973
44
+ Exclude:
45
+ - 'Gemfile'
46
+
46
47
  Style/WordArray:
47
48
  Enabled: false
48
49
 
data/Gemfile CHANGED
@@ -3,10 +3,10 @@ source 'https://rubygems.org'
3
3
  # Specify your gem's dependencies in hydra-transcoder.gemspec
4
4
  gemspec
5
5
 
6
+ gem 'aws-sdk'
6
7
  gem 'byebug'
7
8
  gem 'rubocop', require: false
8
9
  gem 'rubocop-rspec', require: false
9
10
  gem 'rubyhorn', git: "https://github.com/avalonmediasystem/rubyhorn.git"
10
- gem 'zencoder'
11
11
  gem 'shingoncoder'
12
- gem 'aws-sdk'
12
+ gem 'zencoder'
@@ -1,4 +1,5 @@
1
1
  # coding: utf-8
2
+
2
3
  lib = File.expand_path('../lib', __FILE__)
3
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
5
  require 'active_encode/version'
@@ -8,8 +9,8 @@ Gem::Specification.new do |spec|
8
9
  spec.version = ActiveEncode::VERSION
9
10
  spec.authors = ["Michael Klein, Chris Colvard"]
10
11
  spec.email = ["mbklein@gmail.com, chris.colvard@gmail.com"]
11
- spec.summary = %q{Declare encode job classes that can be run by a variety of encoding services}
12
- spec.description = %q{This gem serves as the basis for the interface between a Ruby (Rails) application and a provider of transcoding services such as Opencast Matterhorn, Zencoder, and Amazon Elastic Transcoder.}
12
+ spec.summary = 'Declare encode job classes that can be run by a variety of encoding services'
13
+ spec.description = 'This gem serves as the basis for the interface between a Ruby (Rails) application and a provider of transcoding services such as Opencast Matterhorn, Zencoder, and Amazon Elastic Transcoder.'
13
14
  spec.homepage = ""
14
15
  spec.license = "MIT"
15
16
 
@@ -13,4 +13,6 @@ module ActiveEncode #:nodoc:
13
13
  include EngineAdapter
14
14
  include Callbacks
15
15
  end
16
+
17
+ class NotFound < RuntimeError; end
16
18
  end
@@ -30,6 +30,7 @@ module ActiveEncode
30
30
  end
31
31
 
32
32
  def find(id)
33
+ raise ArgumentError, 'id cannot be nil' unless id
33
34
  engine_adapter.find(id, cast: self)
34
35
  end
35
36
 
@@ -38,7 +38,7 @@ module ActiveEncode
38
38
  end
39
39
  end
40
40
 
41
- ENGINE_ADAPTER_METHODS = [:create, :find, :list, :cancel, :purge, :remove_output].freeze
41
+ ENGINE_ADAPTER_METHODS = %i[create find list cancel purge remove_output].freeze
42
42
 
43
43
  def engine_adapter?(object)
44
44
  ENGINE_ADAPTER_METHODS.all? { |meth| object.respond_to?(meth) }
@@ -127,7 +127,7 @@ module ActiveEncode
127
127
  end
128
128
 
129
129
  def convert_tech_metadata(props)
130
- return {} if props.nil? || props.empty?
130
+ return {} if props.blank?
131
131
  metadata_fields = {
132
132
  file_size: { key: :file_size, method: :itself },
133
133
  duration_millis: { key: :duration, method: :to_s },
@@ -291,7 +291,7 @@ module ActiveEncode
291
291
 
292
292
  class MatterhornRtmpUrl
293
293
  class_attribute :members
294
- self.members = [:application, :prefix, :media_id, :stream_id, :filename, :extension]
294
+ self.members = %i[application prefix media_id stream_id filename extension]
295
295
  attr_accessor(*members)
296
296
  REGEX = %r{^
297
297
  /(?<application>.+) # application (avalon)
@@ -103,8 +103,8 @@ module ActiveEncode
103
103
  def convert_errors(job_details)
104
104
  errors = []
105
105
  input_error = job_details.body["job"]["input_media_file"]["error_message"]
106
- errors << input_error unless input_error.blank?
107
- job_details.body["job"]["output_media_files"].each { |o| errors << o["error_message"] unless o["error_message"].blank? }
106
+ errors << input_error if input_error.present?
107
+ job_details.body["job"]["output_media_files"].each { |o| errors << o["error_message"] if o["error_message"].present? }
108
108
  errors
109
109
  end
110
110
 
@@ -1,3 +1,3 @@
1
1
  module ActiveEncode
2
- VERSION = '0.1.0'.freeze
2
+ VERSION = '0.1.1'.freeze
3
3
  end
@@ -0,0 +1,9 @@
1
+ require 'spec_helper'
2
+
3
+ describe ActiveEncode::Core do
4
+ describe 'find' do
5
+ it "raises NotFound when no id is supplied" do
6
+ expect { ActiveEncode::Base.find(nil) }.to raise_error(ArgumentError)
7
+ end
8
+ end
9
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_encode
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Klein, Chris Colvard
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-21 00:00:00.000000000 Z
11
+ date: 2017-06-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -169,6 +169,7 @@ files:
169
169
  - spec/integration/zencoder_adapter_spec.rb
170
170
  - spec/spec_helper.rb
171
171
  - spec/units/callbacks_spec.rb
172
+ - spec/units/core_spec.rb
172
173
  - spec/units/engine_adapter_spec.rb
173
174
  - spec/units/status_spec.rb
174
175
  homepage: ''
@@ -236,5 +237,6 @@ test_files:
236
237
  - spec/integration/zencoder_adapter_spec.rb
237
238
  - spec/spec_helper.rb
238
239
  - spec/units/callbacks_spec.rb
240
+ - spec/units/core_spec.rb
239
241
  - spec/units/engine_adapter_spec.rb
240
242
  - spec/units/status_spec.rb