module Takenoko

Public Instance Methods

download_and_upload_all_to_s3() click to toggle source
# File lib/takenoko/s3/takenoko.rb, line 46
def download_and_upload_all_to_s3
  errors = []
  mapping_config[:tables].each do |table,conf|
    next if conf[:attach_files].blank?
    begin
      download_and_upload_table_to_s3 table
    rescue Exception => e
      errors << e.to_s
    end
  end
  raise errors.join("\n") unless errors.empty?
  return true
end
download_and_upload_table_to_s3(table_name) click to toggle source
# File lib/takenoko/s3/takenoko.rb, line 27
def download_and_upload_table_to_s3(table_name)
  table_data = google_client.get_table(table_name)
  raise "attach_files not set" unless table_data[:attach_files].present?
  errors = []
  begin
    AttachHelper.download table_data
  rescue Exception => e
      errors << e.to_s
  end

  begin
    AttachHelper.upload_to_s3 table_data 
  rescue Exception => e
      errors << e.to_s
  end
  raise errors.join("\n") unless errors.empty?
  return true
end
s3() click to toggle source
# File lib/takenoko/s3/takenoko.rb, line 3
def s3
  S3
end
upload_all_to_s3() click to toggle source
# File lib/takenoko/s3/takenoko.rb, line 13
def upload_all_to_s3
  errors = []
  mapping_config[:tables].each do |table,conf|
    next if conf[:attach_files].blank?
    begin
      upload_table_to_s3 table
    rescue Exception => e
      errors << e.to_s
    end
  end
  raise errors.join("\n") unless errors.empty?
  return true
end
upload_table_to_s3(table_name) click to toggle source
# File lib/takenoko/s3/takenoko.rb, line 7
def upload_table_to_s3(table_name)
  table_data = google_client.get_table(table_name)
  raise "attach_files not set" unless table_data[:attach_files].present?
  AttachHelper.upload_to_s3 table_data
end