uniform_invoice_lottery 0.0.1

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: 728eb49fd681530951104795ff66b88907e8954d
4
+ data.tar.gz: c8bba26b3f7e5bc1676cb94f36905f28877709b1
5
+ SHA512:
6
+ metadata.gz: 4f5e24b8c7a903895930dd89038c117a240b3a76d714c1f6fde2cbae5d9ec979bd9690bf8a047e0d1a1ca0491c2c415557fc9006a57b8e5fbddd8af8cbb48ddd
7
+ data.tar.gz: af439acaac9f51da3d5520bb8aba1301bd7ca61ec3ade5123633de05e9b756215e64f878177b6bb7712d16b7f3f3e0e01fe711debb2405c33b6d519c8a44c221
@@ -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/.pryrc ADDED
@@ -0,0 +1,3 @@
1
+ Pry.commands.alias_command 'c', 'continue'
2
+ Pry.commands.alias_command 's', 'step'
3
+ Pry.commands.alias_command 'n', 'next'
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in uniform_invoice_lottery.gemspec
4
+ gemspec
@@ -0,0 +1,11 @@
1
+ guard 'rspec', cmd: "bundle exec rspec" do
2
+ # watch /lib/ files
3
+ watch(%r{^lib/(.+).rb$}) do |m|
4
+ "spec/#{m[1]}_spec.rb"
5
+ end
6
+
7
+ # watch /spec/ files
8
+ watch(%r{^spec/(.+).rb$}) do |m|
9
+ "spec/#{m[1]}.rb"
10
+ end
11
+ end
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 Yukai Huang
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,61 @@
1
+ # UniformInvoiceLottery
2
+
3
+ 一個統一發票兌獎的 Gem,還有自動更新功能,還真不賴。自己說。
4
+
5
+ 還沒弄上 rubygems.org。
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'uniform_invoice_lottery'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install uniform_invoice_lottery
22
+
23
+ ## Usage
24
+
25
+ 回傳號碼結果字串,例如:
26
+ ```ruby
27
+ UniformInvoiceLottery.check '82930261', time: Time.new(2015, 7, 26)
28
+ ```
29
+
30
+ 嫌太長就這樣寫
31
+
32
+ ```ruby
33
+ uni_invoice = UniformInvoiceLottery
34
+ uni_invoice.check '82930261', time: Time.new(2015, 7, 26)
35
+ ```
36
+
37
+ 上面這段回傳 `"特別獎"`。
38
+
39
+
40
+ 總共有這幾個回傳值:
41
+
42
+ 特別獎
43
+ 特獎
44
+ 頭獎
45
+ 二獎
46
+ 三獎
47
+ 四獎
48
+ 五獎
49
+ 六獎
50
+ 增開六獎
51
+ 下次再來,兩個月後又是一條好漢
52
+
53
+ XD。
54
+
55
+ ## Contributing
56
+
57
+ 1. Fork it ( https://github.com/Yukaii/uniform_invoice_lottery/fork )
58
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
59
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
60
+ 4. Push to the branch (`git push origin my-new-feature`)
61
+ 5. Create a new Pull Request
@@ -0,0 +1,11 @@
1
+ require "bundler/gem_tasks"
2
+ require 'rspec/core/rake_task'
3
+
4
+ # Default directory to look in is `/specs`
5
+ # Run with `rake spec`
6
+ RSpec::Core::RakeTask.new(:spec) do |task|
7
+ task.rspec_opts = ['--color', '--format', 'nested']
8
+ end
9
+
10
+ task :default => :spec
11
+ require "bundler/gem_tasks"
@@ -0,0 +1,188 @@
1
+ ---
2
+ last_updated_at: '2015-07-26 15:58:30 +0800'
3
+ records:
4
+ - year: 104
5
+ start_month: 5
6
+ end_month: 6
7
+ so_special_price: '82930261'
8
+ special_price: '43540459'
9
+ head_prices:
10
+ - '82267055'
11
+ - '72762106'
12
+ - 06820335
13
+ additional_sixth_prices:
14
+ - '420'
15
+ - '523'
16
+ - '554'
17
+ - year: 104
18
+ start_month: 3
19
+ end_month: 4
20
+ so_special_price: '46492032'
21
+ special_price: '66224881'
22
+ head_prices:
23
+ - 06216938
24
+ - 04296940
25
+ - '86442491'
26
+ additional_sixth_prices:
27
+ - '306'
28
+ - '403'
29
+ - '867'
30
+ - year: 104
31
+ start_month: 1
32
+ end_month: 2
33
+ so_special_price: '60538935'
34
+ special_price: '50887710'
35
+ head_prices:
36
+ - '63856949'
37
+ - '39459262'
38
+ - '61944942'
39
+ additional_sixth_prices:
40
+ - '022'
41
+ - '355'
42
+ - 038
43
+ - year: 103
44
+ start_month: 11
45
+ end_month: 12
46
+ so_special_price: '33516538'
47
+ special_price: '18290129'
48
+ head_prices:
49
+ - '43772058'
50
+ - '44517895'
51
+ - '45226602'
52
+ additional_sixth_prices:
53
+ - '901'
54
+ - '659'
55
+ - '034'
56
+ - '955'
57
+ - year: 103
58
+ start_month: 9
59
+ end_month: 10
60
+ so_special_price: '22267127'
61
+ special_price: '31075480'
62
+ head_prices:
63
+ - '35396804'
64
+ - '15352117'
65
+ - '54709991'
66
+ additional_sixth_prices:
67
+ - '114'
68
+ - 068
69
+ - '476'
70
+ - '970'
71
+ - year: 103
72
+ start_month: 7
73
+ end_month: 8
74
+ so_special_price: '16256820'
75
+ special_price: '33378146'
76
+ head_prices:
77
+ - '92040881'
78
+ - '99971012'
79
+ - '70124883'
80
+ additional_sixth_prices:
81
+ - '998'
82
+ - '741'
83
+ - '833'
84
+ - '732'
85
+ - year: 103
86
+ start_month: 5
87
+ end_month: 6
88
+ so_special_price: '94761178'
89
+ special_price: '71959593'
90
+ head_prices:
91
+ - '36665808'
92
+ - '54185273'
93
+ - '18953944'
94
+ additional_sixth_prices:
95
+ - '347'
96
+ - '790'
97
+ - year: 103
98
+ start_month: 3
99
+ end_month: 4
100
+ so_special_price: '54544448'
101
+ special_price: '70349798'
102
+ head_prices:
103
+ - '76086228'
104
+ - '38205733'
105
+ - '17173614'
106
+ additional_sixth_prices:
107
+ - '692'
108
+ - '326'
109
+ - year: 103
110
+ start_month: 1
111
+ end_month: 2
112
+ so_special_price: '34231966'
113
+ special_price: '57287066'
114
+ head_prices:
115
+ - '29828540'
116
+ - '85564445'
117
+ - '39775689'
118
+ additional_sixth_prices:
119
+ - '478'
120
+ - '219'
121
+ - year: 102
122
+ start_month: 11
123
+ end_month: 12
124
+ so_special_price: '79599463'
125
+ special_price: '65421688'
126
+ head_prices:
127
+ - '10823414'
128
+ - '52261288'
129
+ - '59201577'
130
+ additional_sixth_prices:
131
+ - 048
132
+ - '913'
133
+ - year: 102
134
+ start_month: 9
135
+ end_month: 10
136
+ so_special_price: '46486534'
137
+ special_price: 06509701
138
+ head_prices:
139
+ - '73803836'
140
+ - '48342247'
141
+ - '12784009'
142
+ additional_sixth_prices:
143
+ - '316'
144
+ - '226'
145
+ - year: 102
146
+ start_month: 7
147
+ end_month: 8
148
+ so_special_price: '71895847'
149
+ special_price: 04949941
150
+ head_prices:
151
+ - 04532693
152
+ - '52951166'
153
+ - '82155062'
154
+ additional_sixth_prices:
155
+ - '715'
156
+ - year: 102
157
+ start_month: 5
158
+ end_month: 6
159
+ so_special_price: '40148354'
160
+ special_price: '64348046'
161
+ head_prices:
162
+ - '64782404'
163
+ - '88904036'
164
+ - '17250629'
165
+ additional_sixth_prices:
166
+ - '516'
167
+ - year: 102
168
+ start_month: 3
169
+ end_month: 4
170
+ so_special_price: '13393774'
171
+ special_price: '25894576'
172
+ head_prices:
173
+ - '43792479'
174
+ - 01973003
175
+ - '71347425'
176
+ additional_sixth_prices:
177
+ - '997'
178
+ - year: 102
179
+ start_month: 1
180
+ end_month: 2
181
+ so_special_price: '18623268'
182
+ special_price: '23322026'
183
+ head_prices:
184
+ - '55296725'
185
+ - '65713406'
186
+ - '44395947'
187
+ additional_sixth_prices:
188
+ - '436'
@@ -0,0 +1,26 @@
1
+ require "uniform_invoice_lottery/version"
2
+ require "uniform_invoice_lottery/data_crawler"
3
+ require "uniform_invoice_lottery/lottery_checker"
4
+ require "uniform_invoice_lottery/exceptions"
5
+
6
+ module UniformInvoiceLottery
7
+ ROOT_DIR = File.expand_path('..', __FILE__)
8
+ PRICE = {
9
+ "特別獎" => 10_000_000,
10
+ "特獎" => 2_000_000,
11
+ "頭獎" => 200_000,
12
+ "二獎" => 40_000,
13
+ "三獎" => 10_000,
14
+ "四獎" => 4_000,
15
+ "五獎" => 1_000,
16
+ "六獎" => 200,
17
+ "增開六獎" => 200,
18
+ "下次再來,兩個月後又是一條好漢" => 0,
19
+ }
20
+
21
+ class << self
22
+ def check invoice_code, opts={}
23
+ LotteryChecker.check(invoice_code, opts)
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,149 @@
1
+ require 'nokogiri'
2
+ require 'httpclient'
3
+ require 'json'
4
+ require 'yaml'
5
+
6
+ module UniformInvoiceLottery
7
+ module DataCrawler
8
+
9
+ class Crawler
10
+ attr_accessor :records, :last_updated_at
11
+
12
+ def crawl_lottery_data
13
+ # not record found
14
+ @doc = Nokogiri::HTML(client.get_content "http://www.etax.nat.gov.tw/etwmain/front/ETW183W1")
15
+ # lottery_lists = [
16
+ # ["ETW183W2?id=14c4f826ecb00000aae8b5c3346d4493", "104年01月、02月"],
17
+ # ["ETW183W2?id=14b1f79bc5700000a9ef78b1708be70d", "103年11月、12月"],
18
+ # ["ETW183W2?id=149e58cdb5a00000d2d54a98932994cb", "103年09月、10月"],
19
+ # ...
20
+ # ]
21
+ lottery_lists = @doc.css('#searchForm a').map{|node| [node[:href], node.text]}.select{|arr| !!arr[1].match(/(?<year>\d+)年(?<m1>\d+)月、(?<m2>\d+)月/)}
22
+
23
+ threads = []
24
+
25
+ lottery_lists.each do |lot|
26
+ threads << Thread.new do
27
+ doc = Nokogiri::HTML(client.get_content("http://www.etax.nat.gov.tw/etwmain/front/#{lot[0]}").to_s.force_encoding('utf-8'))
28
+ rows = doc.css('table.table_b tr')
29
+
30
+ m = doc.css('h4').text.match(/(?<year>\d+)年(?<m1>\d+)月、(?<m2>\d+)月/)
31
+ year = m[:year].to_i
32
+ start_month = m[:m1].to_i
33
+ end_month = m[:m2].to_i
34
+ so_special_price = rows.xpath(td_xpath "特別獎" ).text.strip
35
+ special_price = rows.xpath(td_xpath "特獎" ).text.strip
36
+ head_prices = rows.xpath(td_xpath "頭獎" ).text.strip.split('、')
37
+ additional_sixth_prices = rows.xpath(td_xpath "增開六獎" ).text.strip.split('、')
38
+
39
+ records << {
40
+ "year" => year,
41
+ "start_month" => start_month,
42
+ "end_month" => end_month,
43
+ "so_special_price" => so_special_price,
44
+ "special_price" => special_price,
45
+ "head_prices" => head_prices,
46
+ "additional_sixth_prices" => additional_sixth_prices,
47
+ }
48
+ end # Thread.new do
49
+ end # lottery_lists.each
50
+
51
+ threads.map(&:join)
52
+
53
+ sort_record!
54
+ records
55
+ end # crawl_lottery_data
56
+
57
+ def sort_record!
58
+ @records = @records.sort_by{ |rec| "#{rec["year"]}#{rec["end_month"].to_s.rjust(2, "0")}".to_i }.reverse!
59
+ end
60
+
61
+ def td_xpath(th)
62
+ return "\/\/th\[.=\"#{th}\"\]\/ancestor::tr\/td"
63
+ end
64
+
65
+ def records
66
+ @records ||= []
67
+ end
68
+
69
+ private
70
+ def client
71
+ @client ||= HTTPClient.new
72
+ end
73
+ end
74
+
75
+ class << self
76
+
77
+ def refresh
78
+ crawler.crawl_lottery_data
79
+ save_record
80
+ crawler.records
81
+ end
82
+
83
+ def records
84
+ load
85
+ crawler.records
86
+ end
87
+
88
+ def get_draw_month time=Time.now
89
+ if time.month % 2 == 1
90
+ if time.day >= 25 # 奇數月開獎後那幾天
91
+ return time.month
92
+ else
93
+ return time.month-2 < 0 ? (time.month-2 + 12) : time.month-2
94
+ end
95
+ else # 偶數月
96
+ return time.month-1
97
+ end
98
+ end
99
+
100
+ def get_lottery_months draw_month=get_draw_month
101
+ # draw_month = get_draw_month(draw_month) if draw_month % 2 == 0
102
+ raise InvalidLotteryMonthError, "奇數月開獎" if draw_month % 2 == 0
103
+ return (draw_month-2 + 12)%12, (draw_month-2 + 12)%12 + 1
104
+ end
105
+
106
+ private
107
+
108
+ def load
109
+ if load_record
110
+
111
+ srt_month, end_month = get_lottery_months
112
+ year = Time.now.year - 1911
113
+ return if crawler.last_updated_at && crawler.records && !crawler.records.empty? &&
114
+ !crawler.records.find{ |rec|
115
+ rec["year"] == year && rec["start_month"] == srt_month && rec["end_month"] == end_month
116
+ }.nil?
117
+ end
118
+
119
+ crawler.crawl_lottery_data
120
+ save_record
121
+ end
122
+
123
+ def load_record dir=ROOT_DIR
124
+ filepath = File.join(dir, 'record.yaml')
125
+ return false if !File.exists?(filepath)
126
+
127
+ data = YAML.load(File.read(File.join(dir, 'record.yaml')))
128
+
129
+ crawler.last_updated_at = Time.parse data["last_updated_at"]
130
+ crawler.records = data["records"]
131
+
132
+ true
133
+ end
134
+
135
+ def save_record dir=ROOT_DIR
136
+ data = {
137
+ "last_updated_at" => Time.now.to_s,
138
+ "records" => crawler.records
139
+ }
140
+ File.write(File.join(dir, 'record.yaml'), data.to_yaml)
141
+ end
142
+
143
+ def crawler
144
+ @@crawler ||= Crawler.new
145
+ end
146
+
147
+ end # end class << self
148
+ end
149
+ end
@@ -0,0 +1,5 @@
1
+ module UniformInvoiceLottery
2
+ class Error < StandardError; end
3
+
4
+ class InvalidLotteryMonthError < StandardError; end
5
+ end
@@ -0,0 +1,45 @@
1
+ module UniformInvoiceLottery
2
+ module LotteryChecker
3
+ class << self
4
+ def check invoice_code, opts={}
5
+
6
+ # option handling
7
+ if opts.is_a? Hash
8
+ options = %i(time year month day)
9
+ opts = Hash[opts.map{|k, v| [k.to_sym, v]}]
10
+
11
+ # white list =w=
12
+ opts = Hash[options.zip(opts.values_at(*options))]
13
+
14
+ opts.each{|k, v| instance_variable_set("@#{k}", v) }
15
+ end
16
+
17
+ @time ||= Time.new(@year, @month, @day) if @year && @month && @day
18
+ @time ||= Time.now
19
+
20
+ @start_month, @end_month = DataCrawler.get_lottery_months(DataCrawler.get_draw_month(@time))
21
+
22
+ record = DataCrawler.records.find{|rec| rec["year"] == @time.year-1911 && rec["start_month"] == @start_month && rec["end_month"] == @end_month }
23
+
24
+ return "Lottery Data not Found" if record.nil?
25
+
26
+ record.each{|k, v| instance_variable_set("@#{k}", v) }
27
+
28
+ return "錯誤" if @so_special_price.nil? || @special_price.nil? || @head_prices.nil? || @additional_sixth_prices.nil?
29
+ return "特別獎" if invoice_code == @so_special_price
30
+ return "特獎" if invoice_code == @special_price
31
+
32
+ @head_prices.each{|head| return "頭獎" if invoice_code == head }
33
+ @head_prices.each{|head| return "二獎" if invoice_code[1..-1] == head[1..-1] }
34
+ @head_prices.each{|head| return "三獎" if invoice_code[2..-1] == head[2..-1] }
35
+ @head_prices.each{|head| return "四獎" if invoice_code[3..-1] == head[3..-1] }
36
+ @head_prices.each{|head| return "五獎" if invoice_code[4..-1] == head[4..-1] }
37
+ @head_prices.each{|head| return "六獎" if invoice_code[5..-1] == head[5..-1] }
38
+
39
+ @additional_sixth_prices.each{|six| return "增開六獎" if invoice_code[-3..-1] == six}
40
+
41
+ return "下次再來,兩個月後又是一條好漢"
42
+ end
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,3 @@
1
+ module UniformInvoiceLottery
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,36 @@
1
+ require 'spec_helper'
2
+ require 'uniform_invoice_lottery'
3
+
4
+ describe UniformInvoiceLottery::DataCrawler do
5
+
6
+ let(:data_crawler) {
7
+ UniformInvoiceLottery::DataCrawler
8
+ }
9
+
10
+ describe "test DataCrawler module" do
11
+ it "should have DataCrawler sub module" do
12
+ records = data_crawler.records
13
+
14
+ expect(records.class).to eq(Array)
15
+
16
+ unless records.empty?
17
+ expect(records.first.class).to eq(Hash)
18
+ %w(year start_month end_month so_special_price special_price head_prices additional_sixth_prices).each {|k|
19
+ expect(records.first).to have_key(k)
20
+ }
21
+ end
22
+ end
23
+
24
+ it "should calculate correct lottery month" do
25
+ expect(data_crawler.get_draw_month( Time.new(2015, 1, 15) )).to eq(11)
26
+ expect(data_crawler.get_draw_month( Time.new(2015, 1, 25) )).to eq( 1)
27
+ expect(data_crawler.get_draw_month( Time.new(2015, 2, 28) )).to eq( 1)
28
+
29
+ expect(data_crawler.get_lottery_months(3)).to eq([1,2])
30
+ expect(data_crawler.get_lottery_months(1)).to eq([11,12])
31
+ # 奇數月開獎的說
32
+ expect{ data_crawler.get_lottery_months(2) }.to raise_error(UniformInvoiceLottery::InvalidLotteryMonthError)
33
+ end
34
+ end
35
+
36
+ end
@@ -0,0 +1,17 @@
1
+ $LOAD_PATH << File.join(File.dirname(__FILE__), "..", "lib")
2
+
3
+ require 'pry'
4
+ require 'simplecov'
5
+
6
+ SimpleCov.start
7
+
8
+ RSpec.configure do |config|
9
+ # Use color in STDOUT
10
+ config.color = true
11
+
12
+ # Use color not only in STDOUT but also in pagers and files
13
+ config.tty = true
14
+
15
+ # Use the specified formatter
16
+ config.formatter = :documentation # :progress, :html, :textmate
17
+ end
@@ -0,0 +1,8 @@
1
+ require 'spec_helper'
2
+ require 'uniform_invoice_lottery'
3
+
4
+ describe UniformInvoiceLottery do
5
+ it "can check lottery" do
6
+ expect(UniformInvoiceLottery.check('82930261', time: Time.new(2015, 7, 26))).to eq("特別獎")
7
+ end
8
+ end
@@ -0,0 +1,36 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'uniform_invoice_lottery/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "uniform_invoice_lottery"
8
+ spec.version = UniformInvoiceLottery::VERSION
9
+ spec.authors = ["Yukai Huang"]
10
+ spec.email = ["yukaihuang1993@hotmail.com"]
11
+ spec.summary = %q{一個統一發票的查詢、兌獎 gem}
12
+ spec.description = %q{一個統一發票的查詢、兌獎 gem}
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_development_dependency "rspec", "~> 3.3"
24
+ spec.add_development_dependency "rspec-nc", "~> 0.2"
25
+ spec.add_development_dependency "guard", "~> 2.13"
26
+ spec.add_development_dependency "guard-rspec", "~> 4.6"
27
+ spec.add_development_dependency "growl", "~> 1.0"
28
+ spec.add_development_dependency "pry", "~> 0.10"
29
+ spec.add_development_dependency "pry-remote", "~> 0.1"
30
+ spec.add_development_dependency "pry-nav", "~> 0.2"
31
+ spec.add_development_dependency "simplecov", "~> 0.10"
32
+
33
+ spec.add_runtime_dependency "httpclient", "~> 2.6"
34
+ spec.add_runtime_dependency "nokogiri", "~> 1.6"
35
+
36
+ end
metadata ADDED
@@ -0,0 +1,246 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: uniform_invoice_lottery
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Yukai Huang
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-09-07 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: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.3'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.3'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec-nc
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '0.2'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '0.2'
69
+ - !ruby/object:Gem::Dependency
70
+ name: guard
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '2.13'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '2.13'
83
+ - !ruby/object:Gem::Dependency
84
+ name: guard-rspec
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '4.6'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '4.6'
97
+ - !ruby/object:Gem::Dependency
98
+ name: growl
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '1.0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '1.0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: pry
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '0.10'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '0.10'
125
+ - !ruby/object:Gem::Dependency
126
+ name: pry-remote
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: '0.1'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: '0.1'
139
+ - !ruby/object:Gem::Dependency
140
+ name: pry-nav
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: '0.2'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: '0.2'
153
+ - !ruby/object:Gem::Dependency
154
+ name: simplecov
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - "~>"
158
+ - !ruby/object:Gem::Version
159
+ version: '0.10'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - "~>"
165
+ - !ruby/object:Gem::Version
166
+ version: '0.10'
167
+ - !ruby/object:Gem::Dependency
168
+ name: httpclient
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - "~>"
172
+ - !ruby/object:Gem::Version
173
+ version: '2.6'
174
+ type: :runtime
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - "~>"
179
+ - !ruby/object:Gem::Version
180
+ version: '2.6'
181
+ - !ruby/object:Gem::Dependency
182
+ name: nokogiri
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - "~>"
186
+ - !ruby/object:Gem::Version
187
+ version: '1.6'
188
+ type: :runtime
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - "~>"
193
+ - !ruby/object:Gem::Version
194
+ version: '1.6'
195
+ description: "一個統一發票的查詢、兌獎 gem"
196
+ email:
197
+ - yukaihuang1993@hotmail.com
198
+ executables: []
199
+ extensions: []
200
+ extra_rdoc_files: []
201
+ files:
202
+ - ".gitignore"
203
+ - ".pryrc"
204
+ - Gemfile
205
+ - Guardfile
206
+ - LICENSE.txt
207
+ - README.md
208
+ - Rakefile
209
+ - lib/record.yaml
210
+ - lib/uniform_invoice_lottery.rb
211
+ - lib/uniform_invoice_lottery/data_crawler.rb
212
+ - lib/uniform_invoice_lottery/exceptions.rb
213
+ - lib/uniform_invoice_lottery/lottery_checker.rb
214
+ - lib/uniform_invoice_lottery/version.rb
215
+ - spec/data_crawler_spec.rb
216
+ - spec/spec_helper.rb
217
+ - spec/uniform_invoice_lottery_spec.rb
218
+ - uniform_invoice_lottery.gemspec
219
+ homepage: ''
220
+ licenses:
221
+ - MIT
222
+ metadata: {}
223
+ post_install_message:
224
+ rdoc_options: []
225
+ require_paths:
226
+ - lib
227
+ required_ruby_version: !ruby/object:Gem::Requirement
228
+ requirements:
229
+ - - ">="
230
+ - !ruby/object:Gem::Version
231
+ version: '0'
232
+ required_rubygems_version: !ruby/object:Gem::Requirement
233
+ requirements:
234
+ - - ">="
235
+ - !ruby/object:Gem::Version
236
+ version: '0'
237
+ requirements: []
238
+ rubyforge_project:
239
+ rubygems_version: 2.4.5
240
+ signing_key:
241
+ specification_version: 4
242
+ summary: "一個統一發票的查詢、兌獎 gem"
243
+ test_files:
244
+ - spec/data_crawler_spec.rb
245
+ - spec/spec_helper.rb
246
+ - spec/uniform_invoice_lottery_spec.rb