megasena 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 37d44ddb4961e7860d28aa70555935fae1934d79
4
+ data.tar.gz: ddf491b9341c9d21869e8889cca34502b15de474
5
+ SHA512:
6
+ metadata.gz: ca64ffe45ba47e3a07e9db6649fd3665b040ff85dfbf7baf1c810d40568aecc924fc8715a25f426b1b660c9edcc141665977e8785ac8e6c1cca9e0a0a2ae0376
7
+ data.tar.gz: f3a1cda030028f172f528ae7a9c811b5c70c90bfec228aab83c6beb18920090e4b725bb26a43fa44ff8fb412f29d6e028b5d8e60e250bf01c1f40fcc495a6d43
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'mechanize'
@@ -0,0 +1,30 @@
1
+ # lotofacil:
2
+ # url: ""
3
+ # dom: ""
4
+ # lotomania:
5
+ # url: ""
6
+ # dom: ""
7
+ # lotogol:
8
+ # url: ""
9
+ # dom: ""
10
+ # loteca:
11
+ # url: ""
12
+ # dom: ""
13
+ # timemania:
14
+ # url: ""
15
+ # dom: ""
16
+ # federal:
17
+ # url: ""
18
+ # dom: ""
19
+ # instantanea:
20
+ # url: ""
21
+ # dom: ""
22
+ quina:
23
+ url: "http://www1.caixa.gov.br/loterias/loterias/quina/quina_pesquisa_new.asp"
24
+ dom: "//span[@id='sorteio2']/ul/li"
25
+ # duplasena:
26
+ # url: ""
27
+ # dom: ""
28
+ megasena:
29
+ url: "http://www1.caixa.gov.br/loterias/loterias/megasena/megasena_pesquisa_new.asp"
30
+ dom: "//body/span[@class='num_sorteio']/ul/li"
@@ -0,0 +1,4 @@
1
+ module Lottery
2
+ class DuplaSena < Lottery::Gamble
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module Lottery
2
+ class Federal < Lottery::Gamble
3
+ end
4
+ end
@@ -0,0 +1,20 @@
1
+ require 'yaml'
2
+ require 'mechanize'
3
+
4
+ module Lottery
5
+ class Gamble
6
+ attr_accessor :contest, :numbers
7
+
8
+ def path
9
+ Hash[ YAML::load( File.read( File.join('config', 'contests.yml')
10
+ ))[ self.class.to_s.downcase.split(/::/).last ].map{|k,v|[k.to_sym,v]} ]
11
+ end
12
+
13
+ def initialize
14
+ page = Mechanize.new.get( path[:url] ).parser
15
+ @contest = page.at("//p").inner_html.scan(/(?=^)\d+/).first.to_i
16
+ @numbers = page.xpath( path[:dom] ).map(&:content).map(&:to_i)
17
+ end
18
+
19
+ end
20
+ end
@@ -0,0 +1,4 @@
1
+ module Lottery
2
+ class Instantanea < Lottery::Gamble
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module Lottery
2
+ class Loteca < Lottery::Gamble
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module Lottery
2
+ class LotoFacil < Lottery::Gamble
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module Lottery
2
+ class LogoGol < Lottery::Gamble
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module Lottery
2
+ class LotoMania < Lottery::Gamble
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module Lottery
2
+ class MegaSena < Lottery::Gamble
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module Lottery
2
+ class Quina < Lottery::Gamble
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module Lottery
2
+ class TimeMania < Lottery::Gamble
3
+ end
4
+ end
@@ -0,0 +1,5 @@
1
+ require_relative 'lottery/gamble'
2
+
3
+ # Creates the Database references
4
+ Dir.glob( File.join File.dirname(__FILE__),'lottery', '**/*.rb' )
5
+ .sort_by { |file| file.count "/" }.each { |file| require file }
metadata ADDED
@@ -0,0 +1,57 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: megasena
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Naner Nunes
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-12-30 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: MegaSena Gem
14
+ email: naner@naner.com.br
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - Gemfile
20
+ - config/contests.yml
21
+ - lib/lottery/duplasena.rb
22
+ - lib/lottery/federal.rb
23
+ - lib/lottery/gamble.rb
24
+ - lib/lottery/instantanea.rb
25
+ - lib/lottery/loteca.rb
26
+ - lib/lottery/lotofacil.rb
27
+ - lib/lottery/lotogol.rb
28
+ - lib/lottery/lotomania.rb
29
+ - lib/lottery/megasena.rb
30
+ - lib/lottery/quina.rb
31
+ - lib/lottery/timemania.rb
32
+ - lib/megasena.rb
33
+ homepage: http://rubygems.org/gems/megasena
34
+ licenses:
35
+ - MIT
36
+ metadata: {}
37
+ post_install_message:
38
+ rdoc_options: []
39
+ require_paths:
40
+ - lib
41
+ required_ruby_version: !ruby/object:Gem::Requirement
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ required_rubygems_version: !ruby/object:Gem::Requirement
47
+ requirements:
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ version: '0'
51
+ requirements: []
52
+ rubyforge_project:
53
+ rubygems_version: 2.4.3
54
+ signing_key:
55
+ specification_version: 4
56
+ summary: MegaSena Lottery
57
+ test_files: []