stockboy 0.5.2 → 0.5.3
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 +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +2 -0
- data/lib/stockboy/provider.rb +4 -0
- data/lib/stockboy/providers/file.rb +2 -0
- data/lib/stockboy/providers/imap.rb +5 -1
- data/lib/stockboy/readers/fixed_width.rb +1 -1
- data/lib/stockboy/version.rb +1 -1
- data/spec/stockboy/providers/imap_spec.rb +21 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eb1f195ac3153a82bc10d4985f7cac06ad7c97fb
|
4
|
+
data.tar.gz: 94b96d6c65df45a757c399bb3334785c0f6da5b9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e7d3de6209e842789170672068eea7c30d36d321e40c0f0fbab964200dd5d9c554d2823e08fa34a74475d1fbc1ecee9e841759f4f28e3f3c4cad4c3ec6c761f
|
7
|
+
data.tar.gz: 85bf156a0d0b8b3a3c3b4901d2ade3e7b8a960ae80f255dfbd2dd4d608d7471299b6c6f7c05300a587e62607eb7c8ac1b56287eb98c5123b48997b7e9a536706
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# Stockboy
|
2
2
|
|
3
3
|
[][gem]
|
4
|
+
[][gemnasium]
|
4
5
|
[][travis]
|
5
6
|
[][climate]
|
6
7
|
|
@@ -316,6 +317,7 @@ Contributions and pull requests are welcome.
|
|
316
317
|
[etl]: https://en.wikipedia.org/wiki/Extract,_transform,_load
|
317
318
|
[dsl]: https://en.wikipedia.org/wiki/Domain-specific_language
|
318
319
|
[travis]: https://travis-ci.org/avit/stockboy
|
320
|
+
[gemnasium]: https://gemnasium.com/avit/stockboy
|
319
321
|
[climate]: https://codeclimate.com/github/avit/stockboy
|
320
322
|
[rdoc]: http://rdoc.info/gems/stockboy/frames
|
321
323
|
[gem]: http://rubygems.org/gems/stockboy
|
data/lib/stockboy/provider.rb
CHANGED
@@ -221,6 +221,10 @@ module Stockboy
|
|
221
221
|
# @example
|
222
222
|
# since Date.today
|
223
223
|
#
|
224
|
+
|
225
|
+
# @!macro [new] provider.file_size_options
|
226
|
+
# @group Options
|
227
|
+
#
|
224
228
|
# @!attribute [rw] file_smaller
|
225
229
|
# Validates the maximum data size for the matched file, in bytes
|
226
230
|
# @return [Fixnum]
|
@@ -106,7 +106,11 @@ module Stockboy::Providers
|
|
106
106
|
# attachment "daily-report.csv"
|
107
107
|
# attachment /daily-report-[0-9]+.csv/
|
108
108
|
#
|
109
|
-
dsl_attr :attachment
|
109
|
+
dsl_attr :attachment, alias: :file_name
|
110
|
+
|
111
|
+
# @macro file_size_options
|
112
|
+
dsl_attr :file_smaller, alias: :smaller_than
|
113
|
+
dsl_attr :file_larger, alias: :larger_than
|
110
114
|
|
111
115
|
# Method for choosing which email message to process from potential
|
112
116
|
# matches. Default is last by date sent.
|
@@ -77,7 +77,7 @@ module Stockboy::Readers
|
|
77
77
|
|
78
78
|
def parse(data)
|
79
79
|
@column_widths, @column_keys = nil, nil
|
80
|
-
data.force_encoding
|
80
|
+
data.force_encoding(encoding) if encoding
|
81
81
|
data = StringIO.new(data) unless data.is_a? StringIO
|
82
82
|
skip_header_rows.times { data.readline }
|
83
83
|
records = data.reduce([]) do |a, row|
|
data/lib/stockboy/version.rb
CHANGED
@@ -13,6 +13,8 @@ module Stockboy
|
|
13
13
|
provider.subject = %r{New Records 20[1-9][0-9]-(0[1-9]|1[0-2])-([0-2][1-9]|3[0-1])}
|
14
14
|
provider.since = Date.new(2012,12,1)
|
15
15
|
provider.attachment = %r{data-[0-9]+\.csv}
|
16
|
+
provider.file_smaller = 1024**3
|
17
|
+
provider.file_larger = 1024
|
16
18
|
|
17
19
|
provider.host.should == "mail.localhost.test"
|
18
20
|
provider.username.should == "uuu"
|
@@ -21,13 +23,18 @@ module Stockboy
|
|
21
23
|
provider.subject.should == %r{New Records 20[1-9][0-9]-(0[1-9]|1[0-2])-([0-2][1-9]|3[0-1])}
|
22
24
|
provider.attachment.should == %r{data-[0-9]+\.csv}
|
23
25
|
provider.since.should == Date.new(2012,12,1)
|
26
|
+
provider.file_smaller.should == 1024**3
|
27
|
+
provider.file_larger.should == 1024
|
24
28
|
end
|
25
29
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
30
|
+
it "aliases since to newer_than" do
|
31
|
+
provider = Providers::IMAP.new{ |f| f.newer_than Date.new(2012,12,1) }
|
32
|
+
provider.since.should == Date.new(2012,12,1)
|
33
|
+
end
|
34
|
+
|
35
|
+
it "aliases file_smaller to smaller_than" do
|
36
|
+
provider = Providers::IMAP.new{ |f| f.smaller_than 1024**3 }
|
37
|
+
provider.file_smaller.should == 1024**3
|
31
38
|
end
|
32
39
|
|
33
40
|
describe ".new" do
|
@@ -36,8 +43,16 @@ module Stockboy
|
|
36
43
|
end
|
37
44
|
|
38
45
|
it "accepts block initialization" do
|
39
|
-
provider = Providers::IMAP.new
|
46
|
+
provider = Providers::IMAP.new do
|
47
|
+
host 'mail.test2.local'
|
48
|
+
attachment 'report.csv'
|
49
|
+
file_smaller 1024**3
|
50
|
+
file_larger 1024
|
51
|
+
end
|
40
52
|
provider.host.should == 'mail.test2.local'
|
53
|
+
provider.attachment.should == 'report.csv'
|
54
|
+
provider.file_smaller.should == 1024**3
|
55
|
+
provider.file_larger.should == 1024
|
41
56
|
end
|
42
57
|
end
|
43
58
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stockboy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Vit
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-12-
|
11
|
+
date: 2013-12-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|