quandl_client 2.7.11 → 2.7.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +7 -7
- data/.rspec +1 -1
- data/.travis.yml +20 -20
- data/.yardopts +2 -2
- data/Gemfile +12 -12
- data/Guardfile +8 -8
- data/LICENSE +7 -7
- data/README.md +303 -303
- data/Rakefile +31 -31
- data/UPGRADE.md +220 -214
- data/VERSION +1 -1
- data/examples/create.rb +32 -32
- data/examples/find.rb +17 -17
- data/examples/login.rb +12 -12
- data/examples/search.rb +12 -12
- data/examples/trims.rb +15 -15
- data/lib/quandl/client/base/attributes.rb +15 -15
- data/lib/quandl/client/base/model.rb +40 -40
- data/lib/quandl/client/base/search.rb +74 -74
- data/lib/quandl/client/base/validation.rb +103 -101
- data/lib/quandl/client/base.rb +91 -91
- data/lib/quandl/client/middleware/parse_json.rb +87 -85
- data/lib/quandl/client/middleware.rb +9 -9
- data/lib/quandl/client/models/dataset/data.rb +57 -57
- data/lib/quandl/client/models/dataset.rb +269 -269
- data/lib/quandl/client/models/location.rb +10 -10
- data/lib/quandl/client/models/report.rb +14 -14
- data/lib/quandl/client/models/scraper.rb +16 -16
- data/lib/quandl/client/models/sheet.rb +50 -50
- data/lib/quandl/client/models/source.rb +48 -48
- data/lib/quandl/client/models/superset.rb +65 -65
- data/lib/quandl/client/models/user.rb +7 -7
- data/lib/quandl/client/version.rb +14 -14
- data/lib/quandl/client.rb +54 -53
- data/lib/quandl/her/collection.rb +18 -0
- data/lib/quandl/her/remove_method_data.rb +8 -8
- data/lib/quandl/pattern/client.rb +8 -8
- data/lib/quandl/pattern.rb +37 -37
- data/quandl_client.gemspec +33 -33
- data/spec/factories/dataset.rb +10 -10
- data/spec/factories/sheet.rb +7 -7
- data/spec/factories/source.rb +9 -9
- data/spec/fixtures/scraper.rb +5 -5
- data/spec/lib/quandl/client/dataset/attributes_spec.rb +63 -63
- data/spec/lib/quandl/client/dataset/data_spec.rb +92 -92
- data/spec/lib/quandl/client/dataset/location_spec.rb +65 -65
- data/spec/lib/quandl/client/dataset/persistence_spec.rb +104 -104
- data/spec/lib/quandl/client/dataset/search_spec.rb +19 -19
- data/spec/lib/quandl/client/dataset/source_spec.rb +47 -47
- data/spec/lib/quandl/client/dataset/trim_spec.rb +35 -35
- data/spec/lib/quandl/client/dataset/validation_spec.rb +68 -68
- data/spec/lib/quandl/client/dataset_spec.rb +57 -57
- data/spec/lib/quandl/client/scraper_spec.rb +71 -71
- data/spec/lib/quandl/client/sheet_spec.rb +37 -37
- data/spec/lib/quandl/client/source_spec.rb +51 -51
- data/spec/spec_helper.rb +30 -30
- metadata +28 -4
@@ -1,72 +1,72 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require 'spec_helper'
|
3
|
-
|
4
|
-
describe Scraper do
|
5
|
-
|
6
|
-
let(:scraper){ Scraper.new }
|
7
|
-
subject{ scraper }
|
8
|
-
|
9
|
-
its(:valid?){ should be_false }
|
10
|
-
|
11
|
-
context "name='file'" do
|
12
|
-
before(:each){ scraper.name = "file-#{uuid}.rb" }
|
13
|
-
|
14
|
-
its(:save){ should be_false }
|
15
|
-
|
16
|
-
context "save" do
|
17
|
-
before(:each){ scraper.save }
|
18
|
-
its("error_messages.to_s"){ should match "You must provide one of" }
|
19
|
-
its("error_messages.to_s"){ should match "scraper_url, git_url" }
|
20
|
-
end
|
21
|
-
|
22
|
-
context "scraper= File" do
|
23
|
-
before(:each){
|
24
|
-
scraper.scraper = "spec/fixtures/scraper.rb"
|
25
|
-
scraper.save
|
26
|
-
}
|
27
|
-
its(:valid?){ should be_true }
|
28
|
-
its(:saved?){ should be_true }
|
29
|
-
its(:id){ should be_present }
|
30
|
-
its(:scraper_url){ should match /s3/}
|
31
|
-
its(:git_url){ should be_blank }
|
32
|
-
its(:type){ should eq 'Scraper::Script' }
|
33
|
-
end
|
34
|
-
|
35
|
-
context "scraper_url='https://github.com/tammer/scrapers/blob/master/shibor.rb'" do
|
36
|
-
before(:each){
|
37
|
-
scraper.scraper_url = "https://github.com/tammer/scrapers/blob/master/shibor.rb"
|
38
|
-
scraper.save
|
39
|
-
}
|
40
|
-
its(:valid?){ should be_true }
|
41
|
-
its(:saved?){ should be_true }
|
42
|
-
its(:id){ should be_present }
|
43
|
-
its(:scraper_url){ should match /s3/}
|
44
|
-
its(:git_url){ should be_blank }
|
45
|
-
its(:type){ should eq 'Scraper::Script' }
|
46
|
-
end
|
47
|
-
|
48
|
-
context "git_url='git@github.com:tammer/scrapers.git'" do
|
49
|
-
before(:each){
|
50
|
-
scraper.git_url = "git@github.com:tammer/scrapers.git"
|
51
|
-
scraper.save
|
52
|
-
}
|
53
|
-
its("error_messages.to_s"){ should match %Q{can't be blank} }
|
54
|
-
end
|
55
|
-
|
56
|
-
context "git_url='git@github.com:tammer/scrapers.git' & git_reference='master'" do
|
57
|
-
before(:each){
|
58
|
-
subject.git_url = "git@github.com:tammer/scrapers-#{uuid}.git"
|
59
|
-
subject.git_reference = "master"
|
60
|
-
subject.save
|
61
|
-
}
|
62
|
-
its(:valid?){ should be_true }
|
63
|
-
its(:saved?){ should be_true }
|
64
|
-
its(:id){ should be_present }
|
65
|
-
its(:scraper_url){ should be_blank }
|
66
|
-
its(:git_url){ should match /git@github.com:tammer\/scrapers/ }
|
67
|
-
its(:type){ should eq 'Scraper::Git' }
|
68
|
-
end
|
69
|
-
|
70
|
-
end
|
71
|
-
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
describe Scraper do
|
5
|
+
|
6
|
+
let(:scraper){ Scraper.new }
|
7
|
+
subject{ scraper }
|
8
|
+
|
9
|
+
its(:valid?){ should be_false }
|
10
|
+
|
11
|
+
context "name='file'" do
|
12
|
+
before(:each){ scraper.name = "file-#{uuid}.rb" }
|
13
|
+
|
14
|
+
its(:save){ should be_false }
|
15
|
+
|
16
|
+
context "save" do
|
17
|
+
before(:each){ scraper.save }
|
18
|
+
its("error_messages.to_s"){ should match "You must provide one of" }
|
19
|
+
its("error_messages.to_s"){ should match "scraper_url, git_url" }
|
20
|
+
end
|
21
|
+
|
22
|
+
context "scraper= File" do
|
23
|
+
before(:each){
|
24
|
+
scraper.scraper = "spec/fixtures/scraper.rb"
|
25
|
+
scraper.save
|
26
|
+
}
|
27
|
+
its(:valid?){ should be_true }
|
28
|
+
its(:saved?){ should be_true }
|
29
|
+
its(:id){ should be_present }
|
30
|
+
its(:scraper_url){ should match /s3/}
|
31
|
+
its(:git_url){ should be_blank }
|
32
|
+
its(:type){ should eq 'Scraper::Script' }
|
33
|
+
end
|
34
|
+
|
35
|
+
context "scraper_url='https://github.com/tammer/scrapers/blob/master/shibor.rb'" do
|
36
|
+
before(:each){
|
37
|
+
scraper.scraper_url = "https://github.com/tammer/scrapers/blob/master/shibor.rb"
|
38
|
+
scraper.save
|
39
|
+
}
|
40
|
+
its(:valid?){ should be_true }
|
41
|
+
its(:saved?){ should be_true }
|
42
|
+
its(:id){ should be_present }
|
43
|
+
its(:scraper_url){ should match /s3/}
|
44
|
+
its(:git_url){ should be_blank }
|
45
|
+
its(:type){ should eq 'Scraper::Script' }
|
46
|
+
end
|
47
|
+
|
48
|
+
context "git_url='git@github.com:tammer/scrapers.git'" do
|
49
|
+
before(:each){
|
50
|
+
scraper.git_url = "git@github.com:tammer/scrapers.git"
|
51
|
+
scraper.save
|
52
|
+
}
|
53
|
+
its("error_messages.to_s"){ should match %Q{can't be blank} }
|
54
|
+
end
|
55
|
+
|
56
|
+
context "git_url='git@github.com:tammer/scrapers.git' & git_reference='master'" do
|
57
|
+
before(:each){
|
58
|
+
subject.git_url = "git@github.com:tammer/scrapers-#{uuid}.git"
|
59
|
+
subject.git_reference = "master"
|
60
|
+
subject.save
|
61
|
+
}
|
62
|
+
its(:valid?){ should be_true }
|
63
|
+
its(:saved?){ should be_true }
|
64
|
+
its(:id){ should be_present }
|
65
|
+
its(:scraper_url){ should be_blank }
|
66
|
+
its(:git_url){ should match /git@github.com:tammer\/scrapers/ }
|
67
|
+
its(:type){ should eq 'Scraper::Git' }
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
71
|
+
|
72
72
|
end
|
@@ -1,38 +1,38 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require 'spec_helper'
|
3
|
-
|
4
|
-
describe Sheet do
|
5
|
-
|
6
|
-
before(:all){ Quandl::Client.token = ENV['QUANDL_AUTH_TOKEN'] }
|
7
|
-
|
8
|
-
let(:sheet){ build(:sheet) }
|
9
|
-
|
10
|
-
subject{ sheet }
|
11
|
-
|
12
|
-
its(:valid?){ should be_true }
|
13
|
-
|
14
|
-
context "when saved" do
|
15
|
-
|
16
|
-
before(:each){ subject.save }
|
17
|
-
|
18
|
-
its(:saved?){ should be_true }
|
19
|
-
|
20
|
-
describe "#description" do
|
21
|
-
|
22
|
-
its(:description){ should eq "Test sheet description." }
|
23
|
-
|
24
|
-
it "should find the description" do
|
25
|
-
Sheet.find( subject.id ).description.should eq "Test sheet description."
|
26
|
-
end
|
27
|
-
|
28
|
-
it "should update the description" do
|
29
|
-
subject.description = "New description."
|
30
|
-
subject.save
|
31
|
-
Sheet.find( subject.id ).description.should eq "New description."
|
32
|
-
end
|
33
|
-
|
34
|
-
end
|
35
|
-
|
36
|
-
end
|
37
|
-
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
describe Sheet do
|
5
|
+
|
6
|
+
before(:all){ Quandl::Client.token = ENV['QUANDL_AUTH_TOKEN'] }
|
7
|
+
|
8
|
+
let(:sheet){ build(:sheet) }
|
9
|
+
|
10
|
+
subject{ sheet }
|
11
|
+
|
12
|
+
its(:valid?){ should be_true }
|
13
|
+
|
14
|
+
context "when saved" do
|
15
|
+
|
16
|
+
before(:each){ subject.save }
|
17
|
+
|
18
|
+
its(:saved?){ should be_true }
|
19
|
+
|
20
|
+
describe "#description" do
|
21
|
+
|
22
|
+
its(:description){ should eq "Test sheet description." }
|
23
|
+
|
24
|
+
it "should find the description" do
|
25
|
+
Sheet.find( subject.id ).description.should eq "Test sheet description."
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should update the description" do
|
29
|
+
subject.description = "New description."
|
30
|
+
subject.save
|
31
|
+
Sheet.find( subject.id ).description.should eq "New description."
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
38
|
end
|
@@ -1,51 +1,51 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require 'spec_helper'
|
3
|
-
|
4
|
-
describe Source do
|
5
|
-
|
6
|
-
let(:source){ build(:source) }
|
7
|
-
|
8
|
-
context "without token" do
|
9
|
-
|
10
|
-
before(:all){ Quandl::Client.token = '' }
|
11
|
-
|
12
|
-
subject{ source }
|
13
|
-
|
14
|
-
its(:valid?){ should be_true }
|
15
|
-
|
16
|
-
describe "#save" do
|
17
|
-
|
18
|
-
it "should not be authorized to create a source" do
|
19
|
-
source.save
|
20
|
-
source.status.should eq 401
|
21
|
-
end
|
22
|
-
|
23
|
-
end
|
24
|
-
|
25
|
-
end
|
26
|
-
|
27
|
-
context "with token" do
|
28
|
-
|
29
|
-
before(:all){ Quandl::Client.token = ENV['QUANDL_USER_TOKEN'] }
|
30
|
-
|
31
|
-
describe "#save" do
|
32
|
-
|
33
|
-
it "should save the source" do
|
34
|
-
source.save
|
35
|
-
source.status.should eq 201
|
36
|
-
end
|
37
|
-
|
38
|
-
it "should update the source" do
|
39
|
-
source.save
|
40
|
-
retrieved_source = Source.find(source.id)
|
41
|
-
retrieved_source.description = "something new #{Time.now}"
|
42
|
-
retrieved_source.save
|
43
|
-
Source.find(source.id).description.should eq retrieved_source.description
|
44
|
-
end
|
45
|
-
|
46
|
-
end
|
47
|
-
|
48
|
-
end
|
49
|
-
|
50
|
-
|
51
|
-
end
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
describe Source do
|
5
|
+
|
6
|
+
let(:source){ build(:source) }
|
7
|
+
|
8
|
+
context "without token" do
|
9
|
+
|
10
|
+
before(:all){ Quandl::Client.token = '' }
|
11
|
+
|
12
|
+
subject{ source }
|
13
|
+
|
14
|
+
its(:valid?){ should be_true }
|
15
|
+
|
16
|
+
describe "#save" do
|
17
|
+
|
18
|
+
it "should not be authorized to create a source" do
|
19
|
+
source.save
|
20
|
+
source.status.should eq 401
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
context "with token" do
|
28
|
+
|
29
|
+
before(:all){ Quandl::Client.token = ENV['QUANDL_USER_TOKEN'] }
|
30
|
+
|
31
|
+
describe "#save" do
|
32
|
+
|
33
|
+
it "should save the source" do
|
34
|
+
source.save
|
35
|
+
source.status.should eq 201
|
36
|
+
end
|
37
|
+
|
38
|
+
it "should update the source" do
|
39
|
+
source.save
|
40
|
+
retrieved_source = Source.find(source.id)
|
41
|
+
retrieved_source.description = "something new #{Time.now}"
|
42
|
+
retrieved_source.save
|
43
|
+
Source.find(source.id).description.should eq retrieved_source.description
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
|
50
|
+
|
51
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,31 +1,31 @@
|
|
1
|
-
$:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
|
2
|
-
|
3
|
-
require "rspec"
|
4
|
-
require 'factory_girl'
|
5
|
-
require 'pry'
|
6
|
-
|
7
|
-
factory_dir = File.join( File.dirname(__FILE__), 'factories/**/*.rb' )
|
8
|
-
Dir.glob( factory_dir ).each{|f| require(f); puts f }
|
9
|
-
|
10
|
-
require "quandl/client"
|
11
|
-
require "quandl/fabricate"
|
12
|
-
|
13
|
-
# Expects two env variables:
|
14
|
-
|
15
|
-
# administrator:
|
16
|
-
# ENV['QUANDL_AUTH_TOKEN']
|
17
|
-
|
18
|
-
# user:
|
19
|
-
# ENV['QUANDL_TEST_TOKEN']
|
20
|
-
|
21
|
-
include Quandl::Client
|
22
|
-
Quandl::Client.token = ENV['QUANDL_AUTH_TOKEN']
|
23
|
-
Quandl::Client.use ENV['QUANDL_TEST_URL']
|
24
|
-
|
25
|
-
RSpec.configure do |config|
|
26
|
-
config.include FactoryGirl::Syntax::Methods
|
27
|
-
end
|
28
|
-
|
29
|
-
def uuid
|
30
|
-
SecureRandom.uuid.to_s
|
1
|
+
$:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
|
2
|
+
|
3
|
+
require "rspec"
|
4
|
+
require 'factory_girl'
|
5
|
+
require 'pry'
|
6
|
+
|
7
|
+
factory_dir = File.join( File.dirname(__FILE__), 'factories/**/*.rb' )
|
8
|
+
Dir.glob( factory_dir ).each{|f| require(f); puts f }
|
9
|
+
|
10
|
+
require "quandl/client"
|
11
|
+
require "quandl/fabricate"
|
12
|
+
|
13
|
+
# Expects two env variables:
|
14
|
+
|
15
|
+
# administrator:
|
16
|
+
# ENV['QUANDL_AUTH_TOKEN']
|
17
|
+
|
18
|
+
# user:
|
19
|
+
# ENV['QUANDL_TEST_TOKEN']
|
20
|
+
|
21
|
+
include Quandl::Client
|
22
|
+
Quandl::Client.token = ENV['QUANDL_AUTH_TOKEN']
|
23
|
+
Quandl::Client.use ENV['QUANDL_TEST_URL']
|
24
|
+
|
25
|
+
RSpec.configure do |config|
|
26
|
+
config.include FactoryGirl::Syntax::Methods
|
27
|
+
end
|
28
|
+
|
29
|
+
def uuid
|
30
|
+
SecureRandom.uuid.to_s
|
31
31
|
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: 2.7.
|
4
|
+
version: 2.7.12
|
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: 2014-05-
|
12
|
+
date: 2014-05-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: quandl_data
|
@@ -260,6 +260,7 @@ files:
|
|
260
260
|
- lib/quandl/client/models/superset.rb
|
261
261
|
- lib/quandl/client/models/user.rb
|
262
262
|
- lib/quandl/client/version.rb
|
263
|
+
- lib/quandl/her/collection.rb
|
263
264
|
- lib/quandl/her/remove_method_data.rb
|
264
265
|
- lib/quandl/pattern.rb
|
265
266
|
- lib/quandl/pattern/client.rb
|
@@ -294,16 +295,39 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
294
295
|
- - ! '>='
|
295
296
|
- !ruby/object:Gem::Version
|
296
297
|
version: '0'
|
298
|
+
segments:
|
299
|
+
- 0
|
300
|
+
hash: -4559514248937987116
|
297
301
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
298
302
|
none: false
|
299
303
|
requirements:
|
300
304
|
- - ! '>='
|
301
305
|
- !ruby/object:Gem::Version
|
302
306
|
version: '0'
|
307
|
+
segments:
|
308
|
+
- 0
|
309
|
+
hash: -4559514248937987116
|
303
310
|
requirements: []
|
304
311
|
rubyforge_project:
|
305
|
-
rubygems_version: 1.8.
|
312
|
+
rubygems_version: 1.8.23
|
306
313
|
signing_key:
|
307
314
|
specification_version: 3
|
308
315
|
summary: Client rest orm.
|
309
|
-
test_files:
|
316
|
+
test_files:
|
317
|
+
- spec/factories/dataset.rb
|
318
|
+
- spec/factories/sheet.rb
|
319
|
+
- spec/factories/source.rb
|
320
|
+
- spec/fixtures/scraper.rb
|
321
|
+
- spec/lib/quandl/client/dataset/attributes_spec.rb
|
322
|
+
- spec/lib/quandl/client/dataset/data_spec.rb
|
323
|
+
- spec/lib/quandl/client/dataset/location_spec.rb
|
324
|
+
- spec/lib/quandl/client/dataset/persistence_spec.rb
|
325
|
+
- spec/lib/quandl/client/dataset/search_spec.rb
|
326
|
+
- spec/lib/quandl/client/dataset/source_spec.rb
|
327
|
+
- spec/lib/quandl/client/dataset/trim_spec.rb
|
328
|
+
- spec/lib/quandl/client/dataset/validation_spec.rb
|
329
|
+
- spec/lib/quandl/client/dataset_spec.rb
|
330
|
+
- spec/lib/quandl/client/scraper_spec.rb
|
331
|
+
- spec/lib/quandl/client/sheet_spec.rb
|
332
|
+
- spec/lib/quandl/client/source_spec.rb
|
333
|
+
- spec/spec_helper.rb
|