quandl_data 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/UPGRADE.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## 1.1.0
2
+
3
+ * it rejects invalid transforms
4
+ * it rejects invalid collapse
5
+
1
6
  ## 1.0.0
2
7
 
3
8
  * Quandl::Data::Table is removed. Replaced by: Quandl::Data
@@ -118,6 +118,7 @@ module Quandl::Data::Operations
118
118
  self
119
119
  end
120
120
  def transform=(value)
121
+ return false unless Transform.valid?(value)
121
122
  @transform = value
122
123
  @data_array = Transform.perform( data_array, value )
123
124
  end
@@ -128,6 +129,7 @@ module Quandl::Data::Operations
128
129
  self
129
130
  end
130
131
  def collapse=(collapse)
132
+ return false unless Collapse.valid?(collapse)
131
133
  @collapse = collapse
132
134
  @frequency = collapse
133
135
  @data_array = Collapse.perform( data_array, collapse )
@@ -1,5 +1,5 @@
1
1
  module Quandl
2
2
  class Data
3
- VERSION = "1.0.0"
3
+ VERSION = "1.1.0"
4
4
  end
5
5
  end
@@ -2,11 +2,25 @@
2
2
  require 'spec_helper'
3
3
 
4
4
  describe Quandl::Data do
5
- subject { Quandl::Fabricate::Data.rand( nils: false, rows: 4, columns: 4 ) }
5
+ let(:data){ Quandl::Fabricate::Data.rand( nils: false, rows: 4, columns: 4 ) }
6
+ subject { data }
6
7
 
7
8
  its(:to_h){ should be_a Hash }
8
9
  its(:count){ should eq 4 }
10
+
11
+ describe "#collapse=" do
9
12
 
13
+ it "should collapse to monthly" do
14
+ subject.collapse(:monthly).count.should eq 1
15
+ end
16
+
17
+ it "should reject invalid collapse" do
18
+ subject.collapse(:invalid)
19
+ subject.collapse.should_not eq :invalid
20
+ end
21
+
22
+ end
23
+
10
24
  it "should parse csv" do
11
25
  Quandl::Data.new(subject.to_csv).count.should eq 4
12
26
  end
@@ -24,6 +38,12 @@ describe Quandl::Data do
24
38
  end
25
39
 
26
40
  describe "#transform" do
41
+
42
+ it "should reject invalid transform" do
43
+ subject.transform(:invalid)
44
+ subject.transform.should_not eq :invalid
45
+ end
46
+
27
47
  it "should rdiff" do
28
48
  value = subject.first[1]
29
49
  subject.transform(:rdiff).first[1].should_not eq value
@@ -38,10 +58,6 @@ describe Quandl::Data do
38
58
  end
39
59
  end
40
60
 
41
- it "should collapse the data" do
42
- subject.collapse(:monthly).count.should eq 1
43
- end
44
-
45
61
  it "should limit the data" do
46
62
  subject.limit(2).count.should eq 2
47
63
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: quandl_data
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: