quandl_format 0.1.6 → 0.1.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: 3d570d30030c6efc98ca36991c9f7bd696ef1b06
4
- data.tar.gz: a3055d3a66e3189abdee26cc3cd30454c78919aa
3
+ metadata.gz: 5f454dd17f3f3d71afa6ecda800df054fcc52f27
4
+ data.tar.gz: 04b4dab5f31e57b2f7c6e6af810e952fe25524ae
5
5
  SHA512:
6
- metadata.gz: 65deb544f8ff59f3cb623cfa0672319c48b39a5243e20837d196ce8057eb3523a7908d4bbd801a14b796de6d47ba88a7c09e82c97a507357774018c7b6a92d1a
7
- data.tar.gz: cd66e027d2cbfa58b0e6e23b1b1369891101053715fe046de229c4202f8ac5a39d6737629a4954d97eba5bf1d23f217345cc4a071b30cfeafb4ed896416dcab9
6
+ metadata.gz: 75af0ccda893f85cc46719d1fadf2ddfa65b6abef92075ecddcc098ba4f7c1ed7ea1ba5b031223f523921293639b5d313ace67ec55a28bf0c132bad20f11d78e
7
+ data.tar.gz: cb56897d0c1ec4b625708a85917ecc88efba46d6576d4576812679822b466d436736542944890303d44741f1f04f502da709adce8ecbcff45b0a9509326b8a2f
data/UPGRADE.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## 0.1.7
2
+
3
+ * Accept tabular data
4
+
5
+
1
6
  ## 0.1.6
2
7
 
3
8
  * refactor errors to include specific line numbers
@@ -60,7 +60,7 @@ class Quandl::Format::Dataset::Load
60
60
  # we cant continue unless attributes are present
61
61
  next if node[:attributes].blank?
62
62
  # parse data as csv
63
- node[:attributes][:data] = CSV.parse(node[:data])
63
+ node[:attributes][:data] = Quandl::Data::Format.csv_to_array(node[:data])
64
64
  # onwards
65
65
  output << node
66
66
  end
@@ -1,5 +1,5 @@
1
1
  module Quandl
2
2
  module Format
3
- VERSION = "0.1.6"
3
+ VERSION = "0.1.7"
4
4
  end
5
5
  end
@@ -0,0 +1,8 @@
1
+ code: TABULAR
2
+ name: This is tabular
3
+ description: This data is tabular!
4
+ -
5
+ Date First Second Third Fourth
6
+ 2013 10 20 30 40
7
+ 2012 20 30 40 50
8
+ 2011 30 40 50 60
@@ -5,11 +5,11 @@ describe Quandl::Format::Dataset do
5
5
  expected_errors = [
6
6
  { file: 'invalid_data', error: /Date/ },
7
7
  { file: 'unknown_attribute', error: /this_attribute_does_not_exist/ },
8
- { file: 'mismatched_columns', error: /column_names had 4 columns/ },
9
- { file: 'mismatched_rows', error: /had 3 columns/ },
8
+ { file: 'mismatched_columns', error: /Expected 4 but found 5/ },
9
+ { file: 'mismatched_rows', error: /Expected 3 but found 4/ },
10
10
  { file: 'invalid_yaml', error: /could not find expected ':'/ },
11
11
  { file: 'missing_dashes', error: /Attribute parse error at line 6 column 1/ },
12
- { file: 'missing_dashes', error: /Data delimiter '-' is missing/ },
12
+ { file: 'missing_dashes', error: /Did you forget to delimit the meta data section/ },
13
13
  ]
14
14
  # run each expectation
15
15
  expected_errors.each do |pair|
@@ -40,4 +40,22 @@ describe Quandl::Format::Dataset do
40
40
  end
41
41
  end
42
42
 
43
+ context "tabular.qdf" do
44
+ let(:data){ Quandl::Format::Dataset.load( fixtures_data['tabular'] ) }
45
+
46
+ it{ should be_a Array }
47
+ its(:count){ should eq 1 }
48
+
49
+ describe "#first" do
50
+ subject{ data.first }
51
+ its(:code){ should eq 'TABULAR' }
52
+ its(:column_names){ should eq ['Date','First','Second','Third','Fourth']}
53
+ its(:data){ should eq [
54
+ [Date.parse('2013-12-31'),10.0,20.0,30.0,40.0],
55
+ [Date.parse('2012-12-31'),20.0,30.0,40.0,50.0],
56
+ [Date.parse('2011-12-31'),30.0,40.0,50.0,60.0],
57
+ ]}
58
+ end
59
+ end
60
+
43
61
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: quandl_format
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Blake Hilscher
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-10 00:00:00.000000000 Z
11
+ date: 2013-12-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -170,15 +170,16 @@ files:
170
170
  - spec/fixtures/data/mismatched_columns.qdf
171
171
  - spec/fixtures/data/mismatched_rows.qdf
172
172
  - spec/fixtures/data/missing_dashes.qdf
173
+ - spec/fixtures/data/tabular.qdf
173
174
  - spec/fixtures/data/unknown_attribute.qdf
174
175
  - spec/fixtures/data/valid.qdf
175
176
  - spec/fixtures/format.rb
176
177
  - spec/lib/quandl/client/dataset_spec.rb
177
178
  - spec/lib/quandl/format/dataset/attributes_spec.rb
178
179
  - spec/lib/quandl/format/dataset/client_spec.rb
179
- - spec/lib/quandl/format/dataset/errors_spec.rb
180
+ - spec/lib/quandl/format/dataset/load/errors_spec.rb
181
+ - spec/lib/quandl/format/dataset/load/valid_spec.rb
180
182
  - spec/lib/quandl/format/dataset/load_spec.rb
181
- - spec/lib/quandl/format/dataset/valid_data_spec.rb
182
183
  - spec/lib/quandl/format/dataset_spec.rb
183
184
  - spec/spec_helper.rb
184
185
  homepage: http://blake.hilscher.ca/
@@ -214,14 +215,15 @@ test_files:
214
215
  - spec/fixtures/data/mismatched_columns.qdf
215
216
  - spec/fixtures/data/mismatched_rows.qdf
216
217
  - spec/fixtures/data/missing_dashes.qdf
218
+ - spec/fixtures/data/tabular.qdf
217
219
  - spec/fixtures/data/unknown_attribute.qdf
218
220
  - spec/fixtures/data/valid.qdf
219
221
  - spec/fixtures/format.rb
220
222
  - spec/lib/quandl/client/dataset_spec.rb
221
223
  - spec/lib/quandl/format/dataset/attributes_spec.rb
222
224
  - spec/lib/quandl/format/dataset/client_spec.rb
223
- - spec/lib/quandl/format/dataset/errors_spec.rb
225
+ - spec/lib/quandl/format/dataset/load/errors_spec.rb
226
+ - spec/lib/quandl/format/dataset/load/valid_spec.rb
224
227
  - spec/lib/quandl/format/dataset/load_spec.rb
225
- - spec/lib/quandl/format/dataset/valid_data_spec.rb
226
228
  - spec/lib/quandl/format/dataset_spec.rb
227
229
  - spec/spec_helper.rb