quandl_client 2.8.0 → 2.9.0

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -5,14 +5,8 @@ require "rspec/core/rake_task"
5
5
  $:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
6
6
 
7
7
  require 'pry'
8
- require "quandl/client"
9
8
 
10
- include Quandl::Client
11
-
12
- config = OpenStruct.new(YAML.load(File.read("#{ENV['HOME']}/.quandl/config")))
13
-
14
- Quandl::Client.use config.quandl_url
15
- Quandl::Client.token = config.token
9
+ require_relative 'spec/config/quandl'
16
10
 
17
11
  task :default => :spec
18
12
 
data/UPGRADE.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 2.9.0
2
+
3
+ * QUGC-189 bump data
4
+
5
+
6
+
1
7
  ## 2.8.0
2
8
 
3
9
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.8.0
1
+ 2.9.0
@@ -17,7 +17,7 @@ Gem::Specification.new do |s|
17
17
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
18
18
  s.require_paths = ["lib"]
19
19
 
20
- s.add_runtime_dependency "quandl_data", "~> 1.4"
20
+ s.add_runtime_dependency "quandl_data", "~> 1.5"
21
21
  s.add_runtime_dependency "activesupport", ">= 3.0.0"
22
22
  s.add_runtime_dependency "her", "~> 0.6"
23
23
  s.add_runtime_dependency 'json', '~> 1.7.7'
@@ -0,0 +1,16 @@
1
+ require 'ostruct'
2
+ require 'yaml'
3
+
4
+ module Spec
5
+ module Config
6
+ Quandl = OpenStruct.new(YAML.load(File.read(File.join(ENV['HOME'], '.quandl/test'))))
7
+ end
8
+ end
9
+
10
+ require "quandl/client"
11
+ require "quandl/fabricate"
12
+
13
+ include Quandl::Client
14
+
15
+ Quandl::Client.token = Spec::Config::Quandl.token
16
+ Quandl::Client.use( Spec::Config::Quandl.quandl_url )
@@ -12,12 +12,12 @@ describe Dataset do
12
12
 
13
13
  describe "#code" do
14
14
  subject{ build(:dataset, source_code: source.code.downcase ) }
15
- before(:each){}
16
- it "lowercase code should be valid" do
17
- subject.code = subject.code.downcase
15
+ before(:each){
16
+ subject.code = subject.code.downcase
18
17
  subject.save
19
- subject.saved?.should be_true
20
- end
18
+ }
19
+ its('errors.messages'){ should eq({}) }
20
+ its(:saved?){ should be_true }
21
21
 
22
22
  end
23
23
 
@@ -24,7 +24,7 @@ describe Dataset do
24
24
 
25
25
  its(:request_started_at){ should be_a Time }
26
26
 
27
- after(:all){ Quandl::Client.token = ENV['QUANDL_AUTH_TOKEN'] }
27
+ after(:all){ Quandl::Client.token = Spec::Config::Quandl.token}
28
28
  end
29
29
  context "with token" do
30
30
 
@@ -92,13 +92,13 @@ describe Dataset do
92
92
  it "should not delete the dataset with a user token" do
93
93
  id = dataset.id
94
94
  # behave as a user
95
- Quandl::Client.token = ENV['QUANDL_TEST_TOKEN']
95
+ Quandl::Client.token = Spec::Config::Quandl.user_token
96
96
  user_dataset = Dataset.find(id)
97
97
  user_dataset.destroy
98
98
  user_dataset.status.should eq 403
99
99
  end
100
100
 
101
- after(:all){ Quandl::Client.token = ENV['QUANDL_AUTH_TOKEN'] }
101
+ after(:all){ Quandl::Client.token = Spec::Config::Quandl.token}
102
102
 
103
103
  end
104
104
 
@@ -24,7 +24,7 @@ describe Dataset do
24
24
 
25
25
  context "normal user" do
26
26
  # behave as a user
27
- before(:all){ Quandl::Client.token = ENV['QUANDL_TEST_TOKEN'] }
27
+ before(:all){ Quandl::Client.token = Spec::Config::Quandl.user_token }
28
28
 
29
29
  its(:saved?){ should be_true }
30
30
  its(:source_code){ should be_present }
@@ -41,7 +41,7 @@ describe Dataset do
41
41
  its(:status){ should be 422 }
42
42
  end
43
43
 
44
- after(:all){ Quandl::Client.token = ENV['QUANDL_AUTH_TOKEN'] }
44
+ after(:all){ Quandl::Client.token = Spec::Config::Quandl.token}
45
45
  end
46
46
 
47
47
  end
@@ -50,7 +50,7 @@ describe Dataset do
50
50
 
51
51
  describe "#code" do
52
52
 
53
- before(:all){ Quandl::Client.token = ENV['QUANDL_AUTH_TOKEN'] }
53
+ before(:all){ Quandl::Client.token = Spec::Config::Quandl.token}
54
54
 
55
55
  let(:dataset){ create(:dataset, source_code: "QUANDL_CLIENT_TEST_SOURCE" ) }
56
56
  let(:invalid_dataset){ create(:dataset, source_code: "QUANDL_CLIENT_TEST_SOURCE", code: dataset.code ) }
@@ -62,7 +62,6 @@ describe Scraper do
62
62
  its(:valid?){ should be_true }
63
63
  its(:saved?){ should be_true }
64
64
  its(:id){ should be_present }
65
- its(:scraper_url){ should be_blank }
66
65
  its(:git_url){ should match /git@github.com:tammer\/scrapers/ }
67
66
  its(:type){ should eq 'Scraper::Git' }
68
67
  end
@@ -3,7 +3,7 @@ require 'spec_helper'
3
3
 
4
4
  describe Sheet do
5
5
 
6
- before(:all){ Quandl::Client.token = ENV['QUANDL_AUTH_TOKEN'] }
6
+ before(:all){ Quandl::Client.token = Spec::Config::Quandl.token}
7
7
 
8
8
  let(:sheet){ build(:sheet) }
9
9
 
data/spec/spec_helper.rb CHANGED
@@ -7,20 +7,7 @@ require 'pry'
7
7
  factory_dir = File.join( File.dirname(__FILE__), 'factories/**/*.rb' )
8
8
  Dir.glob( factory_dir ).each{|f| require(f); puts f }
9
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']
10
+ require_relative 'config/quandl'
24
11
 
25
12
  RSpec.configure do |config|
26
13
  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: 2.8.0
4
+ version: 2.9.0
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-09 00:00:00.000000000 Z
12
+ date: 2014-05-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: quandl_data
@@ -18,7 +18,7 @@ dependencies:
18
18
  requirements:
19
19
  - - ~>
20
20
  - !ruby/object:Gem::Version
21
- version: '1.4'
21
+ version: '1.5'
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - ~>
28
28
  - !ruby/object:Gem::Version
29
- version: '1.4'
29
+ version: '1.5'
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: activesupport
32
32
  requirement: !ruby/object:Gem::Requirement
@@ -237,11 +237,6 @@ files:
237
237
  - Rakefile
238
238
  - UPGRADE.md
239
239
  - VERSION
240
- - examples/create.rb
241
- - examples/find.rb
242
- - examples/login.rb
243
- - examples/search.rb
244
- - examples/trims.rb
245
240
  - lib/quandl/client.rb
246
241
  - lib/quandl/client/base.rb
247
242
  - lib/quandl/client/base/attributes.rb
@@ -265,6 +260,7 @@ files:
265
260
  - lib/quandl/pattern.rb
266
261
  - lib/quandl/pattern/client.rb
267
262
  - quandl_client.gemspec
263
+ - spec/config/quandl.rb
268
264
  - spec/factories/dataset.rb
269
265
  - spec/factories/sheet.rb
270
266
  - spec/factories/source.rb
@@ -297,7 +293,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
297
293
  version: '0'
298
294
  segments:
299
295
  - 0
300
- hash: -643351477117918374
296
+ hash: -2699454688999143444
301
297
  required_rubygems_version: !ruby/object:Gem::Requirement
302
298
  none: false
303
299
  requirements:
@@ -306,7 +302,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
306
302
  version: '0'
307
303
  segments:
308
304
  - 0
309
- hash: -643351477117918374
305
+ hash: -2699454688999143444
310
306
  requirements: []
311
307
  rubyforge_project:
312
308
  rubygems_version: 1.8.23
@@ -314,6 +310,7 @@ signing_key:
314
310
  specification_version: 3
315
311
  summary: Client rest orm.
316
312
  test_files:
313
+ - spec/config/quandl.rb
317
314
  - spec/factories/dataset.rb
318
315
  - spec/factories/sheet.rb
319
316
  - spec/factories/source.rb
data/examples/create.rb DELETED
@@ -1,32 +0,0 @@
1
- $:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
2
-
3
- # load quandl api client
4
- require "quandl/client"
5
-
6
- # tools for debugging
7
- require "quandl/fabricate"
8
- require 'securerandom'
9
- require 'pry'
10
-
11
- # Make Dataset available in global namespace
12
- include Quandl::Client
13
-
14
- # configure quandl client
15
- Quandl::Client.use ENV['QUANDL_TEST_URL']
16
- Quandl::Client.token = ENV['QUANDL_TEST_TOKEN']
17
-
18
- # set some attributes
19
- d = Dataset.new(
20
- code: "MY_DATASET_#{Time.now.to_i.to_s(16)}",
21
- name: "My dataset has a name.",
22
- description: "This is the description.",
23
- data: [[ 2014, 1, 2 ]]
24
- )
25
- # POST to server
26
- d.save
27
-
28
- if d.saved?
29
- puts "View your new dataset at: #{d.full_url}"
30
- else
31
- puts "Something went wrong:\n#{d.human_status}\n#{d.human_error_messages}"
32
- end
data/examples/find.rb DELETED
@@ -1,18 +0,0 @@
1
- $:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
2
-
3
- # DEBUGGING
4
- require 'pry'
5
- require "quandl/fabricate"
6
-
7
- # LOAD
8
- require "quandl/client"
9
- include Quandl::Client
10
-
11
- # CONFIGURE
12
- Quandl::Client.use ENV['QUANDL_URL']
13
- Quandl::Client.token = ENV['QUANDL_TOKEN']
14
-
15
- # FIND
16
- d = Dataset.find('MCX.ALMG2014')
17
-
18
- binding.pry
data/examples/login.rb DELETED
@@ -1,13 +0,0 @@
1
- $:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
2
-
3
- require 'pry'
4
- require "quandl/client"
5
-
6
- include Quandl::Client
7
-
8
- Quandl::Client.use ENV['QUANDL_TEST_URL']
9
- Quandl::Client.token = ENV['QUANDL_TEST_TOKEN']
10
-
11
- u = User.login( login: 'blakehil', password: 'example' )
12
-
13
- binding.pry
data/examples/search.rb DELETED
@@ -1,13 +0,0 @@
1
- $:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
2
-
3
- require 'pry'
4
- require "quandl/client"
5
-
6
- include Quandl::Client
7
-
8
- Quandl::Client.use ENV['QUANDL_TEST_URL']
9
- Quandl::Client.token = ENV['QUANDL_TEST_TOKEN']
10
-
11
- datasets = Dataset.query('water').all
12
-
13
- binding.pry
data/examples/trims.rb DELETED
@@ -1,16 +0,0 @@
1
- $:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
2
-
3
- require 'pry'
4
- require "quandl/client"
5
-
6
- include Quandl::Client
7
-
8
- Quandl::Client.use 'http://quandl.com/api/'
9
- Quandl::Client.token = ENV['QUANDL_TEST_TOKEN']
10
-
11
- # create dataset
12
- d = Dataset.find('NSE/OIL')
13
-
14
- data = d.data.trim_start( 3.weeks.ago ).limit(10)
15
-
16
- binding.pry