quandl_client 2.4.1 → 2.4.2

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: d4ca9b23ab2967c5a4022b45ba6c0ca55e2978a2
4
- data.tar.gz: 5d9cf30414c5375de68a9f2511479438d73113a0
3
+ metadata.gz: d222b6568a424c6165fe84f631fb6909017c50fa
4
+ data.tar.gz: 98601a107de7563ced984f4cef9535c8eb236846
5
5
  SHA512:
6
- metadata.gz: 2b38ace5101e92948d26a20aeba3049517c02a946bfa617c668bf560e18238e6e0b2a4385cedc8e7827514193df082fc7baf08e8ab7ce185765d9002ad271616
7
- data.tar.gz: 4f85c8622f1da630055f6a9320f67a1d827cdc6a58790024090b5a7b2b4db16faae560cb39b9e078b4c74577e25a91b42c74cd1e51dd7352721615734df50ca5
6
+ metadata.gz: 94625b5c6c237732457a5ddeb9de0c1d1eab3c5c849c1ffc70d4a11cea3ad842ca6495387f4ad564e5ee6dc5993f6ef2bfbfa54042c0fdfae744e4036e137c70
7
+ data.tar.gz: 58fb42c03d9ce26b0e7df4064c60f95932697fd89a482c8267d36279def0ea00ee4336e17a0b06e117188456fcad79215e2275d5e6918ab7466bb73938c9e115
data/UPGRADE.md CHANGED
@@ -1,3 +1,8 @@
1
+ # 2.4.2
2
+
3
+ * Dataset.find will return nil unless the id is an integer, or matches the quandl pattern for full_code
4
+
5
+
1
6
  # 2.4.1
2
7
 
3
8
  * revise reference_url http prepend
data/examples/create.rb CHANGED
@@ -12,7 +12,7 @@ require 'pry'
12
12
  include Quandl::Client
13
13
 
14
14
  # configure quandl client
15
- Quandl::Client.use ENV['QUANDL_API_HOST']
15
+ Quandl::Client.use ENV['QUANDL_TEST_URL']
16
16
  Quandl::Client.token = ENV['QUANDL_TEST_TOKEN']
17
17
 
18
18
  binding.pry
data/examples/login.rb CHANGED
@@ -5,7 +5,7 @@ require "quandl/client"
5
5
 
6
6
  include Quandl::Client
7
7
 
8
- Quandl::Client.use ENV['QUANDL_API_HOST']
8
+ Quandl::Client.use ENV['QUANDL_TEST_URL']
9
9
  Quandl::Client.token = ENV['QUANDL_TEST_TOKEN']
10
10
 
11
11
  u = User.login( login: 'blakehil', password: 'example' )
data/examples/search.rb CHANGED
@@ -5,8 +5,7 @@ require "quandl/client"
5
5
 
6
6
  include Quandl::Client
7
7
 
8
- Quandl::Client.use ENV['QUANDL_API_HOST']
9
- # Quandl::Client.use 'http://staging.quandl.com/api/'
8
+ Quandl::Client.use ENV['QUANDL_TEST_URL']
10
9
  Quandl::Client.token = ENV['QUANDL_TEST_TOKEN']
11
10
 
12
11
  datasets = Dataset.query('water').all
@@ -5,9 +5,17 @@ class Quandl::Client::Dataset < Quandl::Client::Base
5
5
  ##########
6
6
  # SCOPES #
7
7
  ##########
8
+ class << self
9
+ def touch_existing(id)
10
+ put(File.join(Quandl::Client::Base.url_with_version, "datasets/#{id}/touch")).exists?
11
+ end
12
+
13
+ def find(value)
14
+ # short-circuit if value is illegal
15
+ return nil unless value.is_a?(Integer) || value.to_s =~ %r{^#{Quandl::Pattern.full_code}$}
16
+ super(value)
17
+ end
8
18
 
9
- def self.touch_existing(id)
10
- put(File.join(Quandl::Client::Base.url_with_version, "datasets/#{id}/touch")).exists?
11
19
  end
12
20
 
13
21
  # SEARCH
@@ -1,6 +1,6 @@
1
1
  module Quandl
2
2
  module Client
3
- VERSION = '2.4.1'
3
+ VERSION = '2.4.2'
4
4
  API_VERSION = 'v2'
5
5
 
6
6
  class << self
@@ -5,6 +5,22 @@ describe Dataset do
5
5
  let(:dataset){ create(:dataset) }
6
6
  subject{ dataset }
7
7
 
8
+ describe ".find" do
9
+ subject{ Dataset.find(query) }
10
+ context "given nil" do
11
+ let(:query){ nil }
12
+ it{ should be_nil }
13
+ end
14
+ context "given empty string" do
15
+ let(:query){ '' }
16
+ it{ should be_nil }
17
+ end
18
+ context "given non-code value" do
19
+ let(:query){ '/' }
20
+ it{ should be_nil }
21
+ end
22
+ end
23
+
8
24
  describe ".touch_existing(:id)" do
9
25
  it "should touch the dataset" do
10
26
  dataset.updated_at
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.1
4
+ version: 2.4.2
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-22 00:00:00.000000000 Z
11
+ date: 2014-01-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake