stockboy 0.5.2 → 0.5.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e9f39ab2f4181e4a6bc9856318ae586c1ad63502
4
- data.tar.gz: d182b13648a082b1adf6a50a9c4c96c208f33501
3
+ metadata.gz: eb1f195ac3153a82bc10d4985f7cac06ad7c97fb
4
+ data.tar.gz: 94b96d6c65df45a757c399bb3334785c0f6da5b9
5
5
  SHA512:
6
- metadata.gz: 4037153d318abe04dcd6aa2abfbe5c15e3c7ea7658b3f72bdefccf201f5092aecf94f4f2cf680421c75d75e12467608bac8aa8c3c293001959e560f30b880272
7
- data.tar.gz: 74f16a90d396df9f7c4cea5f7ae67319553bbd577001c4dce6417a63569095fb2cfefc067c6b74d6305fb9d8c922f4ec3408e9a61b1d8198dae081ee9ce87d7c
6
+ metadata.gz: 4e7d3de6209e842789170672068eea7c30d36d321e40c0f0fbab964200dd5d9c554d2823e08fa34a74475d1fbc1ecee9e841759f4f28e3f3c4cad4c3ec6c761f
7
+ data.tar.gz: 85bf156a0d0b8b3a3c3b4901d2ade3e7b8a960ae80f255dfbd2dd4d608d7471299b6c6f7c05300a587e62607eb7c8ac1b56287eb98c5123b48997b7e9a536706
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.5.3 / 2013-12-04
4
+
5
+ [BUGFIX] Fix broken encoding option in fixed-width reader
6
+ [BUGFIX] Fix missing IMAP attachment validation DSL options
7
+
3
8
  ## 0.5.2 / 2013-12-04
4
9
 
5
10
  [BUGFIX] Registered :string translation that was missed
data/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # Stockboy
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/stockboy.png)][gem]
4
+ [![Dependency Status](https://gemnasium.com/avit/stockboy.png)][gemnasium]
4
5
  [![Build Status](https://travis-ci.org/avit/stockboy.png)][travis]
5
6
  [![Code Climate](https://codeclimate.com/github/avit/stockboy.png)][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
@@ -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]
@@ -25,6 +25,8 @@ module Stockboy::Providers
25
25
  dsl_attr :file_name
26
26
  dsl_attr :file_dir
27
27
  dsl_attr :file_newer, alias: :since
28
+
29
+ # @macro provider.file_size_options
28
30
  dsl_attr :file_smaller
29
31
  dsl_attr :file_larger
30
32
 
@@ -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!(encoding) if 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|
@@ -1,3 +1,3 @@
1
1
  module Stockboy
2
- VERSION = "0.5.2"
2
+ VERSION = "0.5.3"
3
3
  end
@@ -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
- describe "deprecated options", pending: "implement deprecated_alias" do
27
- it "promotes since instead of newer_than" do
28
- provider = Providers::IMAP.new{ |f| f.newer_than Date.new(2012,12,1) }
29
- provider.since.should == Date.new(2012,12,1)
30
- end
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{ |f| f.host 'mail.test2.local' }
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.2
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-04 00:00:00.000000000 Z
11
+ date: 2013-12-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake