quandl_client 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 +7 -0
- data/lib/quandl/client/concerns/properties.rb +16 -2
- data/lib/quandl/client/models/dataset.rb +3 -3
- data/lib/quandl/client/version.rb +1 -1
- data/spec/factories/dataset.rb +1 -1
- data/spec/quandl/client/models/dataset/location_spec.rb +22 -0
- data/spec/quandl/client/models/dataset/persistence_spec.rb +5 -6
- data/spec/quandl/client/models/dataset/search_spec.rb +0 -2
- data/spec/quandl/client/models/source_spec.rb +2 -2
- data/spec/spec_helper.rb +1 -1
- metadata +4 -4
- data/spec/quandl/client/models/dataset_spec.rb +0 -5
data/UPGRADE.md
CHANGED
@@ -26,8 +26,20 @@ module Properties
|
|
26
26
|
save
|
27
27
|
end
|
28
28
|
|
29
|
+
def blank?
|
30
|
+
!present?
|
31
|
+
end
|
32
|
+
|
33
|
+
def exists?
|
34
|
+
present?
|
35
|
+
end
|
36
|
+
|
37
|
+
def present?
|
38
|
+
status >= 200 && status < 300
|
39
|
+
end
|
40
|
+
|
29
41
|
def saved?
|
30
|
-
status
|
42
|
+
status >= 201 && status <= 206
|
31
43
|
end
|
32
44
|
|
33
45
|
def status
|
@@ -48,7 +60,9 @@ module Properties
|
|
48
60
|
end
|
49
61
|
|
50
62
|
def errors_server
|
51
|
-
self.attributes[:errors] || {}
|
63
|
+
messages = self.attributes[:errors] || {}
|
64
|
+
messages[:message] = self.error if self.error.present?
|
65
|
+
messages
|
52
66
|
end
|
53
67
|
|
54
68
|
def errors_params
|
@@ -36,9 +36,9 @@ class Dataset
|
|
36
36
|
# VALIDATIONS #
|
37
37
|
###############
|
38
38
|
|
39
|
-
validates :source_code, presence: true
|
40
|
-
validates :code, presence: true,
|
41
|
-
validates :name, presence: true
|
39
|
+
validates :source_code, presence: true
|
40
|
+
validates :code, presence: true, format: { with: /[A-Z0-9_]+/ }
|
41
|
+
validates :name, presence: true, :length => { :maximum => 1000 }
|
42
42
|
|
43
43
|
|
44
44
|
##############
|
data/spec/factories/dataset.rb
CHANGED
@@ -2,7 +2,7 @@ FactoryGirl.define do
|
|
2
2
|
|
3
3
|
factory :dataset do
|
4
4
|
source_code "QUANDL_CLIENT_TEST_SOURCE"
|
5
|
-
sequence(:code) { |n| "QUANDL_CLIENT_#{n}" }
|
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
8
|
column_spec "[0,[\"Date \\n\",{}],[\"Column 1 \",{}],[\"Column 2 \",{}]]"
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
describe Dataset do
|
5
|
+
|
6
|
+
subject{
|
7
|
+
build(:dataset, source_code: create(:source).code )
|
8
|
+
}
|
9
|
+
|
10
|
+
describe "#availability_delay" do
|
11
|
+
context "given valid input" do
|
12
|
+
it "saves the delay" do
|
13
|
+
delay = '02:00:10'
|
14
|
+
subject.availability_delay = delay
|
15
|
+
subject.save
|
16
|
+
Dataset.find(subject.id).availability_delay.should eq delay
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
@@ -11,7 +11,7 @@ describe Dataset do
|
|
11
11
|
context "without token" do
|
12
12
|
|
13
13
|
before(:all){ Quandl::Client.token = '' }
|
14
|
-
|
14
|
+
|
15
15
|
let(:dataset){ create(:dataset) }
|
16
16
|
subject{ dataset }
|
17
17
|
|
@@ -20,9 +20,9 @@ describe Dataset do
|
|
20
20
|
|
21
21
|
end
|
22
22
|
context "with token" do
|
23
|
-
|
24
|
-
before(:all){ Quandl::Client.token =
|
25
|
-
|
23
|
+
|
24
|
+
before(:all){ Quandl::Client.token = ENV['QUANDL_AUTH_TOKEN'] }
|
25
|
+
|
26
26
|
let(:source){ create(:source) }
|
27
27
|
let(:dataset){ create(:dataset, source_code: source.code ) }
|
28
28
|
subject{ dataset }
|
@@ -34,8 +34,7 @@ describe Dataset do
|
|
34
34
|
end
|
35
35
|
|
36
36
|
context "when updated" do
|
37
|
-
|
38
|
-
|
37
|
+
|
39
38
|
let(:source){ create(:source) }
|
40
39
|
let(:dataset){ create(:dataset, source_code: source.code, data: Quandl::Data::Random.table(rows: 20, columns: 2).to_csv ) }
|
41
40
|
|
data/spec/spec_helper.rb
CHANGED
@@ -11,7 +11,7 @@ require "quandl/client"
|
|
11
11
|
|
12
12
|
include Quandl::Client
|
13
13
|
Quandl::Client.use 'http://localhost:3000/api/'
|
14
|
-
|
14
|
+
Quandl::Client.token = ENV['QUANDL_AUTH_TOKEN']
|
15
15
|
|
16
16
|
RSpec.configure do |config|
|
17
17
|
config.include FactoryGirl::Syntax::Methods
|
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.
|
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-08-
|
12
|
+
date: 2013-08-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -252,9 +252,9 @@ files:
|
|
252
252
|
- quandl_client.gemspec
|
253
253
|
- spec/factories/dataset.rb
|
254
254
|
- spec/factories/source.rb
|
255
|
+
- spec/quandl/client/models/dataset/location_spec.rb
|
255
256
|
- spec/quandl/client/models/dataset/persistence_spec.rb
|
256
257
|
- spec/quandl/client/models/dataset/search_spec.rb
|
257
|
-
- spec/quandl/client/models/dataset_spec.rb
|
258
258
|
- spec/quandl/client/models/source_spec.rb
|
259
259
|
- spec/spec_helper.rb
|
260
260
|
homepage: http://blake.hilscher.ca/
|
@@ -285,8 +285,8 @@ summary: Client rest orm.
|
|
285
285
|
test_files:
|
286
286
|
- spec/factories/dataset.rb
|
287
287
|
- spec/factories/source.rb
|
288
|
+
- spec/quandl/client/models/dataset/location_spec.rb
|
288
289
|
- spec/quandl/client/models/dataset/persistence_spec.rb
|
289
290
|
- spec/quandl/client/models/dataset/search_spec.rb
|
290
|
-
- spec/quandl/client/models/dataset_spec.rb
|
291
291
|
- spec/quandl/client/models/source_spec.rb
|
292
292
|
- spec/spec_helper.rb
|