Sha256: 7b8536df079c2e8c08983451f84c9a4cab6201bdbf7b2b2a15cdba65893dc767

Contents?: true

Size: 745 Bytes

Versions: 1

Compression:

Stored size: 745 Bytes

Contents

require 'ba_upload/error_file'
module BaUpload
  class Connection
    attr_reader :m

    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

    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

    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
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ba_upload-0.1.0 lib/ba_upload/connection.rb