Class: HylaFAX::SendFax

Inherits:
Command show all
Defined in:
lib/hylafax/send_fax.rb

Constant Summary collapse

DEFAULT_TMP_DIR =
'tmp'
DEFAULT_PAGEWIDTH =
209
DEFAULT_PAGELENGTH =
296
DEFAULT_PAGECHOP =
'NONE'
DEFAULT_CHOPTHRESHOLD =
0
DOCUMENT_PREFIX =
'doc.'

Constants inherited from Command

Command::DEFAULT_HOST, Command::DEFAULT_PASSWORD, Command::DEFAULT_PORT, Command::DEFAULT_USER

Instance Attribute Summary collapse

Attributes inherited from Command

#ftp, #host, #password, #port, #user

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ SendFax

Returns a new instance of SendFax.



13
14
15
16
17
18
19
20
21
# File 'lib/hylafax/send_fax.rb', line 13

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

Instance Attribute Details

#dialstringObject (readonly)

Returns the value of attribute dialstring.



10
11
12
# File 'lib/hylafax/send_fax.rb', line 10

def dialstring
  @dialstring
end

#documentObject (readonly)

Returns the value of attribute document.



10
11
12
# File 'lib/hylafax/send_fax.rb', line 10

def document
  @document
end

#job_idObject (readonly)

Returns the value of attribute job_id.



10
11
12
# File 'lib/hylafax/send_fax.rb', line 10

def job_id
  @job_id
end

#pagelengthObject (readonly)

Returns the value of attribute pagelength.



10
11
12
# File 'lib/hylafax/send_fax.rb', line 10

def pagelength
  @pagelength
end

#pagewidthObject (readonly)

Returns the value of attribute pagewidth.



10
11
12
# File 'lib/hylafax/send_fax.rb', line 10

def pagewidth
  @pagewidth
end

#tmp_dirObject (readonly)

Returns the value of attribute tmp_dir.



10
11
12
# File 'lib/hylafax/send_fax.rb', line 10

def tmp_dir
  @tmp_dir
end

Instance Method Details

#runObject



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/hylafax/send_fax.rb', line 23

def run
  connect
  
  upload_document
  create_new_job
  set_lasttime
  set_dialstring
  set_pagewidth
  set_pagelength
  set_pagechop
  set_chopthreshold
  set_document
  submit_job
  job_id
end