ari_fetch 0.0.4 → 0.0.5
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.
@@ -2,7 +2,7 @@ require "nokogiri"
|
|
2
2
|
|
3
3
|
module AriFetch
|
4
4
|
class AriReadFile < ActiveRecord::Base
|
5
|
-
attr_accessible :name
|
5
|
+
attr_accessible :name, :data_read
|
6
6
|
|
7
7
|
attr_accessor :content, :vehicles
|
8
8
|
|
@@ -11,7 +11,7 @@ module AriFetch
|
|
11
11
|
@content = parse!(File.open(name, "r"))
|
12
12
|
FileUtils.rm name
|
13
13
|
filter_cancel_vehicles! unless include_cancel
|
14
|
-
result
|
14
|
+
result.tap { data_reading_done! }
|
15
15
|
end
|
16
16
|
|
17
17
|
private
|
@@ -36,5 +36,9 @@ module AriFetch
|
|
36
36
|
vehicles.map { |vehicle| vehicle.result }
|
37
37
|
end
|
38
38
|
|
39
|
+
def data_reading_done!
|
40
|
+
self.update_attributes(data_read: true)
|
41
|
+
end
|
42
|
+
|
39
43
|
end
|
40
44
|
end
|
data/lib/ari_fetch/files.rb
CHANGED
data/lib/ari_fetch/version.rb
CHANGED
data/lib/ari_fetch.rb
CHANGED
@@ -28,7 +28,7 @@ module AriFetch
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def fetch_vehicles_from_files(how_many=1)
|
31
|
-
unread_files.first(how_many).map {|file| AriFetch::AriReadFile.create(name: file).fetch_data(ftp_instance, include_cancel?) }.flatten!
|
31
|
+
unread_files.first(how_many).map {|file| AriFetch::AriReadFile.create(name: file, data_read: false).fetch_data(ftp_instance, include_cancel?) }.flatten!
|
32
32
|
end
|
33
33
|
|
34
34
|
private
|