tryphon-pige-client 1.0.1 → 1.0.2

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.
@@ -51,7 +51,9 @@ ChunkScheduler.define do |schedule|
51
51
  schedule.on(:sunday) do
52
52
  # ...
53
53
  end
54
- end.download("/tmp")
54
+ end.download("/tmp").each do |file|
55
+ system "ecanormalize", file
56
+ end
55
57
 
56
58
  # Remove oldest Chunks
57
59
  #Pige::Client::Chunk.destroy_all(:older_than => 1.days.ago)
@@ -26,6 +26,7 @@ module Pige::Client
26
26
  IO.copy_stream url, file
27
27
  end
28
28
  end
29
+ download_file
29
30
  end
30
31
  end
31
32
  end
@@ -33,7 +33,7 @@ module Pige::Client
33
33
  wait
34
34
 
35
35
  FileUtils.mkdir_p target
36
- chunks.each do |chunk|
36
+ chunks.map do |chunk|
37
37
  puts "Download '#{chunk.title}' to #{target}/#{chunk.download_file} ..."
38
38
  chunk.download target
39
39
  end
@@ -41,7 +41,7 @@ module Pige::Client
41
41
  additionnal_query = "&#{additionnal_query}" unless additionnal_query.empty?
42
42
 
43
43
  get("#{Pige::Client.box_url}/sources/1/labels.json?page=#{number}#{additionnal_query}").map do |attributes|
44
- Label.new attributes["label"]
44
+ Label.new attributes
45
45
  end
46
46
  end
47
47
 
@@ -55,7 +55,7 @@ module Pige::Client
55
55
 
56
56
  def self.all
57
57
  get("#{Pige::Client.box_url}/sources/1/#{resources_name}.json").map do |attributes|
58
- new attributes[resource_name]
58
+ new attributes
59
59
  end
60
60
  end
61
61
 
@@ -1,5 +1,5 @@
1
1
  module Pige
2
2
  module Client
3
- VERSION = "1.0.1"
3
+ VERSION = "1.0.2"
4
4
  end
5
5
  end
@@ -1 +1 @@
1
- [{"chunk":{"updated_at":"2012-12-04T09:33:40+01:00","id":64,"format":"wav","end":"2012-12-03T18:00:00+01:00","created_at":"2012-12-04T09:33:40+01:00","source_id":1,"title":"Emission Cinema lundi 03_12_2012","begin":"2012-12-03T17:00:00+01:00","completion_rate":null}},{"chunk":{"updated_at":"2012-12-04T09:07:35+01:00","id":63,"format":"wav","end":"2012-12-04T09:02:28+01:00","created_at":"2012-12-04T09:07:35+01:00","source_id":1,"title":"Test 1","begin":"2012-12-04T08:07:28+01:00","completion_rate":null}},{"chunk":{"updated_at":"2012-06-08T09:57:23+02:00","id":62,"format":"wav","end":"2012-06-08T09:55:00+02:00","created_at":"2012-06-08T09:57:20+02:00","source_id":1,"title":"Chunk 08 juin 2012 09:00","begin":"2012-06-08T09:00:00+02:00","completion_rate":1.0}},{"chunk":{"updated_at":"2011-10-27T06:16:37+02:00","id":60,"format":"wav","end":"2011-10-27T05:15:00+02:00","created_at":"2011-10-27T06:15:57+02:00","source_id":1,"title":"Chunk 27 octobre 2011 05:00","begin":"2011-10-27T05:00:00+02:00","completion_rate":1.0}}]
1
+ [{"updated_at":"2012-12-04T09:33:40+01:00","id":64,"format":"wav","end":"2012-12-03T18:00:00+01:00","created_at":"2012-12-04T09:33:40+01:00","source_id":1,"title":"Emission Cinema lundi 03_12_2012","begin":"2012-12-03T17:00:00+01:00","completion_rate":null},{"updated_at":"2012-12-04T09:07:35+01:00","id":63,"format":"wav","end":"2012-12-04T09:02:28+01:00","created_at":"2012-12-04T09:07:35+01:00","source_id":1,"title":"Test 1","begin":"2012-12-04T08:07:28+01:00","completion_rate":null},{"updated_at":"2012-06-08T09:57:23+02:00","id":62,"format":"wav","end":"2012-06-08T09:55:00+02:00","created_at":"2012-06-08T09:57:20+02:00","source_id":1,"title":"Chunk 08 juin 2012 09:00","begin":"2012-06-08T09:00:00+02:00","completion_rate":1.0},{"updated_at":"2011-10-27T06:16:37+02:00","id":60,"format":"wav","end":"2011-10-27T05:15:00+02:00","created_at":"2011-10-27T06:15:57+02:00","source_id":1,"title":"Chunk 27 octobre 2011 05:00","begin":"2011-10-27T05:00:00+02:00","completion_rate":1.0}]
@@ -1 +1 @@
1
- [{"label":{"updated_at":"2011-05-26T12:14:06+02:00","source_id":1,"id":51,"name":"Test","timestamp":"2011-05-26T12:14:02+02:00","created_at":"2011-05-26T12:14:06+02:00"}},{"label":{"updated_at":"2011-05-26T11:55:25+02:00","source_id":1,"id":50,"name":"Test","timestamp":"2011-05-26T11:55:21+02:00","created_at":"2011-05-26T11:55:25+02:00"}},{"label":{"updated_at":"2011-03-04T22:16:10+01:00","source_id":1,"id":49,"name":"test","timestamp":"2011-03-04T22:16:10+01:00","created_at":"2011-03-04T22:16:10+01:00"}},{"label":{"updated_at":"2011-03-04T22:14:41+01:00","source_id":1,"id":48,"name":"test","timestamp":"2011-03-04T22:14:41+01:00","created_at":"2011-03-04T22:14:41+01:00"}},{"label":{"updated_at":"2011-03-04T22:13:33+01:00","source_id":1,"id":47,"name":"test","timestamp":"2011-03-04T22:13:33+01:00","created_at":"2011-03-04T22:13:33+01:00"}},{"label":{"updated_at":"2011-03-04T22:12:45+01:00","source_id":1,"id":46,"name":"test","timestamp":"2011-03-04T22:12:45+01:00","created_at":"2011-03-04T22:12:45+01:00"}},{"label":{"updated_at":"2011-03-04T22:09:37+01:00","source_id":1,"id":45,"name":"test","timestamp":"2011-03-04T22:09:37+01:00","created_at":"2011-03-04T22:09:37+01:00"}},{"label":{"updated_at":"2011-03-04T22:09:34+01:00","source_id":1,"id":44,"name":"test","timestamp":"2011-03-04T22:09:34+01:00","created_at":"2011-03-04T22:09:34+01:00"}},{"label":{"updated_at":"2011-03-04T22:09:32+01:00","source_id":1,"id":43,"name":"test","timestamp":"2011-03-04T22:09:32+01:00","created_at":"2011-03-04T22:09:32+01:00"}},{"label":{"updated_at":"2011-03-04T21:11:29+01:00","source_id":1,"id":42,"name":"test","timestamp":"2011-03-04T21:11:29+01:00","created_at":"2011-03-04T21:11:29+01:00"}}]
1
+ [{"updated_at":"2011-05-26T12:14:06+02:00","source_id":1,"id":51,"name":"Test","timestamp":"2011-05-26T12:14:02+02:00","created_at":"2011-05-26T12:14:06+02:00"},{"updated_at":"2011-05-26T11:55:25+02:00","source_id":1,"id":50,"name":"Test","timestamp":"2011-05-26T11:55:21+02:00","created_at":"2011-05-26T11:55:25+02:00"},{"updated_at":"2011-03-04T22:16:10+01:00","source_id":1,"id":49,"name":"test","timestamp":"2011-03-04T22:16:10+01:00","created_at":"2011-03-04T22:16:10+01:00"},{"updated_at":"2011-03-04T22:14:41+01:00","source_id":1,"id":48,"name":"test","timestamp":"2011-03-04T22:14:41+01:00","created_at":"2011-03-04T22:14:41+01:00"},{"updated_at":"2011-03-04T22:13:33+01:00","source_id":1,"id":47,"name":"test","timestamp":"2011-03-04T22:13:33+01:00","created_at":"2011-03-04T22:13:33+01:00"},{"updated_at":"2011-03-04T22:12:45+01:00","source_id":1,"id":46,"name":"test","timestamp":"2011-03-04T22:12:45+01:00","created_at":"2011-03-04T22:12:45+01:00"},{"updated_at":"2011-03-04T22:09:37+01:00","source_id":1,"id":45,"name":"test","timestamp":"2011-03-04T22:09:37+01:00","created_at":"2011-03-04T22:09:37+01:00"},{"updated_at":"2011-03-04T22:09:34+01:00","source_id":1,"id":44,"name":"test","timestamp":"2011-03-04T22:09:34+01:00","created_at":"2011-03-04T22:09:34+01:00"},{"updated_at":"2011-03-04T22:09:32+01:00","source_id":1,"id":43,"name":"test","timestamp":"2011-03-04T22:09:32+01:00","created_at":"2011-03-04T22:09:32+01:00"},{"updated_at":"2011-03-04T21:11:29+01:00","source_id":1,"id":42,"name":"test","timestamp":"2011-03-04T21:11:29+01:00","created_at":"2011-03-04T21:11:29+01:00"}]
@@ -1,4 +1,5 @@
1
1
  require 'spec_helper'
2
+ require 'tmpdir'
2
3
 
3
4
  describe ChunkScheduler do
4
5
 
@@ -96,4 +97,30 @@ describe ChunkScheduler do
96
97
 
97
98
  end
98
99
 
100
+ describe '#download' do
101
+
102
+ let(:test_directory) { Dir.mktmpdir }
103
+ after { FileUtils.remove_entry test_directory }
104
+
105
+ let(:target) { File.join test_directory, 'target' }
106
+
107
+ it 'should create the specified target' do
108
+ subject.download target
109
+ Dir.exists?(target).should be_true
110
+ end
111
+
112
+ it 'should return chunck download files' do
113
+ subject.stub :wait
114
+
115
+ files = ['file1', 'file2']
116
+
117
+ files.each do |file|
118
+ subject.chunks << mock(download: file, title: "dummy", download_file: file)
119
+ end
120
+
121
+ subject.download(target).should == files
122
+ end
123
+
124
+ end
125
+
99
126
  end
@@ -4,25 +4,25 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
  require 'pige/client/version'
5
5
 
6
6
  Gem::Specification.new do |gem|
7
- gem.name = "tryphon-pige-client"
7
+ gem.name = 'tryphon-pige-client'
8
8
  gem.version = Pige::Client::VERSION
9
- gem.authors = ["Alban Peignier", "Florent Peyraud"]
10
- gem.email = ["alban@tryphon.eu", "florent@tryphon.eu"]
9
+ gem.authors = ['Alban Peignier', 'Florent Peyraud']
10
+ gem.email = ['alban@tryphon.eu', 'florent@tryphon.eu']
11
11
  gem.description = %q{Invokes Tryphon PigeBox via a simple DSL}
12
12
  gem.summary = %q{Tryphon PigeBox API ruby client}
13
- gem.homepage = "http://projects.tryphon.eu/projects/pigeclient"
13
+ gem.homepage = 'http://projects.tryphon.eu/projects/pigeclient'
14
14
 
15
15
  gem.files = `git ls-files`.split($/)
16
16
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
17
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
- gem.require_paths = ["lib"]
18
+ gem.require_paths = ['lib']
19
19
 
20
- gem.add_development_dependency "fakeweb"
21
- gem.add_development_dependency "guard"
22
- gem.add_development_dependency "guard-rspec"
23
- gem.add_development_dependency "rake"
24
- gem.add_development_dependency "rspec"
25
- gem.add_development_dependency "simplecov"
20
+ gem.add_development_dependency 'fakeweb'
21
+ gem.add_development_dependency 'guard'
22
+ gem.add_development_dependency 'guard-rspec'
23
+ gem.add_development_dependency 'rake'
24
+ gem.add_development_dependency 'rspec', '~> 2.11.0'
25
+ gem.add_development_dependency 'simplecov'
26
26
 
27
- gem.add_runtime_dependency "httparty"
27
+ gem.add_runtime_dependency 'httparty'
28
28
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tryphon-pige-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2015-01-25 00:00:00.000000000 Z
13
+ date: 2015-02-26 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: fakeweb
@@ -81,17 +81,17 @@ dependencies:
81
81
  requirement: !ruby/object:Gem::Requirement
82
82
  none: false
83
83
  requirements:
84
- - - ! '>='
84
+ - - ~>
85
85
  - !ruby/object:Gem::Version
86
- version: '0'
86
+ version: 2.11.0
87
87
  type: :development
88
88
  prerelease: false
89
89
  version_requirements: !ruby/object:Gem::Requirement
90
90
  none: false
91
91
  requirements:
92
- - - ! '>='
92
+ - - ~>
93
93
  - !ruby/object:Gem::Version
94
- version: '0'
94
+ version: 2.11.0
95
95
  - !ruby/object:Gem::Dependency
96
96
  name: simplecov
97
97
  requirement: !ruby/object:Gem::Requirement
@@ -174,7 +174,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
174
174
  version: '0'
175
175
  segments:
176
176
  - 0
177
- hash: -1990468393291890364
177
+ hash: -222627169929893987
178
178
  required_rubygems_version: !ruby/object:Gem::Requirement
179
179
  none: false
180
180
  requirements:
@@ -183,7 +183,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
183
183
  version: '0'
184
184
  segments:
185
185
  - 0
186
- hash: -1990468393291890364
186
+ hash: -222627169929893987
187
187
  requirements: []
188
188
  rubyforge_project:
189
189
  rubygems_version: 1.8.23