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
@@ -1,3 +1,7 @@
1
+ ## 0.1.14
2
+
3
+ * add Dataset#locations spec to test that location data is returned in the same order as it is sent.
4
+
1
5
  ## 0.1.12
2
6
 
3
7
  * fix undefined error method
@@ -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 :ensure_data_is_csv
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 ensure_data_is_csv
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
@@ -1,6 +1,6 @@
1
1
  module Quandl
2
2
  module Client
3
- VERSION = '0.1.13'
3
+ VERSION = '0.1.14'
4
4
  API_VERSION = 'v1'
5
5
 
6
6
  class << self
@@ -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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: quandl_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.13
4
+ version: 0.1.14
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: