quandl_client 0.1.13 → 0.1.14
Sign up to get free protection for your applications and to get access to all the features.
data/UPGRADE.md
CHANGED
@@ -51,7 +51,7 @@ class Dataset
|
|
51
51
|
:display_url, :column_spec, :import_spec, :import_url,
|
52
52
|
:locations_attributes, :data, :availability_delay
|
53
53
|
|
54
|
-
before_save :
|
54
|
+
before_save :enforce_required_formats
|
55
55
|
|
56
56
|
alias_method :locations, :locations_attributes
|
57
57
|
alias_method :locations=, :locations_attributes=
|
@@ -70,8 +70,9 @@ class Dataset
|
|
70
70
|
|
71
71
|
protected
|
72
72
|
|
73
|
-
def
|
73
|
+
def enforce_required_formats
|
74
74
|
self.data = Quandl::Data::Table.new(data).to_csv
|
75
|
+
self.locations_attributes = locations_attributes.to_json if locations_attributes.respond_to?(:to_json) && !locations_attributes.kind_of?(String)
|
75
76
|
end
|
76
77
|
|
77
78
|
end
|
@@ -18,5 +18,29 @@ describe Dataset do
|
|
18
18
|
|
19
19
|
end
|
20
20
|
end
|
21
|
+
|
22
|
+
describe "#locations" do
|
23
|
+
it "should save and return the location data" do
|
24
|
+
locations = [
|
25
|
+
{
|
26
|
+
category: 'js_http',
|
27
|
+
url: "http://test-#{(Time.now.to_f * 1000).to_i}.com/data",
|
28
|
+
navigation: [
|
29
|
+
{:id => 'id303', :type => 'link'},
|
30
|
+
{:name => 'selectionname', :type => 'text', :value => 'cd' },
|
31
|
+
{:name => 'auswaehlen', :type => 'button'},
|
32
|
+
{:id => "id#cd", :type => 'link'},
|
33
|
+
{:name => 'werteabruf', :type => 'button'}
|
34
|
+
]
|
35
|
+
}
|
36
|
+
]
|
37
|
+
subject.locations = locations
|
38
|
+
subject.save
|
39
|
+
dataset = Dataset.find(subject.id)
|
40
|
+
dataset.locations[0][:category].should eq locations[0][:category]
|
41
|
+
dataset.locations[0][:url].should eq locations[0][:url]
|
42
|
+
dataset.locations[0][:navigation].should eq locations[0][:navigation]
|
43
|
+
end
|
44
|
+
end
|
21
45
|
|
22
46
|
end
|