ba_upload 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1c3d318a7143720be35bdd9460675ffa7eeed8d8ebd592c6c120d00067e3893e
4
- data.tar.gz: 67bbda23c6a00cd00e3b5e1f0310ff27833f782303f37e75e9e7a18b68783986
3
+ metadata.gz: 15804867b016b8c972bbb18385a2d1caec4a9729776ea2d1877dcddaeb73b15d
4
+ data.tar.gz: 930ef0bf4b3817c43616873144a43e46e482d5baa1efc5f5db63038dd44fd6e0
5
5
  SHA512:
6
- metadata.gz: 5a797ecf7a9fed238ecf08706adefa033f3ebdce51e2007a9215a77faf0a6d51cce0d143d7c1a1f19b2abf020437459e67cea69207474cacf00eaf96a54831e6
7
- data.tar.gz: ceb746f9650c23e19b46a14c6f1d5d3837b4e80af1c4dba5e684cf744448f60ad88cbb520bb26561775f2c584f6a34d6e4b5794c55846187d8d8ab4565144eec
6
+ metadata.gz: 4b906aa0b7c5860142c9c2d01f1f6955b8ccf8217448fd9164e293081f697ff9d43de2411989ff266a4729eb79a087a73fd56124e79159ec146fb29bd72fe6a2
7
+ data.tar.gz: fa9aaa0351fdf5758cb2a770e2b0105c6f599bae516f416ffa1ef25de58727f20b0180574086079474050042b253789dded4d58ce78e0edb55f81c146107e2cf
data/README.md CHANGED
@@ -61,7 +61,7 @@ Save to a file and just run it with the xml file as argument
61
61
 
62
62
  BA provides a often updated Position description databae ("VAM" Berufe). The Gem can help to download it:
63
63
 
64
- ```
64
+ ```ruby
65
65
  connection.misc.each do |link|
66
66
  target = "vendor/ba/#{link.href}"
67
67
  next if File.exist?(target)
@@ -70,6 +70,23 @@ connection.misc.each do |link|
70
70
  end
71
71
  ```
72
72
 
73
+ ### Usage with multiple client certificats
74
+
75
+ Since September 2022, users with multiple client certificats issued to the same email address need to provide their respective partner ID when using the API.
76
+ For user with only one certificat issued to their email address, providing the partner ID is optional.
77
+
78
+ The partner ID can be provided as an optional keyword argument to the `upload`, `error_files` and `misc` methods:
79
+
80
+ ```ruby
81
+ require 'ba_upload'
82
+ connection = BaUpload.open_connection(file_path: 'config/Zertifikat-1XXXX.p12', passphrase: 'YOURPASSPHRASE')
83
+
84
+ connection.upload(file: 'your_file_path', partner_id: 'P000XXXXXX')
85
+ connection.error_files(partner_id: 'P000XXXXXX')
86
+ connection.misc(partner_id: 'P000XXXXXX')
87
+
88
+ ```
89
+
73
90
  ## License
74
91
 
75
92
  The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
@@ -14,23 +14,26 @@ module BaUpload
14
14
  @m.cert = @cert.path
15
15
  end
16
16
 
17
- def upload(file: nil)
18
- m.get 'https://hrbaxml.arbeitsagentur.de/in/'
17
+ def upload(file: nil, partner_id: nil)
18
+ url = base_url(partner_id) + "in/"
19
+ m.get url
19
20
  form = m.page.forms.first
20
21
  form.file_uploads.first.file_name = file
21
22
  form.submit
22
23
  end
23
24
 
24
- def error_files
25
- m.get 'https://hrbaxml.arbeitsagentur.de/'
25
+ def error_files(partner_id: nil)
26
+ url = base_url(partner_id)
27
+ m.get url
26
28
  links = m.page.links_with(text: /ESP|ESV/)
27
29
  links.map do |link|
28
30
  ErrorFile.new(link)
29
31
  end
30
32
  end
31
33
 
32
- def misc
33
- m.get 'https://hrbaxml.arbeitsagentur.de/'
34
+ def misc(partner_id: nil)
35
+ url = base_url(partner_id)
36
+ m.get url
34
37
  m.page.links_with(text: /sonstiges/).first.click
35
38
  m.page.links.reject { |i| i.href[/^\?|mailto:/] || i.href == '/' }
36
39
  end
@@ -38,5 +41,13 @@ module BaUpload
38
41
  def shutdown
39
42
  m.shutdown
40
43
  end
44
+
45
+ private
46
+
47
+ def base_url(partner_id)
48
+ url = "https://hrbaxml.arbeitsagentur.de/"
49
+ url += "daten/#{partner_id}/" unless partner_id.nil?
50
+ url
51
+ end
41
52
  end
42
53
  end
@@ -1,3 +1,3 @@
1
1
  module BaUpload
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ba_upload
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stefan Wienert
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-02-03 00:00:00.000000000 Z
11
+ date: 2022-09-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mechanize
@@ -90,8 +90,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
90
90
  - !ruby/object:Gem::Version
91
91
  version: '0'
92
92
  requirements: []
93
- rubyforge_project:
94
- rubygems_version: 2.7.6
93
+ rubygems_version: 3.0.3
95
94
  signing_key:
96
95
  specification_version: 4
97
96
  summary: Upload API for Bundesagentur fuer Arbeit (hrbaxml.arbeitsagentur)