Sha256: f9188de6fbfc5ec74c1f6ab80dfb962f639463720f99e4af1a734525390d0d8b
Contents?: true
Size: 890 Bytes
Versions: 3
Compression:
Stored size: 890 Bytes
Contents
# coding: utf-8 require 'net/ftp' require 'dech/dena/csv' module Dech class Dena class FTP DEFAULT_HOST = "bcmaster1.dena.ne.jp" DEFAULT_PATH = "/data.csv" attr_accessor :products, :username, :host, :path def initialize(args={}) @products = args[:products] || [] @username = args[:username] @password = args[:password] @host = args[:host] || DEFAULT_HOST @path = args[:path] || DEFAULT_PATH end def csv Dech::Dena::CSV.new(@products) end def ready? true end def upload! ftp_connection{|ftp| ftp.storlines("STOR #{@path}", csv) } true end def upload ready? && upload! end private def ftp_connection Net::FTP.open(@host, @username, @password){|ftp| yield(ftp) } end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
dech-0.1.0 | lib/dech/dena/ftp.rb |
dech-0.0.7 | lib/dech/dena/ftp.rb |
dech-0.0.6 | lib/dech/dena/ftp.rb |