Class: BaUpload::Connection
- Inherits:
-
Object
- Object
- BaUpload::Connection
- Defined in:
- lib/ba_upload/connection.rb
Instance Attribute Summary collapse
-
#m ⇒ Object
readonly
Returns the value of attribute m.
Instance Method Summary collapse
- #error_files ⇒ Object
-
#initialize(key_file, cert_file, ca_cert_file) ⇒ Connection
constructor
A new instance of Connection.
- #upload(file: nil) ⇒ Object
Constructor Details
#initialize(key_file, cert_file, ca_cert_file) ⇒ Connection
Returns a new instance of Connection.
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/ba_upload/connection.rb', line 6 def initialize(key_file, cert_file, ca_cert_file) require 'mechanize' @key = key_file @cert = cert_file @ca_cert = ca_cert_file @m = Mechanize.new @m.key = @key.path @m.ca_file = @ca_cert.path @m.cert = @cert.path end |
Instance Attribute Details
#m ⇒ Object (readonly)
Returns the value of attribute m.
4 5 6 |
# File 'lib/ba_upload/connection.rb', line 4 def m @m end |
Instance Method Details
#error_files ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/ba_upload/connection.rb', line 24 def error_files m.get 'https://hrbaxml.arbeitsagentur.de/' links = m.page.links_with(text: /ESP|ESV/) links.map do |link| ErrorFile.new(link) end end |
#upload(file: nil) ⇒ Object
17 18 19 20 21 22 |
# File 'lib/ba_upload/connection.rb', line 17 def upload(file: nil) m.get 'https://hrbaxml.arbeitsagentur.de/in/' form = m.page.forms.first form.file_uploads.first.file_name = file form.submit end |