quandl_format 0.2.2 → 0.2.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: 7072591ad6409605e636a683d11f68d710620a10
4
- data.tar.gz: 1fde63eca87a48777b540cda4e8a9f69a6168cb2
3
+ metadata.gz: 8747d31194c3966461bf384e9fa12252a686bac4
4
+ data.tar.gz: 19255b2e97e72da07ea8f5ebecefc96226327e2b
5
5
  SHA512:
6
- metadata.gz: c7cafdd4912fad7f0a9e74ab9b52dd9006ddd87400b5df861374b343a18e9a4d846ed72a8cbe9ee1b5cfe7dfd6aa9d5eeea1ba636e92d5a1a5e06c66a8b88b16
7
- data.tar.gz: 8268a92bd9019c03aa934c53525fb016f015397056354c4afc72c49d9e37f7a2d29d86c8b17be00eb0fb5f9bd0e917e4c44e706d4916f7c8a35bc4e322c6a9fd
6
+ metadata.gz: 76592d61eee87bb506abd24bdc4e7230b340e98c359ff9a87ab95f8765c41e3f71351e171724bc8c1aabb0409af1738a90ccd891ad73b3e4108a608c227a946f
7
+ data.tar.gz: e555d771b8d7c7fcd510dc6c48cac1e7a2bbce9fd6410b39a31918daa00ac0ebaa2f484f86bc9e8c989d5096873bc63eb4b32e37a89c2acf29bfd01a38db90ec
data/UPGRADE.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 0.2.3
2
+
3
+ * QUGC-35 Pure Meta Data Send or Update
4
+ * remove babelfish from gemspec
5
+
6
+
1
7
  ## 0.2.0
2
8
 
3
9
  * Update Quandl::Client to gain access to Quandl::Pattern
@@ -51,7 +51,7 @@ module Attributes
51
51
  end
52
52
 
53
53
  def full_code
54
- [source_code, code].join('/')
54
+ [source_code, code].collect{|v| v.blank? ? nil : v }.compact.join('/')
55
55
  end
56
56
 
57
57
  def description=(value)
@@ -65,6 +65,10 @@ module Attributes
65
65
  data_rows_should_have_equal_columns!
66
66
  @data
67
67
  end
68
+
69
+ def column_names
70
+ @column_names ||= []
71
+ end
68
72
 
69
73
  def column_names=(names)
70
74
  @column_names = Array(names).flatten.collect{|n| n.strip.rstrip }
@@ -85,6 +89,7 @@ module Attributes
85
89
  protected
86
90
 
87
91
  def data_rows_should_have_equal_columns!
92
+ return if data.blank?
88
93
  row_count = data[0].count
89
94
  data.each_with_index do |row, index|
90
95
  raise_row_column_mismatch!(row, index) unless row.count == row_count
@@ -54,7 +54,7 @@ module Client
54
54
 
55
55
  def find_or_build_client
56
56
  @client = Quandl::Client::Dataset.find(full_code)
57
- @client = Quandl::Client::Dataset.new unless @client.exists?
57
+ @client = Quandl::Client::Dataset.new unless @client.try(:exists?)
58
58
  @client
59
59
  end
60
60
 
@@ -1,5 +1,5 @@
1
1
  module Quandl
2
2
  module Format
3
- VERSION = "0.2.2"
3
+ VERSION = "0.2.3"
4
4
  end
5
5
  end
@@ -1,2 +1,2 @@
1
1
  Quandl::Client.token = ENV['QUANDL_AUTH_TOKEN']
2
- Quandl::Client.use ENV['QUANDL_API_HOST']
2
+ Quandl::Client.use ENV['QUANDL_TEST_URL']
@@ -0,0 +1,14 @@
1
+ code: "BLAKE_TEST_1"
2
+ name: "A new title"
3
+ description: "The description Date, Open, High"
4
+ private: false
5
+ -
6
+ code: "BLAKE_TEST_2"
7
+ name: "A new title"
8
+ description: "The description Date, Open, High"
9
+ private: false
10
+ -
11
+ code: "BLAKE_TEST_3"
12
+ name: "A new title"
13
+ description: "The description Date, Open, High"
14
+ private: false
@@ -2,22 +2,20 @@
2
2
  require 'spec_helper'
3
3
 
4
4
  describe Quandl::Format::Dataset do
5
- expected_errors = [
6
- { file: 'invalid_data', error: /Date/ },
7
- { file: 'unknown_attribute', error: /this_attribute_does_not_exist/ },
8
- { file: 'mismatched_columns', error: /Expected 4 but found 5/ },
9
- { file: 'mismatched_rows', error: /Expected 3 but found 4/ },
10
- { file: 'invalid_yaml', error: /could not find expected ':'/ },
11
- { file: 'missing_dashes', error: /Attribute parse error at line 28 column 1/ },
12
- { file: 'missing_dashes', error: /Did you forget to delimit the meta data section/ },
13
- ]
14
-
15
- # run each expectation
16
- expected_errors.each do |pair|
17
- it "#{pair[:file]}.qdf should error with #{pair[:error]}" do
18
- Quandl::Logger.should_receive(:error).at_least(:once).with(pair[:error])
19
- Quandl::Format::Dataset.load( fixtures_data[pair[:file]] )
5
+
6
+ def self.it_should_expect_error(file, error)
7
+ it "#{file}.qdf should error with #{error}" do
8
+ Quandl::Logger.should_receive(:error).at_least(:once).with(error)
9
+ Quandl::Format::Dataset.load( fixtures_data[file] )
20
10
  end
21
11
  end
22
12
 
13
+ it_should_expect_error 'invalid_data', /Date/
14
+ it_should_expect_error 'unknown_attribute', /this_attribute_does_not_exist/
15
+ it_should_expect_error 'mismatched_columns', /Expected 4 but found 5/
16
+ it_should_expect_error 'mismatched_rows', /Expected 3 but found 4/
17
+ it_should_expect_error 'invalid_yaml', /could not find expected ':'/
18
+ it_should_expect_error 'missing_dashes', /Attribute parse error at line 28 column 1/
19
+ it_should_expect_error 'missing_dashes', /Did you forget to delimit the meta data section/
20
+
23
21
  end
@@ -18,6 +18,22 @@ describe Quandl::Format::Dataset do
18
18
  its(:data){ should eq Quandl::Data.new([['2013-11-22','1252.0','454.95','448.2','450.0','450.0','1354405.0','6099.41'],['2013-11-21','452.25','457.75','449.1','451.2','451.0','218881.0','992.94']]) }
19
19
  end
20
20
  end
21
+
22
+ context "metadata_only.qdf" do
23
+ let(:data){ Quandl::Format::Dataset.load( fixtures_data['metadata_only'] ) }
24
+
25
+ it{ should be_a Array }
26
+ its(:count){ should eq 3 }
27
+
28
+ describe "#first" do
29
+ subject{ data.first }
30
+ its(:code){ should eq 'BLAKE_TEST_1' }
31
+ its(:name){ should eq 'A new title' }
32
+ its(:description){ should eq 'The description Date, Open, High'}
33
+ its(:column_names){ should eq [] }
34
+ its(:data){ should eq [] }
35
+ end
36
+ end
21
37
 
22
38
  context "annual.qdf" do
23
39
  let(:data){ Quandl::Format::Dataset.load( fixtures_data['annual'] ) }
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.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Blake Hilscher
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-22 00:00:00.000000000 Z
11
+ date: 2014-01-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -154,6 +154,7 @@ files:
154
154
  - spec/fixtures/data/illegal_colon.qdf
155
155
  - spec/fixtures/data/invalid_data.qdf
156
156
  - spec/fixtures/data/invalid_yaml.qdf
157
+ - spec/fixtures/data/metadata_only.qdf
157
158
  - spec/fixtures/data/mismatched_columns.qdf
158
159
  - spec/fixtures/data/mismatched_rows.qdf
159
160
  - spec/fixtures/data/missing_dashes.qdf
@@ -200,6 +201,7 @@ test_files:
200
201
  - spec/fixtures/data/illegal_colon.qdf
201
202
  - spec/fixtures/data/invalid_data.qdf
202
203
  - spec/fixtures/data/invalid_yaml.qdf
204
+ - spec/fixtures/data/metadata_only.qdf
203
205
  - spec/fixtures/data/mismatched_columns.qdf
204
206
  - spec/fixtures/data/mismatched_rows.qdf
205
207
  - spec/fixtures/data/missing_dashes.qdf