zencoder-fetcher 0.2.5 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/zencoder_fetcher.rb +9 -8
- metadata +4 -4
data/lib/zencoder_fetcher.rb
CHANGED
@@ -9,7 +9,7 @@ rescue
|
|
9
9
|
end
|
10
10
|
|
11
11
|
module ZencoderFetcher
|
12
|
-
FETCHER_VERSION = [0,2,
|
12
|
+
FETCHER_VERSION = [0,2,6] unless defined?(FETCHER_VERSION)
|
13
13
|
|
14
14
|
def self.version
|
15
15
|
FETCHER_VERSION.join(".")
|
@@ -19,7 +19,8 @@ module ZencoderFetcher
|
|
19
19
|
query = {
|
20
20
|
"api_key" => options[:api_key],
|
21
21
|
"per_page" => options[:count] || 50,
|
22
|
-
"page" => options[:page] || 1
|
22
|
+
"page" => options[:page] || 1,
|
23
|
+
"version" => "latest"
|
23
24
|
}
|
24
25
|
query["since"] = options[:since].iso8601 if options[:since]
|
25
26
|
query = query.map{|k,v| "#{k}=#{v}" }.join("&")
|
@@ -30,14 +31,14 @@ module ZencoderFetcher
|
|
30
31
|
response = HTTParty.get("https://#{options[:endpoint] || 'app'}.zencoder.com/api/v1/notifications.json?#{query}",
|
31
32
|
:headers => { "HTTP_X_FETCHER_VERSION" => version })
|
32
33
|
|
33
|
-
if
|
34
|
+
if response["errors"]
|
34
35
|
puts "There was an error fetching notifications:"
|
35
36
|
puts response.body.to_s
|
36
|
-
raise
|
37
|
+
raise
|
37
38
|
else
|
38
|
-
puts "Notifications retrieved: #{response.size}"
|
39
|
-
puts "Posting to #{local_url}" if response.size > 0
|
40
|
-
response.each do |notification|
|
39
|
+
puts "Notifications retrieved: #{response["notifications"].size}"
|
40
|
+
puts "Posting to #{local_url}" if response["notifications"].size > 0
|
41
|
+
response["notifications"].each do |notification|
|
41
42
|
begin
|
42
43
|
format = notification.delete("format")
|
43
44
|
if format == "xml"
|
@@ -53,7 +54,7 @@ module ZencoderFetcher
|
|
53
54
|
raise FetcherLocalConnectionError
|
54
55
|
end
|
55
56
|
end
|
56
|
-
puts "Finished Posting" if response.size > 0
|
57
|
+
puts "Finished Posting" if response["notifications"].size > 0
|
57
58
|
puts
|
58
59
|
|
59
60
|
Time.parse(response["sent_at"].to_s)
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zencoder-fetcher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 6
|
10
|
+
version: 0.2.6
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Chris Warren
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2011-10-
|
19
|
+
date: 2011-10-04 00:00:00 Z
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
22
|
name: trollop
|