visa_check 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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 902a73b063f2f66d4f6f5424ed1bdd9885fef5ac
4
+ data.tar.gz: 9044948f0690e5ea0d26070e0ec478e3fbb3eba2
5
+ SHA512:
6
+ metadata.gz: a9e0e2d1c307055dc95f4aa4e7b0ffcb809ae8e1df684d2a65d097dddcab99b5f88f4229f75d13cabb75a93aa48747fe1e64fe707f058d8446b1180cbc8a9eff
7
+ data.tar.gz: 7f23fb054f1260224d464e2884fa83193fba1866001e00007b7ef2b252b5a696f3fd28e3cadf2806c5415ca69988ab5d11d8d88858c51004fd9b685e819c6adc
data/.gitignore ADDED
@@ -0,0 +1,22 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ *.bundle
19
+ *.so
20
+ *.o
21
+ *.a
22
+ mkmf.log
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.1.2
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 rbq
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,11 @@
1
+ # VisaCheck
2
+
3
+ This Gem reads a list of processed visa applications from the German consulate. It contains a binary to check if a specific application has been processed yet.
4
+
5
+ ## Installation
6
+
7
+ $ gem install visa_check
8
+
9
+ ## Usage
10
+
11
+ $ visa_check 1234567
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require 'bundler/gem_tasks'
2
+
data/bin/visa_check ADDED
@@ -0,0 +1,23 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # Check for a visa application number passed as an argument
4
+ application_number = ARGV.first
5
+ unless application_number && application_number.match(/^\d{7,}$/)
6
+ $stderr.puts "USAGE: #{File.basename(__FILE__)} BARCODE"
7
+ exit
8
+ end
9
+
10
+ # Load visa_check
11
+ lib = File.expand_path('../../lib', __FILE__)
12
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
13
+ require 'visa_check'
14
+
15
+ # Retrieving the PDF from the consulate and perform the actual check
16
+ applications = VisaCheck::Reader.applications
17
+
18
+ # Output the result of the online check
19
+ if applications.include? application_number
20
+ puts "Applications #{application_number} is ready! =)"
21
+ else
22
+ puts "#{applications.count} applications are ready, but #{application_number} isn't. :("
23
+ end
@@ -0,0 +1,23 @@
1
+ require 'open-uri'
2
+ require 'pdf-reader'
3
+
4
+ module VisaCheck
5
+
6
+ # VisaCheck::Reader retrieves an online PDF from the consulate and extracts
7
+ # visa application numbers.
8
+ class Reader
9
+ SOURCE = 'http://m.germania.diplo.de/contentblob/4048654/Daten/4377008/1entschiedenevisumantraege.pdf'
10
+ USER_AGENT = 'Mozilla/5.0 (Android; Mobile; rv:13.0) Gecko/13.0 Firefox/13.0'
11
+
12
+ def self.applications
13
+ pdf_reader.pages.map { |page| page.text.scan /^(\d{7})\s+/ }.flatten
14
+ end
15
+
16
+ private
17
+
18
+ def self.pdf_reader
19
+ ::PDF::Reader.new open(SOURCE, 'User-Agent' => USER_AGENT)
20
+ end
21
+ end
22
+
23
+ end
@@ -0,0 +1,3 @@
1
+ module VisaCheck
2
+ VERSION = '0.0.1'
3
+ end
data/lib/visa_check.rb ADDED
@@ -0,0 +1,2 @@
1
+ require 'visa_check/version'
2
+ require 'visa_check/reader'
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'visa_check/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'visa_check'
8
+ spec.version = VisaCheck::VERSION
9
+ spec.authors = ['rbq']
10
+ spec.email = ['rbq@gmx.de']
11
+ spec.summary = %q{Check processed visa applications from the German consulate}
12
+ spec.description = %q{This Gem reads a list of processed visa applications from the German consulate. It contains a binary to check if a specific application has been processed yet.}
13
+ spec.homepage = 'https://github.com/rbq/visa_check'
14
+ spec.license = 'MIT'
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ['lib']
20
+
21
+ spec.add_development_dependency 'bundler', '~> 1.6'
22
+ spec.add_development_dependency 'rake'
23
+
24
+ spec.add_runtime_dependency 'pdf-reader'
25
+ end
metadata ADDED
@@ -0,0 +1,100 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: visa_check
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - rbq
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-06-25 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.6'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.6'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: pdf-reader
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: This Gem reads a list of processed visa applications from the German
56
+ consulate. It contains a binary to check if a specific application has been processed
57
+ yet.
58
+ email:
59
+ - rbq@gmx.de
60
+ executables:
61
+ - visa_check
62
+ extensions: []
63
+ extra_rdoc_files: []
64
+ files:
65
+ - ".gitignore"
66
+ - ".ruby-version"
67
+ - Gemfile
68
+ - LICENSE.txt
69
+ - README.md
70
+ - Rakefile
71
+ - bin/visa_check
72
+ - lib/visa_check.rb
73
+ - lib/visa_check/reader.rb
74
+ - lib/visa_check/version.rb
75
+ - visa_check.gemspec
76
+ homepage: https://github.com/rbq/visa_check
77
+ licenses:
78
+ - MIT
79
+ metadata: {}
80
+ post_install_message:
81
+ rdoc_options: []
82
+ require_paths:
83
+ - lib
84
+ required_ruby_version: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ required_rubygems_version: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - - ">="
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ requirements: []
95
+ rubyforge_project:
96
+ rubygems_version: 2.2.2
97
+ signing_key:
98
+ specification_version: 4
99
+ summary: Check processed visa applications from the German consulate
100
+ test_files: []