quandl_client 2.4.4 → 2.4.5

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: ad925197e4d222a17552a4e4bc06fe5f1371bdc7
4
- data.tar.gz: f1d89d66da1cdecdb3511ecb6d4d25b96fdc1d37
3
+ metadata.gz: 7125726d7cceeb967eeea4dee62a6defd9609ac3
4
+ data.tar.gz: 019a336addadb9238b9290054730b926cf7ba1ac
5
5
  SHA512:
6
- metadata.gz: 0ee1c3f4830d012faffce633af7026114e9ccf8f5eb43ec244d73c5151a33a56f840ea164373d688536d104b8543a122b4558a67549e288b31ee9da8f23f49a0
7
- data.tar.gz: 1c6de22b70669757693e9eb91fe3536ee5e5303b4b5f643ceafe62c2165ac93e597c509b4b4385ef15e323e5b708e4c31880626408526104965c0394399668f0
6
+ metadata.gz: 287b3674ebd754821827d74d044b5362af1af32eb68967c980fb25d6638227f21183dd7b6007de54d16569025566abb6c8ec75e163a221ab325cb68f5ceaba4f
7
+ data.tar.gz: 670806360ff1824f7c9963daa6d1fdde4a24e3599e3baeac17d3a4d1a7aba980813af601236b7b6cf41a16be19c47b0d79ba437238e312987cf56d03307fcd40
data/UPGRADE.md CHANGED
@@ -1,3 +1,9 @@
1
+ # 2.4.5
2
+
3
+ * QUGC-40 add validation to enforce: You may not change number of columns in a dataset
4
+ * QUGC-37 Dataest.find accept backslash or forward slash interchangeably
5
+
6
+
1
7
  # 2.4.4
2
8
 
3
9
  * Dataset#data to_table assigns column_names to headers
@@ -11,6 +11,8 @@ class Quandl::Client::Dataset < Quandl::Client::Base
11
11
  end
12
12
 
13
13
  def find(value)
14
+ # ensure slashes are forward facing
15
+ value = value.gsub("\\","/") if value.is_a?(String)
14
16
  # short-circuit if value is illegal
15
17
  return nil unless value.is_a?(Integer) || value.to_s =~ %r{^#{Quandl::Pattern.full_code}$}
16
18
  super(value)
@@ -37,6 +39,7 @@ class Quandl::Client::Dataset < Quandl::Client::Base
37
39
 
38
40
  validates :code, presence: true, format: { with: Quandl::Pattern.code, message: "is invalid. Expected format: #{Quandl::Pattern.code.to_example}" }
39
41
  validates :display_url, allow_blank: true, url: true
42
+ validate :data_columns_should_not_exceed_column_names!
40
43
 
41
44
  ##############
42
45
  # PROPERTIES #
@@ -113,13 +116,23 @@ class Quandl::Client::Dataset < Quandl::Client::Base
113
116
 
114
117
  protected
115
118
 
119
+ def data_columns_should_not_exceed_column_names!
120
+ if dataset_data.data? && column_names.present? && data.first.count != column_names.count
121
+ self.errors.add( :data, "You may not change the number of columns in a dataset!" )
122
+ return false
123
+ end
124
+ true
125
+ end
126
+
116
127
  def save_dataset_data
117
- return if !saved? && id.blank?
128
+ return if (!saved? && id.blank?)
129
+ return if !dataset_data.data?
118
130
 
119
131
  dataset_data.id = id
120
132
  dataset_data.save
121
133
  # update dataset's attributes with dataset_data's attributes
122
134
  attributes.each{|k,v| attributes[k] = dataset_data.attributes[k] if dataset_data.attributes.has_key?(k) }
135
+ @metadata[:status] = dataset_data.status
123
136
  end
124
137
 
125
138
  def enforce_required_formats
@@ -1,5 +1,6 @@
1
1
  class Quandl::Client::User < Quandl::Client::Base
2
2
 
3
+ custom_get :info
3
4
  custom_post :login
4
5
 
5
6
  attributes :auth_token
@@ -1,6 +1,6 @@
1
1
  module Quandl
2
2
  module Client
3
- VERSION = '2.4.4'
3
+ VERSION = '2.4.5'
4
4
  API_VERSION = 'v2'
5
5
 
6
6
  class << self
@@ -5,7 +5,7 @@ FactoryGirl.define do
5
5
  sequence(:code) { |n| "QUANDL_CLIENT_#{(Time.now.to_f * 1000).to_i}_#{n}" }
6
6
  name "Quandl Client Dataset"
7
7
  description "Quandl Client Dataset Spec"
8
- column_spec "[0,[\"Date \\n\",{}],[\"Column 1 \",{}],[\"Column 2 \",{}]]"
8
+ # column_names ['Date', "Column 1", "Column 2"]
9
9
  end
10
10
 
11
11
  end
@@ -4,8 +4,11 @@ require 'spec_helper'
4
4
  describe Quandl::Client::Dataset::Data do
5
5
 
6
6
  let(:dataset){
7
- create(:dataset, source_code: "QUANDL_CLIENT_TEST_SOURCE", data: Quandl::Fabricate::Data.rand( rows: 10, columns: 4 ) )
7
+ create(:dataset, source_code: "QUANDL_CLIENT_TEST_SOURCE", data: Quandl::Fabricate::Data.rand( rows: 10, columns: 4 ), column_names: ["Date", "C1", 'c2', 'c3', 'c4'] )
8
8
  }
9
+ subject{ dataset }
10
+
11
+ its(:valid?){ should be_true }
9
12
 
10
13
  describe ".with_id('NSE/OIL')" do
11
14
  let(:id){ Dataset.find("NSE/OIL").id }
@@ -27,6 +30,7 @@ describe Quandl::Client::Dataset::Data do
27
30
 
28
31
  describe "#data" do
29
32
  subject{ Dataset.find( dataset.id ).data }
33
+
30
34
  its(:count){ should eq 10 }
31
35
  its(:to_h){ should be_a Hash }
32
36
  end
@@ -41,9 +41,9 @@ describe Dataset do
41
41
 
42
42
  let(:dataset){ create(:dataset, source_code: "QUANDL_CLIENT_TEST_SOURCE", data: Quandl::Fabricate::Data.rand(rows: 20, columns: 2, nils: false) ) }
43
43
  subject{ dataset }
44
-
44
+
45
45
  its(:saved?){ should be_true }
46
- its(:status){ should eq 201 }
46
+ its(:status){ should eq 200 }
47
47
 
48
48
  end
49
49
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: quandl_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.4
4
+ version: 2.4.5
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-27 00:00:00.000000000 Z
11
+ date: 2014-01-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake