abgabenrechner 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -0
- data/LICENSE +20 -0
- data/README.rdoc +17 -0
- data/Rakefile +19 -0
- data/VERSION +1 -0
- data/abgabenrechner.gemspec +50 -0
- data/lib/abgabenrechner.rb +60 -0
- data/test/helper.rb +10 -0
- data/test/test_abgabenrechner.rb +7 -0
- metadata +81 -0
data/.gitignore
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2009 Felix Faerber
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
= abgabenrechner
|
2
|
+
|
3
|
+
Description goes here.
|
4
|
+
|
5
|
+
== Note on Patches/Pull Requests
|
6
|
+
|
7
|
+
* Fork the project.
|
8
|
+
* Make your feature addition or bug fix.
|
9
|
+
* Add tests for it. This is important so I don't break it in a
|
10
|
+
future version unintentionally.
|
11
|
+
* Commit, do not mess with rakefile, version, or history.
|
12
|
+
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
13
|
+
* Send me a pull request. Bonus points for topic branches.
|
14
|
+
|
15
|
+
== Copyright
|
16
|
+
|
17
|
+
Copyright (c) 2010 Felix Faerber. See LICENSE for details.
|
data/Rakefile
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gem|
|
7
|
+
gem.name = "abgabenrechner"
|
8
|
+
gem.summary = "One line summary of your gem"
|
9
|
+
gem.description = "german tax calculator"
|
10
|
+
gem.email = "mail@felixfaerber.de"
|
11
|
+
gem.homepage = "http://github.com/ffaerber/abgabenrechner"
|
12
|
+
gem.authors = ["Felix Faerber"]
|
13
|
+
gem.add_development_dependency "thoughtbot-shoulda", ">= 0"
|
14
|
+
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
15
|
+
end
|
16
|
+
Jeweler::GemcutterTasks.new
|
17
|
+
rescue LoadError
|
18
|
+
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
19
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{abgabenrechner}
|
8
|
+
s.version = "0.1.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Felix Faerber"]
|
12
|
+
s.date = %q{2010-06-18}
|
13
|
+
s.description = %q{german tax calculator}
|
14
|
+
s.email = %q{mail@felixfaerber.de}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE",
|
17
|
+
"README.rdoc"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".gitignore",
|
21
|
+
"README.rdoc",
|
22
|
+
"Rakefile",
|
23
|
+
"VERSION",
|
24
|
+
"abgabenrechner.gemspec",
|
25
|
+
"lib/abgabenrechner.rb"
|
26
|
+
]
|
27
|
+
s.homepage = %q{http://github.com/ffaerber/abgabenrechner}
|
28
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
29
|
+
s.require_paths = ["lib"]
|
30
|
+
s.rubygems_version = %q{1.3.6}
|
31
|
+
s.summary = %q{One line summary of your gem}
|
32
|
+
s.test_files = [
|
33
|
+
"test/helper.rb",
|
34
|
+
"test/test_abgabenrechner.rb"
|
35
|
+
]
|
36
|
+
|
37
|
+
if s.respond_to? :specification_version then
|
38
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
39
|
+
s.specification_version = 3
|
40
|
+
|
41
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
42
|
+
s.add_development_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
43
|
+
else
|
44
|
+
s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
45
|
+
end
|
46
|
+
else
|
47
|
+
s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
@@ -0,0 +1,60 @@
|
|
1
|
+
require 'net/http'
|
2
|
+
require 'net/https'
|
3
|
+
require 'rexml/document'
|
4
|
+
|
5
|
+
|
6
|
+
module BMF
|
7
|
+
class Abgabenrechner
|
8
|
+
|
9
|
+
|
10
|
+
def initialize(argv)
|
11
|
+
|
12
|
+
|
13
|
+
@year = argv[:year] # Jahr
|
14
|
+
@lzz = argv[:lzz] # Lohnzahlungszeitraum
|
15
|
+
@re4 = argv[:re4] # Einkommen
|
16
|
+
@stkl = argv[:stkl] # Steuerklasse
|
17
|
+
|
18
|
+
|
19
|
+
@http = Net::HTTP.new("www.abgabenrechner.de", 443)
|
20
|
+
@http.use_ssl = true
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
def array_to_hash(array)
|
26
|
+
count = 0
|
27
|
+
hash = Hash.new
|
28
|
+
(array.length / 2).times do
|
29
|
+
hash[array[count]] = array[count+1]
|
30
|
+
count += 2
|
31
|
+
end
|
32
|
+
return hash
|
33
|
+
end
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
def run
|
38
|
+
path = "/interface/#{@year}.jsp?LZZ=#{@lzz}&RE4=#{@re4}&STKL=#{@stkl}"
|
39
|
+
|
40
|
+
# GET request -> so the host can set his cookies
|
41
|
+
resp, data = @http.get(path, nil)
|
42
|
+
cookie = resp.response['set-cookie']
|
43
|
+
|
44
|
+
|
45
|
+
ausgaben = Array.new()
|
46
|
+
|
47
|
+
doc = REXML::Document.new(data)
|
48
|
+
doc.elements.each('lohnsteuer/ausgaben/ausgabe') do |ele|
|
49
|
+
ausgaben << ele.attributes['name']
|
50
|
+
ausgaben << ele.attributes['value']
|
51
|
+
end
|
52
|
+
|
53
|
+
array_to_hash(ausgaben)
|
54
|
+
|
55
|
+
end
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
end
|
60
|
+
end
|
data/test/helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: abgabenrechner
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 1
|
8
|
+
- 0
|
9
|
+
version: 0.1.0
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Felix Faerber
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2010-06-18 00:00:00 +02:00
|
18
|
+
default_executable:
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: thoughtbot-shoulda
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 0
|
29
|
+
version: "0"
|
30
|
+
type: :development
|
31
|
+
version_requirements: *id001
|
32
|
+
description: german tax calculator
|
33
|
+
email: mail@felixfaerber.de
|
34
|
+
executables: []
|
35
|
+
|
36
|
+
extensions: []
|
37
|
+
|
38
|
+
extra_rdoc_files:
|
39
|
+
- LICENSE
|
40
|
+
- README.rdoc
|
41
|
+
files:
|
42
|
+
- .gitignore
|
43
|
+
- README.rdoc
|
44
|
+
- Rakefile
|
45
|
+
- VERSION
|
46
|
+
- abgabenrechner.gemspec
|
47
|
+
- lib/abgabenrechner.rb
|
48
|
+
- LICENSE
|
49
|
+
has_rdoc: true
|
50
|
+
homepage: http://github.com/ffaerber/abgabenrechner
|
51
|
+
licenses: []
|
52
|
+
|
53
|
+
post_install_message:
|
54
|
+
rdoc_options:
|
55
|
+
- --charset=UTF-8
|
56
|
+
require_paths:
|
57
|
+
- lib
|
58
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - ">="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
segments:
|
63
|
+
- 0
|
64
|
+
version: "0"
|
65
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
segments:
|
70
|
+
- 0
|
71
|
+
version: "0"
|
72
|
+
requirements: []
|
73
|
+
|
74
|
+
rubyforge_project:
|
75
|
+
rubygems_version: 1.3.6
|
76
|
+
signing_key:
|
77
|
+
specification_version: 3
|
78
|
+
summary: One line summary of your gem
|
79
|
+
test_files:
|
80
|
+
- test/helper.rb
|
81
|
+
- test/test_abgabenrechner.rb
|