lotofacil 0.0.3 → 0.0.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6a40da1bf5d7f47c08942e9e7e89fe73526d1a42
4
- data.tar.gz: 0ad92514b2903ead6c460e5a2ca45d81e69aec16
3
+ metadata.gz: 29c4f95b80ceca4abf175eedfd8de28c74a58b17
4
+ data.tar.gz: 3e4b1efbdee911c834fa6ba0993345d05dceed7d
5
5
  SHA512:
6
- metadata.gz: 4ee6dd23242df5fd59c3b808a62e0777a074fc221a7acae384d4f075298120fda6313bf1586b09247a80bcc4057befd0cde08b823b9fa1accdbf69e8867f3f63
7
- data.tar.gz: 628f2184f98b001d51b82a1237ace54f5264099853c42d42121edc605f290efa1075368e7492f4e668a6b40d4e2b703de62faa40892abc7521408fbdae081267
6
+ metadata.gz: fe0eb1a604680fd07d3ea627025f9d8f69563ddf722404ed3c254046ac084a45581636479f87f2d24cdbd6153d69f05076a04b88a25334f4855c9ecd5cf61a87
7
+ data.tar.gz: f0de9f14202df332b58fcb09b7705bd0280d8c2ca4eff975f42dc6fa6878cf344931e6421ad4e3877ff4266b5e53459ea86e35979ca7339034037c3e2d4ea575
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in mega_sena.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 TODO: Write your name
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.
@@ -0,0 +1,39 @@
1
+ # lotofacil
2
+ The gem to generate lotofacil lottery in Brazil
3
+ # Installation
4
+ Add in the application file Gemfile:
5
+ ```ruby
6
+ gem 'lotofacil'
7
+ ```
8
+ Execute:
9
+
10
+ $ bundle
11
+
12
+ Or install it yourself as:
13
+
14
+ $ gem install lotofacil
15
+
16
+ ## Usage
17
+ ```ruby
18
+ # Generate lottery ticket 15, 16, 17 or 18 numbers
19
+ Lotofacil::Raffle.new.generate # => [[3, 4, 8, 9, 11, 12, 13, 14, 17, 18, 19, 20, 22, 24, 25]]
20
+ Lotofacil::Raffle.new(15).generate # => [[3, 5, 6, 8, 9, 10, 11, 14, 16, 19, 21, 22, 23, 24, 25]]
21
+ Lotofacil::Raffle.new(16).generate # => [[1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 13, 14, 16, 18, 20, 22]]
22
+ Lotofacil::Raffle.new(17).generate # => [[1, 3, 4, 5, 6, 7, 8, 10, 13, 16, 17, 18, 19, 22, 23, 24, 25]]
23
+ Lotofacil::Raffle.new(18).generate # => [[2, 4, 5, 6, 7, 8, 10, 11, 12, 13, 14, 15, 17, 18, 20, 22, 23, 25]]
24
+ Lotofacil::Raffle.new(19).generate # => [[3, 6, 7, 8, 11, 12, 13, 14, 15, 16, 17, 21, 22, 23, 24]]
25
+
26
+ # Generate amount of lottery ticket
27
+ Lotofacil::Raffle.new.generate(0) # => []
28
+ Lotofacil::Raffle.new.generate(1) # => [[1, 2, 3, 4, 5, 6, 7, 8, 9, 12, 13, 15, 16, 17, 24]]
29
+ Lotofacil::Raffle.new.generate(2) # => [[3, 4, 5, 8, 11, 12, 13, 16, 17, 18, 21, 22, 23, 24, 25], [1, 3, 4, 5, 6, 7, 9, 10, 14, 15, 17, 18, 19, 21, 24]]
30
+ ...
31
+
32
+ # Complete lottery ticket
33
+ Lotofacil::Raffle.new.generate(1,1,2,3) # => [[1, 2, 3, 5, 7, 8, 10, 11, 13, 15, 16, 18, 21, 24, 25]]
34
+ Lotofacil::Raffle.new.generate(1,1,2,37,35,36) # => [[1, 2, 3, 4, 5, 6, 7, 10, 12, 13, 14, 17, 21, 24, 25]]
35
+ Lotofacil::Raffle.new.generate(1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16) # => [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]]
36
+
37
+ # Search last draw
38
+ Lotofacil.new.last_raffle # => {:date=>"30/11/2015", :number=>"1291", :number_raffle=>["01", "06", "07", "08", "10", "11", "12", "13", "15", "16", "18", "19", "20", "21", "24"]}
39
+ ```
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -1,30 +1,6 @@
1
- require 'httparty'
1
+ require "lotofacil/version"
2
+ require "lotofacil/raffle"
2
3
 
3
- class Lotofacil
4
- include HTTParty
4
+ module Lotofacil
5
5
 
6
- def generate(qtde = 1)
7
- (0..(qtde.to_i - 1)).map{raffle_number}
8
- end
9
-
10
- def last_raffle
11
- response = raffle["concurso"]
12
- response ? mount_response(response) : []
13
- end
14
- private
15
- def raffle_number
16
- Array(1..25).sample(15).sort
17
- end
18
-
19
- def raffle
20
- HTTParty.get('http://developers.agenciaideias.com.br/loterias/lotofacil/json')
21
- end
22
-
23
- def mount_response(response)
24
- {
25
- date: response["data"],
26
- number: response["numero"],
27
- number_raffle: response["numeros_sorteados"]
28
- }
29
- end
30
6
  end
Binary file
@@ -0,0 +1,28 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'lotofacil/version'
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = 'lotofacil'
8
+ s.version = Lotofacil::VERSION
9
+ s.date = '2015-12-08'
10
+ s.summary = "Lotofacil"
11
+ s.description = "Generate number of lotofacil"
12
+ s.authors = ["Fabio Augusto Lopes Toledo"]
13
+ s.email = 'fabiotoledo79@yahoo.com.br'
14
+ s.files = ["lib/lotofacil.rb"]
15
+ s.homepage =
16
+ 'http://rubygems.org/gems/lotofacil'
17
+ s.license = 'MIT'
18
+
19
+ s.files = `git ls-files -z`.split("\x0")
20
+ s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
21
+ s.test_files = s.files.grep(%r{^(test|spec|features)/})
22
+ s.require_paths = ["lib"]
23
+
24
+ s.add_development_dependency "bundler", "~> 1.10.6"
25
+ s.add_development_dependency "rake", "~> 10.0"
26
+ s.add_development_dependency "httparty", "~> 0.13.7"
27
+ s.add_development_dependency 'rspec'
28
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lotofacil
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fabio Augusto Lopes Toledo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-01 00:00:00.000000000 Z
11
+ date: 2015-12-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -52,13 +52,33 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: 0.13.7
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
55
69
  description: Generate number of lotofacil
56
70
  email: fabiotoledo79@yahoo.com.br
57
71
  executables: []
58
72
  extensions: []
59
73
  extra_rdoc_files: []
60
74
  files:
75
+ - Gemfile
76
+ - LICENSE.txt
77
+ - README.md
78
+ - Rakefile
61
79
  - lib/lotofacil.rb
80
+ - lotofacil-0.0.3.gem
81
+ - lotofacil.gemspec
62
82
  homepage: http://rubygems.org/gems/lotofacil
63
83
  licenses:
64
84
  - MIT