Class: BaUpload::ErrorFile

Inherits:
Object
  • Object
show all
Defined in:
lib/ba_upload/error_file.rb

Instance Method Summary collapse

Constructor Details

#initialize(mechanize_link) ⇒ ErrorFile

Returns a new instance of ErrorFile.



3
4
5
6
# File 'lib/ba_upload/error_file.rb', line 3

def initialize(mechanize_link)
  @mechanize_link = mechanize_link
  @link = mechanize_link.href
end

Instance Method Details

#filenameObject



13
14
15
# File 'lib/ba_upload/error_file.rb', line 13

def filename
  @mechanize_link.text
end

#readObject



8
9
10
11
# File 'lib/ba_upload/error_file.rb', line 8

def read
  response = @mechanize_link.click
  response.xml.to_s
end

#tempfileObject



17
18
19
20
21
22
# File 'lib/ba_upload/error_file.rb', line 17

def tempfile
  tf = Tempfile.new(['error_file', '.xml'])
  tf.write(read)
  tf.flush
  tf
end