quandl_operation 0.1.10 → 0.1.11

Sign up to get free protection for your applications and to get access to all the features.
data/UPGRADE.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.1.11
2
+
3
+ * it should parse escaped csv data
4
+
1
5
  ## 0.1.10
2
6
 
3
7
  * Parse can handle incoming data formatted as a hash of time => [value,value,value]
@@ -24,7 +24,10 @@ class Parse
24
24
  end
25
25
 
26
26
  def csv(data)
27
- data = CSV.parse( data ) if data.is_a?(String)
27
+ if data.is_a?(String)
28
+ data = data.gsub('\n', "\n")
29
+ data = CSV.parse( data )
30
+ end
28
31
  data = values_to_float(data)
29
32
  data
30
33
  end
@@ -1,5 +1,5 @@
1
1
  module Quandl
2
2
  module Operation
3
- VERSION = "0.1.10"
3
+ VERSION = "0.1.11"
4
4
  end
5
5
  end
@@ -3,6 +3,9 @@ require 'spec_helper'
3
3
 
4
4
  describe Quandl::Operation::Parse do
5
5
  subject{ Quandl::Operation::Parse }
6
+ let(:escaped_csv){ '2444628,0.00385,0.001,0.123,0.00631,0.534\n2444627,0.00384,0.00159507,0.0056,0.00628948,0.009896' }
7
+ let(:data_array){ [[ 2444628,0.00385,0.001,0.123,0.00631,0.534], [ 2444627,0.00384,0.00159507,0.0056,0.00628948,0.009896 ]] }
8
+
6
9
  let(:csv_data){ "#{Date.today}, 1.0, 2.0" }
7
10
  let(:hash_data){ { Date.today.to_s => [ 1.0, 2.0 ] } }
8
11
  let(:array_data){ [[ Date.today.to_s, 1.0, 2.0 ]] }
@@ -29,6 +32,9 @@ describe Quandl::Operation::Parse do
29
32
  it "should handle array_data" do
30
33
  subject.perform( array_data ).should eq julian_data
31
34
  end
35
+ it "handles escaped csv_data" do
36
+ subject.perform( escaped_csv ).should eq data_array
37
+ end
32
38
  end
33
39
 
34
40
  end
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.10
4
+ version: 0.1.11
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-09-27 00:00:00.000000000 Z
12
+ date: 2013-09-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake