zencoder-fetcher 0.2.4 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/zencoder_fetcher.rb +8 -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,5] unless defined?(FETCHER_VERSION)
|
13
13
|
|
14
14
|
def self.version
|
15
15
|
FETCHER_VERSION.join(".")
|
@@ -27,17 +27,17 @@ module ZencoderFetcher
|
|
27
27
|
local_url = options[:url] || "http://localhost:3000/"
|
28
28
|
auth = local_url.match(/^https?:\/\/([^\/]+):([^\/]+)@/) ? {:username=>$1, :password=>$2} : {}
|
29
29
|
|
30
|
-
response = HTTParty.get("https://#{options[:endpoint] || 'app'}.zencoder.com/api/notifications.json?#{query}",
|
30
|
+
response = HTTParty.get("https://#{options[:endpoint] || 'app'}.zencoder.com/api/v1/notifications.json?#{query}",
|
31
31
|
:headers => { "HTTP_X_FETCHER_VERSION" => version })
|
32
32
|
|
33
|
-
if response[
|
33
|
+
if !response[0]
|
34
34
|
puts "There was an error fetching notifications:"
|
35
35
|
puts response.body.to_s
|
36
|
-
raise
|
36
|
+
raise FetcherError
|
37
37
|
else
|
38
|
-
puts "Notifications retrieved: #{response
|
39
|
-
puts "Posting to #{local_url}" if response
|
40
|
-
response
|
38
|
+
puts "Notifications retrieved: #{response.size}"
|
39
|
+
puts "Posting to #{local_url}" if response.size > 0
|
40
|
+
response.each do |notification|
|
41
41
|
begin
|
42
42
|
format = notification.delete("format")
|
43
43
|
if format == "xml"
|
@@ -53,7 +53,7 @@ module ZencoderFetcher
|
|
53
53
|
raise FetcherLocalConnectionError
|
54
54
|
end
|
55
55
|
end
|
56
|
-
puts "Finished Posting" if response
|
56
|
+
puts "Finished Posting" if response.size > 0
|
57
57
|
puts
|
58
58
|
|
59
59
|
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: 29
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 5
|
10
|
+
version: 0.2.5
|
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-
|
19
|
+
date: 2011-10-03 00:00:00 Z
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
22
|
name: trollop
|