heywatch 2.0.0 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/heywatch.rb +49 -3
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 25ddd794786a4e972daf5f1f78cc520d6124c75f
|
4
|
+
data.tar.gz: 4a1eaab70903801ffbc7f21578a693a258610843
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3acd3d5bb3b16f3c83ff5386c67650cd5037131f30f15ffd473596d214c26b8bf4729b8037b5b8d603a364c191ecef336f349b9976b5a88d11d7d52be1c760e8
|
7
|
+
data.tar.gz: 57400eff5d2f762f95d422296d11beec793003b0a93e7c0ccf5a9160523c098faaf6360b070ffd9e28094a7d639a022fae5f27c76ce653d5636f15767b019895
|
data/lib/heywatch.rb
CHANGED
@@ -6,11 +6,12 @@ module HeyWatch
|
|
6
6
|
class Error < RuntimeError; end
|
7
7
|
|
8
8
|
HEYWATCH_URL = ENV["HEYWATCH_URL"] || "https://heywatch.com"
|
9
|
-
USER_AGENT = "HeyWatch/2.
|
9
|
+
USER_AGENT = "HeyWatch/2.2.0 (Ruby)"
|
10
10
|
|
11
|
-
|
12
|
-
api_key ||= ENV["HEYWATCH_API_KEY"]
|
11
|
+
API_KEY = ENV["HEYWATCH_API_KEY"] unless const_defined?(:HEYWATCH_API_KEY)
|
13
12
|
|
13
|
+
def self.submit(config_content, api_key=nil)
|
14
|
+
api_key ||= API_KEY
|
14
15
|
uri = URI("#{HEYWATCH_URL}/api/v1/job")
|
15
16
|
headers = {"User-Agent" => USER_AGENT, "Content-Type" => "text/plain", "Accept" => "application/json"}
|
16
17
|
|
@@ -33,4 +34,49 @@ module HeyWatch
|
|
33
34
|
return result
|
34
35
|
end
|
35
36
|
end
|
37
|
+
|
38
|
+
def self.config(options={})
|
39
|
+
if conf_file = options[:conf]
|
40
|
+
raise Error, "Config file `#{conf_file}' not found" if ! File.exists?(conf_file)
|
41
|
+
conf = File.read(conf_file).strip.split("\n")
|
42
|
+
else
|
43
|
+
conf = []
|
44
|
+
end
|
45
|
+
|
46
|
+
if vars = options[:vars]
|
47
|
+
vars.each do |name,value|
|
48
|
+
conf << "var #{name} = #{value}"
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
if source = options[:source]
|
53
|
+
conf << "set source = #{source}"
|
54
|
+
end
|
55
|
+
|
56
|
+
if webhook = options[:webhook]
|
57
|
+
conf << "set webhook = #{webhook}"
|
58
|
+
end
|
59
|
+
|
60
|
+
if outputs = options[:outputs]
|
61
|
+
outputs.each do |format, cdn|
|
62
|
+
conf << "-> #{format} = #{cdn}"
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
new_conf = []
|
67
|
+
|
68
|
+
new_conf.concat conf.select{|l| l.start_with?("var")}.sort
|
69
|
+
new_conf << ""
|
70
|
+
new_conf.concat conf.select{|l| l.start_with?("set")}.sort
|
71
|
+
new_conf << ""
|
72
|
+
new_conf.concat conf.select{|l| l.start_with?("->")}.sort
|
73
|
+
|
74
|
+
return new_conf.join("\n")
|
75
|
+
end
|
76
|
+
|
77
|
+
class Job
|
78
|
+
def self.create(options={})
|
79
|
+
HeyWatch.submit(HeyWatch.config(options), options[:api_key])
|
80
|
+
end
|
81
|
+
end
|
36
82
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: heywatch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bruno Celeste
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-10-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multi_json
|
@@ -51,7 +51,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
51
51
|
version: '0'
|
52
52
|
requirements: []
|
53
53
|
rubyforge_project:
|
54
|
-
rubygems_version: 2.
|
54
|
+
rubygems_version: 2.4.3
|
55
55
|
signing_key:
|
56
56
|
specification_version: 4
|
57
57
|
summary: Client library to transcode videos with heywatch
|