giropay_stalker 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in giropay_stalker.gemspec
4
+ gemspec
data/README.md ADDED
@@ -0,0 +1,18 @@
1
+ # Giropay Stalker
2
+
3
+ Stalks Giropay to find out if a bank supports Giropay
4
+
5
+ ## How To Install
6
+
7
+ sudo gem install giropay_stalker
8
+
9
+ ## Example
10
+
11
+ gp = GiropayStalker::Scraper.new
12
+
13
+ gp.supports(70070024)
14
+ => false
15
+
16
+ gp.supports(37050198)
17
+ => true
18
+
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
@@ -0,0 +1,23 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "giropay_stalker/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "giropay_stalker"
7
+ s.version = GiropayStalker::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["Lars Brillert"]
10
+ s.email = ["lars@railslove.com"]
11
+ s.homepage = "https://github.com/railslove/giropay_stalker"
12
+ s.summary = %q{Allows you to easily test a german bank code number for griopay support}
13
+ s.description = %q{Allows you to easily test a german bank code number for griopay support}
14
+
15
+ s.add_dependency "mechanize", "~> 1.0.0"
16
+
17
+ s.rubyforge_project = "giropay_stalker"
18
+
19
+ s.files = `git ls-files`.split("\n")
20
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
21
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
22
+ s.require_paths = ["lib"]
23
+ end
@@ -0,0 +1,28 @@
1
+ module GiropayStalker
2
+ class Scraper
3
+
4
+ def supported?(bank_code)
5
+ page = agent.get("http://www.giropay.de/index.php?id=banken_check")
6
+ blz_form = page.form("searchform")
7
+
8
+ # paste the bank code into the form
9
+ blz_form.fields[0].value = bank_code
10
+
11
+ # we have to reset the form action explicit to the url, empty action tag won't work
12
+ blz_form.action = "http://www.giropay.de/index.php?id=banken_check"
13
+
14
+ page = blz_form.click_button
15
+
16
+ # check if the giropay logo is present
17
+ page.search(".//img[@src='typo3conf/ext/sf_giropay_contact/pi5/gplogo.gif']").any?
18
+ end
19
+
20
+ def log
21
+ @log ||= Logger.now
22
+ end
23
+
24
+ def agent
25
+ @agent ||= Mechanize.new
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,3 @@
1
+ module GiropayStalker
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,10 @@
1
+ $:.unshift(File.expand_path("../", __FILE__))
2
+
3
+ # Gems
4
+ require "mechanize"
5
+
6
+ # Local files
7
+ require "giropay_stalker/scraper"
8
+
9
+ module GiropayStalker
10
+ end
metadata ADDED
@@ -0,0 +1,90 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: giropay_stalker
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - Lars Brillert
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-05-13 00:00:00 +02:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: mechanize
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ hash: 23
30
+ segments:
31
+ - 1
32
+ - 0
33
+ - 0
34
+ version: 1.0.0
35
+ type: :runtime
36
+ version_requirements: *id001
37
+ description: Allows you to easily test a german bank code number for griopay support
38
+ email:
39
+ - lars@railslove.com
40
+ executables: []
41
+
42
+ extensions: []
43
+
44
+ extra_rdoc_files: []
45
+
46
+ files:
47
+ - .gitignore
48
+ - Gemfile
49
+ - README.md
50
+ - Rakefile
51
+ - giropay_stalker.gemspec
52
+ - lib/giropay_stalker.rb
53
+ - lib/giropay_stalker/scraper.rb
54
+ - lib/giropay_stalker/version.rb
55
+ has_rdoc: true
56
+ homepage: https://github.com/railslove/giropay_stalker
57
+ licenses: []
58
+
59
+ post_install_message:
60
+ rdoc_options: []
61
+
62
+ require_paths:
63
+ - lib
64
+ required_ruby_version: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ hash: 3
70
+ segments:
71
+ - 0
72
+ version: "0"
73
+ required_rubygems_version: !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
76
+ - - ">="
77
+ - !ruby/object:Gem::Version
78
+ hash: 3
79
+ segments:
80
+ - 0
81
+ version: "0"
82
+ requirements: []
83
+
84
+ rubyforge_project: giropay_stalker
85
+ rubygems_version: 1.4.1
86
+ signing_key:
87
+ specification_version: 3
88
+ summary: Allows you to easily test a german bank code number for griopay support
89
+ test_files: []
90
+