quandl_operation 0.1.7 → 0.1.8

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.
data/UPGRADE.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## 0.8
2
+
3
+ * add Collapse.collapses_greater_than_or_equal_to(freq) add Collapse.collapses_greater_than(freq)
4
+
5
+ ## 0.7
6
+
7
+ * date start_of_frequency given invalid input should return the date
8
+
1
9
  ## 0.1
2
10
 
3
11
  Initial
@@ -22,6 +22,10 @@ class Collapse
22
22
  end
23
23
 
24
24
  def valid_collapse?(type)
25
+ valid?(type)
26
+ end
27
+
28
+ def valid?(type)
25
29
  valid_collapses.include?( type.try(:to_sym) )
26
30
  end
27
31
 
@@ -57,6 +61,15 @@ class Collapse
57
61
  end
58
62
  end
59
63
 
64
+ def collapses_greater_than(freq)
65
+ index = valid_collapses.index(freq.to_sym)
66
+ index.present? ? valid_collapses.slice( index + 1, valid_collapses.count ) : []
67
+ end
68
+
69
+ def collapses_greater_than_or_equal_to(freq)
70
+ valid_collapses.slice( valid_collapses.index(freq.to_sym), valid_collapses.count )
71
+ end
72
+
60
73
  def frequency?(data)
61
74
  Guess.frequency(data)
62
75
  end
@@ -19,6 +19,10 @@ class Transform
19
19
  end
20
20
 
21
21
  def valid_transformation?(type)
22
+ valid?(type)
23
+ end
24
+
25
+ def valid?(type)
22
26
  valid_transformations.include?( type.try(:to_sym) )
23
27
  end
24
28
 
@@ -1,5 +1,5 @@
1
1
  module Quandl
2
2
  module Operation
3
- VERSION = "0.1.7"
3
+ VERSION = "0.1.8"
4
4
  end
5
5
  end
@@ -0,0 +1,38 @@
1
+ # encoding: utf-8
2
+ require 'spec_helper'
3
+
4
+ describe Quandl::Operation::Collapse do
5
+
6
+ subject { Quandl::Operation::Collapse }
7
+
8
+ it { should respond_to :perform }
9
+
10
+ its(:valid_collapses){ should include :daily }
11
+ its(:valid_collapses){ should include :weekly }
12
+ its(:valid_collapses){ should include :monthly }
13
+
14
+ it "should return collapses_greater_than :weekly" do
15
+ subject.collapses_greater_than(:weekly).should eq [:monthly, :quarterly, :annual]
16
+ end
17
+
18
+ it "should return collapses_greater_than_or_equal_to :weekly" do
19
+ subject.collapses_greater_than_or_equal_to(:weekly).should eq [:weekly, :monthly, :quarterly, :annual]
20
+ end
21
+
22
+ it "should return collapses_greater_than :daily" do
23
+ subject.collapses_greater_than(:daily).should eq [:weekly, :monthly, :quarterly, :annual]
24
+ end
25
+
26
+ it "should return collapses_greater_than_or_equal_to :daily" do
27
+ subject.collapses_greater_than_or_equal_to(:daily).should eq [:daily, :weekly, :monthly, :quarterly, :annual]
28
+ end
29
+
30
+ it "should return collapses_greater_than :annual" do
31
+ subject.collapses_greater_than(:annual).should eq []
32
+ end
33
+
34
+ it "should return collapses_greater_than_or_equal_to :annual" do
35
+ subject.collapses_greater_than_or_equal_to(:annual).should eq [:annual]
36
+ end
37
+
38
+ end
File without changes
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: quandl_operation
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-08-07 00:00:00.000000000 Z
12
+ date: 2013-09-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -119,9 +119,9 @@ files:
119
119
  - lib/quandl/operation/transform.rb
120
120
  - lib/quandl/operation/version.rb
121
121
  - quandl_operation.gemspec
122
- - spec/quandl/operation/collapse_spec.rb
123
- - spec/quandl/operation/date_spec.rb
124
- - spec/quandl/operation/transform_spec.rb
122
+ - spec/lib/quandl/operation/collapse_spec.rb
123
+ - spec/lib/quandl/operation/date_spec.rb
124
+ - spec/lib/quandl/operation/transform_spec.rb
125
125
  - spec/spec_helper.rb
126
126
  homepage: http://blake.hilscher.ca/
127
127
  licenses:
@@ -149,7 +149,7 @@ signing_key:
149
149
  specification_version: 3
150
150
  summary: For altering data
151
151
  test_files:
152
- - spec/quandl/operation/collapse_spec.rb
153
- - spec/quandl/operation/date_spec.rb
154
- - spec/quandl/operation/transform_spec.rb
152
+ - spec/lib/quandl/operation/collapse_spec.rb
153
+ - spec/lib/quandl/operation/date_spec.rb
154
+ - spec/lib/quandl/operation/transform_spec.rb
155
155
  - spec/spec_helper.rb
@@ -1,14 +0,0 @@
1
- # encoding: utf-8
2
- require 'spec_helper'
3
-
4
- describe Quandl::Operation::Collapse do
5
-
6
- subject { Quandl::Operation::Collapse }
7
-
8
- it { should respond_to :perform }
9
-
10
- its(:valid_collapses){ should include :daily }
11
- its(:valid_collapses){ should include :weekly }
12
- its(:valid_collapses){ should include :monthly }
13
-
14
- end