iboleto 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 20b5ea5335e7ff3dec559f036507af9d88bd47a1
4
+ data.tar.gz: 91229fd0eff234f98998d69369f7df72f84bb0ab
5
+ SHA512:
6
+ metadata.gz: 91617109aa328cde91ae0820b0ae9eea709cdb95389e23904cb11480582e61d120a16b040e7287857042cf380e23f76bd176df4b858737fce17953f5bda499a6
7
+ data.tar.gz: 0c3f8335b6908c64869393f01b2696cf10b0ac0643888f1a94ec843315a85f5210a25f1cce85a1e15f4dd177af4b558e6919d2436a91d69a2eeb565d5b7e5b89
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in iboleto.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 Abinoam Praxedes Marques Jr.
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.en.md ADDED
@@ -0,0 +1,26 @@
1
+ # IBoleto.rb
2
+
3
+ [README em português](README.md)
4
+
5
+ IBoleto.rb is a Linux compatible CLI server for Quadrimind IBoleto android application.
6
+ Quadrimind IBoleto scans (brazilian format) bills' barcodes and sends to a server (Ex: IBoleto.rb).
7
+ IBoleto.rb uses gtk to copy to clipboard the barcode number sequence in more than one format.
8
+ So you can past it at your internet bank for payment.
9
+
10
+ ## Installation
11
+
12
+ Add this line to your application's Gemfile:
13
+
14
+ $ gem install iboleto
15
+
16
+ ## Usage
17
+
18
+ $ iboleto
19
+
20
+ ## Contributing
21
+
22
+ 1. Fork it ( https://github.com/[my-github-username]/iboleto/fork )
23
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
24
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
25
+ 4. Push to the branch (`git push origin my-new-feature`)
26
+ 5. Create a new Pull Request
data/README.md ADDED
@@ -0,0 +1,24 @@
1
+ # IBoleto.rb
2
+
3
+ [English README](README.en.md)
4
+
5
+ IBoleto.rb é servidor em linha de comando compatível com Linux para o aplicativo de android IBoleto da Quadrimind.
6
+ O IBoleto da Quadrimind intepreta códigos de barra do formato brasileiro e os envia a um servidor (Ex: IBoleto.rb)
7
+ IBoleto.rb usa gtk para copiar para a área de trabalho a sequência de números do código de barra em mais de um formato.
8
+ Então você pode colar os números no seu **internet bank** para realizar o pagamento.
9
+
10
+ ## Instalação
11
+
12
+ $ gem install iboleto
13
+
14
+ ## Uso
15
+
16
+ $ iboleto
17
+
18
+ ## Para contribuir
19
+
20
+ 1. Fork ( https://github.com/abinoam/iboleto/fork )
21
+ 2. Crie uma branch de funcionalidade (`git checkout -b my-new-feature`)
22
+ 3. Faça um **commit** das suas mudanças (`git commit -am 'Add some feature'`)
23
+ 4. Faça um **push** da sua branch (`git push origin my-new-feature`)
24
+ 5. Crie um novo **Pull Request**
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
data/bin/iboleto ADDED
@@ -0,0 +1,78 @@
1
+ #!/usr/bin/env ruby
2
+ #coding: utf-8
3
+
4
+ # Last updated at October, 06, 2014.
5
+
6
+ require 'gtk2'
7
+ require 'socket'
8
+
9
+ class ClientQuitError < RuntimeError; end
10
+
11
+ port = ARGV.shift || 5001 # default is to use the iBoleto port (if 0 default to next available)
12
+ host = ARGV.shift # default is to bind everything
13
+
14
+ server = host ? TCPServer.open(host, port) : TCPServer.open(port)
15
+
16
+ port = server.addr[1]
17
+ addrs = server.addr[2..-1].uniq
18
+
19
+ puts "*** listening on #{addrs.collect{|a|"#{a}:#{port}"}.join(' ')}"
20
+
21
+ loop do
22
+ socket = server.accept
23
+
24
+ Thread.start do # one thread per client
25
+ s = socket
26
+
27
+ port = s.peeraddr[1]
28
+ name = s.peeraddr[2]
29
+ addr = s.peeraddr[3]
30
+
31
+ puts "*** recieving from #{name}:#{port}"
32
+
33
+ begin
34
+ while line = s.gets # read a line at a time
35
+ if m = line.match(/POST \/iBoleto\?cod=(\d+)+&dec=(\d+)/)
36
+ clip = Gtk::Clipboard.get(Gdk::Selection::CLIPBOARD)
37
+
38
+ cod = m[1]
39
+ dec = m[2]
40
+
41
+ boleto_regexp = /\A(\w{5})(\w{5})(\w{5})(\w{6})(\w{5})(\w{6})(\w{1})(\w{14})\Z/
42
+ boleto = dec.dup.sub!(boleto_regexp, '\1 2 \3 \4 \5 \6 \7 \8')
43
+ boleto_with_tabs = dec.dup.sub!(boleto_regexp, "\\1\t\\2\t\\3\t\\4\t\\5\t\\6\t\\7\t\\8")
44
+
45
+ conv_regexp = /\A(\d{12})(\d{12})(\d{12})(\d{12})\Z/
46
+ conv = dec.dup.sub!(conv_regexp, '\1 \2 \3 \4')
47
+ conv_with_tabs = dec.dup.sub!(conv_regexp, "\\1\t\\2\t\\3\t\\4")
48
+
49
+ clip.set_text([cod, dec, boleto, boleto_with_tabs, conv, conv_with_tabs].compact.join("\n"))
50
+ clip.store
51
+ end
52
+
53
+ if ["\n\r", "\n", "\r\n"].include? line
54
+
55
+ s.print "HTTP/1.1 200/OK\r\nContent-type:text/html\r\n\r\n"
56
+ s.print "<html><head><title>ok</title></head><body>ok!</body></html>\r\n\r\n"
57
+ puts "*** #{name}:#{port} disconnected"
58
+ raise
59
+ end
60
+
61
+
62
+ raise ClientQuitError if line =~ /^die\r?$/
63
+ puts "#{addr} [#{Time.now}]: #{line.inspect}"
64
+ end
65
+
66
+ rescue ClientQuitError
67
+ puts "*** #{name}:#{port} disconnected"
68
+
69
+ ensure
70
+ s.close # close socket on error
71
+ end
72
+
73
+ puts "*** done with #{name}:#{port}"
74
+ end
75
+
76
+ end
77
+
78
+
data/iboleto.gemspec ADDED
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'iboleto/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "iboleto"
8
+ spec.version = IBoleto::VERSION
9
+ spec.authors = ["Abinoam Praxedes Marques Jr."]
10
+ spec.email = ["abinoam@gmail.com"]
11
+ spec.summary = %q{Linux compatible CLI Ruby server for IBoleto android app}
12
+ spec.description = %q{Linux compatible CLI Ruby server for QuadriMind IBoleto android app - http://www.quadrimind.com/iBoleto/}
13
+ spec.homepage = ""
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.7"
22
+ spec.add_development_dependency "rake", "~> 10.0"
23
+ spec.add_runtime_dependency "gtk2"
24
+ end
data/lib/iboleto.rb ADDED
@@ -0,0 +1,5 @@
1
+ require "iboleto/version"
2
+
3
+ module IBoleto
4
+ # Your code goes here...
5
+ end
@@ -0,0 +1,3 @@
1
+ module IBoleto
2
+ VERSION = "0.0.1"
3
+ end
metadata ADDED
@@ -0,0 +1,98 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: iboleto
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Abinoam Praxedes Marques Jr.
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-02-09 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.7'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: gtk2
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: Linux compatible CLI Ruby server for QuadriMind IBoleto android app -
56
+ http://www.quadrimind.com/iBoleto/
57
+ email:
58
+ - abinoam@gmail.com
59
+ executables:
60
+ - iboleto
61
+ extensions: []
62
+ extra_rdoc_files: []
63
+ files:
64
+ - ".gitignore"
65
+ - Gemfile
66
+ - LICENSE.txt
67
+ - README.en.md
68
+ - README.md
69
+ - Rakefile
70
+ - bin/iboleto
71
+ - iboleto.gemspec
72
+ - lib/iboleto.rb
73
+ - lib/iboleto/version.rb
74
+ homepage: ''
75
+ licenses:
76
+ - MIT
77
+ metadata: {}
78
+ post_install_message:
79
+ rdoc_options: []
80
+ require_paths:
81
+ - lib
82
+ required_ruby_version: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - ">="
85
+ - !ruby/object:Gem::Version
86
+ version: '0'
87
+ required_rubygems_version: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ requirements: []
93
+ rubyforge_project:
94
+ rubygems_version: 2.4.3
95
+ signing_key:
96
+ specification_version: 4
97
+ summary: Linux compatible CLI Ruby server for IBoleto android app
98
+ test_files: []