OSDN Git Service

Merge branch 'v06' of git.sourceforge.jp:/gitroot/pettanr/pettanr into v06
[pettanr/pettanr.git] / app / models / demander.rb
index 0e9b948..c1d6fd0 100644 (file)
@@ -118,4 +118,34 @@ class Demander < ActiveRecord::Base
     self.demander_status.stop
   end
   
+  def licenses_export date = nil
+    raise ActiveRecord::Forbidden unless self.status == 3
+    License.export date
+  end
+  
+  def artists_export date = nil
+    raise ActiveRecord::Forbidden unless self.status == 3
+    Artist.export date
+  end
+  
+  def original_pictures_export date = nil
+    raise ActiveRecord::Forbidden unless self.status == 3
+    OriginalPicture.export date
+  end
+  
+  def pictures_export date = nil
+    raise ActiveRecord::Forbidden unless self.status == 3
+    Picture.export date
+  end
+  
+  def export date
+    raise ActiveRecord::Forbidden unless self.status == 3
+    {
+      :licenses => self.licenses_export(date), 
+      :artists => self.artists_export(date), 
+      :original_pictures => self.original_pictures_export(date), 
+      :pictures => self.pictures_export(date)
+    }
+  end
+  
 end