lib/hylafax/send_fax.rb in hylafax-0.2.1 vs lib/hylafax/send_fax.rb in hylafax-0.3.0

- old
+ new

@@ -1,27 +1,38 @@ module HylaFAX class SendFax < Command DEFAULT_TMP_DIR = 'tmp' + DEFAULT_PAGEWIDTH = 209 + DEFAULT_PAGELENGTH = 296 + DEFAULT_PAGECHOP = "default" + DEFAULT_CHOPTHRESHOLD = 3 DOCUMENT_PREFIX = 'doc.' - attr_reader :dialstring, :document, :tmp_dir, :job_id + attr_reader :dialstring, :document, :tmp_dir, :job_id, :pagewidth, + :pagelength def initialize(opts = {}) super @tmp_dir = opts.fetch(:tmp_dir) { DEFAULT_TMP_DIR } @dialstring = opts.fetch(:dialstring) @document = opts.fetch(:document) + @pagewidth = opts.fetch(:pagewidth) { DEFAULT_PAGEWIDTH } + @pagelength = opts.fetch(:pagelength) { DEFAULT_PAGELENGTH } @job_id = nil end def run connect login upload_document create_new_job set_lasttime set_dialstring + set_pagewidth + set_pagelength + set_pagechop + set_chopthreshold set_document submit_job job_id end @@ -53,9 +64,25 @@ ftp.sendcmd('JPARM LASTTIME 000259') end def set_dialstring ftp.sendcmd("JPARM DIALSTRING \"#{dialstring}\"") + end + + def set_pagewidth + ftp.sendcmd(%Q{JPARM PAGEWIDTH #{pagewidth}}) + end + + def set_pagelength + ftp.sendcmd(%Q{JPARM PAGELENGTH #{pagelength}}) + end + + def set_pagechop + ftp.sendcmd(%Q{JPARM PAGECHOP "#{DEFAULT_PAGECHOP}"}) + end + + def set_chopthreshold + ftp.sendcmd(%Q{JPARM CHOPTHRESHOLD #{DEFAULT_CHOPTHRESHOLD}}) end def set_document ftp.sendcmd("JPARM DOCUMENT \"#{remote_document}\"") end