quandl_cassandra_models 0.3.6 → 0.3.7

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: d22ebaef57fca90a9ffab18635ffb33f6cf4d85b
4
- data.tar.gz: f9e5c8ab3b033b3478551e6833568c9e4b8c1bcf
3
+ metadata.gz: aed3773469f277df0b8e8eabd8a23dee5f7aeecd
4
+ data.tar.gz: 0e3a85bbe925f1c1ac37d1cde9f117067e6b3c88
5
5
  SHA512:
6
- metadata.gz: 9a59a536e6e8d8ca42f090a12606c30eb1758c1bc64018103aa1434af78f40b66dda50c3a21ced85212c71d03ac20606def5841844815880a5aefeed8ff3e037
7
- data.tar.gz: b0a5d4a870bcbc01e157c0e56371ea4373a1bde000276f67ed43bc55b6f181097992bacf8fc0617dfa41072377dd913111a5048e8cb52c18a88f9aedba673c67
6
+ metadata.gz: f5a9cf178b53e5c5dcf03f73eceb8b5eba7d3665a1e7f03b7e8fb0576c84986625a60ef348c303d6351f5a46357f01facaf962922633e2cd3d9d80e4862b7f71
7
+ data.tar.gz: 24227cf92fcdd8bbea8c67706f38291a018cb00fcf45621b8af18d32eec0c61361fba6d7f32d507cb3e961943aa337a65131c8853d1141c6898ad2aaced8bbc1
data/UPGRADE.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## 0.3.7
2
+
3
+ * write specs for row=index with frequencies
4
+
5
+
1
6
  ## 0.3.5
2
7
 
3
8
  * fixes quandl/wikiposit#417
@@ -9,7 +9,7 @@ class Quandl::Cassandra::Models::Column::Read::Collapse < Quandl::Cassandra::Mod
9
9
 
10
10
  def select_column_frequencies
11
11
  freqs = Quandl::Cassandra::Models::ColumnAttribute.where( id: column_ids ).select(:id, :frequency).to_a
12
- column_ids.collect{|id| freqs.detect{|f| f['id'] == id }.try(:[], 'frequency') }
12
+ column_ids.collect{|id| freqs.detect{|f| f['id'] == id }.try(:[], 'frequency') }.collect(&:to_sym)
13
13
  end
14
14
 
15
15
  def build_column_collapses_using_frequencies(freqs, collapse)
@@ -51,9 +51,6 @@ class Quandl::Cassandra::Models::Column::Read::Offset < Quandl::Cassandra::Model
51
51
  end
52
52
 
53
53
  def accuracy_with_limit
54
- # # short circuit for now
55
- # return 0
56
- # revist this at a later date:
57
54
  awl = accuracy
58
55
  awl = awl + limit - 1 if limit && limit > 0
59
56
  awl
@@ -17,8 +17,8 @@ class Quandl::Cassandra::Models::Column < Quandl::Cassandra::Base
17
17
 
18
18
  def find_max_time_by_ids(ids, collapses, order)
19
19
  unique = collapses.uniq.count == 1
20
- time = find_max_time_by_ids_and_collapse(ids, collapses.first, "DESC") if unique
21
- time = find_max_time_by_ids_and_collapses(ids, collapses, "DESC") unless unique
20
+ time = find_max_time_by_ids_and_collapse(ids, collapses.first, order) if unique
21
+ time = find_max_time_by_ids_and_collapses(ids, collapses, order) unless unique
22
22
  Date.jd(time) if time.is_a?(Integer)
23
23
  end
24
24
 
@@ -1,7 +1,7 @@
1
1
  module Quandl
2
2
  module Cassandra
3
3
  module Models
4
- VERSION = '0.3.6'
4
+ VERSION = '0.3.7'
5
5
  end
6
6
  end
7
7
  end
@@ -1,27 +1,43 @@
1
1
  # encoding: utf-8
2
2
  require 'spec_helper'
3
3
 
4
- describe Quandl::Cassandra::Models::Column::Write do
4
+ describe Quandl::Cassandra::Models::Column do
5
5
 
6
6
  let(:id){ rand(10000*10000) + 10000*10000 }
7
- let(:data){ Quandl::Fabricate::Data.rand( columns: 1, rows: 15, nils: false, frequency: :annual ) }
8
- before(:each){ Quandl::Cassandra::Models::Column.write( id: id, data: data ) }
9
7
 
10
- attrs = {}
11
- {
12
- transform: :rdiff,
13
- collapse: :annual,
14
- row: 0,
15
- column: 1,
16
- }.each do |key, value|
17
- attrs[key] = value
18
- it "should read #{attrs.to_query}" do
19
- attrs[:id] = id
20
- attrs[:column_ids] = Quandl::Cassandra::Dataset.find(id).column_ids
21
- Quandl::Cassandra::Models::Column.read(attrs).should be_present
8
+ describe ".read" do
9
+ context "data presence" do
10
+
11
+ let(:data){ Quandl::Fabricate::Data.rand( columns: 1, rows: 15, nils: false, frequency: :annual ) }
12
+ before(:each){ Quandl::Cassandra::Models::Column.write( id: id, data: data ) }
13
+
14
+ attrs = {}
15
+ { transform: :rdiff, collapse: :annual, row: 0, column: 1 }.each do |key, value|
16
+ attrs[key] = value
17
+ it "should read #{attrs.to_query}" do
18
+ attrs[:id] = id
19
+ attrs[:column_ids] = Quandl::Cassandra::Dataset.find(id).column_ids
20
+ Quandl::Cassandra::Models::Column.read(attrs).should be_present
21
+ end
22
+ end
22
23
  end
23
-
24
+
25
+ [:daily, :weekly, :monthly, :quarterly, :annual].each do |frequency|
26
+ context "data #{frequency}" do
27
+
28
+ let(:data){ Quandl::Fabricate::Data.rand( columns: 1, rows: 15, nils: false, frequency: frequency ) }
29
+ before(:each){ Quandl::Cassandra::Models::Column.write( id: id, data: data ) }
30
+
31
+ [-4, -1, 0, 3].each do |row_index|
32
+ it "should read row=#{row_index}" do
33
+ expected_date = data[row_index][0]
34
+ Quandl::Cassandra::Models::Column.read({ id: id, row: row_index })[0][0].should eq expected_date
35
+ end
36
+ end
37
+
38
+ end
39
+ end
40
+
24
41
  end
25
-
26
42
 
27
43
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: quandl_cassandra_models
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.6
4
+ version: 0.3.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Blake Hilscher