quandl_client 2.7.1 → 2.7.2
Sign up to get free protection for your applications and to get access to all the features.
- data/UPGRADE.md +6 -0
- data/VERSION +1 -1
- data/lib/quandl/client/base/search.rb +1 -0
- data/lib/quandl/client/models/dataset.rb +10 -3
- data/lib/quandl/client/models/superset.rb +9 -1
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.7.
|
1
|
+
2.7.2
|
@@ -11,6 +11,15 @@ class Quandl::Client::Dataset < Quandl::Client::Base
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def find(value)
|
14
|
+
# preformat
|
15
|
+
value = format_id(value)
|
16
|
+
# short-circuit if value is illegal
|
17
|
+
return nil unless value.is_a?(Integer) || value.to_s =~ %r{^#{Quandl::Pattern.full_code}$}
|
18
|
+
# search
|
19
|
+
super(value)
|
20
|
+
end
|
21
|
+
|
22
|
+
def format_id(value)
|
14
23
|
# enforce code formatting
|
15
24
|
if value.is_a?(String)
|
16
25
|
# strip extra whitespace
|
@@ -20,9 +29,7 @@ class Quandl::Client::Dataset < Quandl::Client::Base
|
|
20
29
|
# ensure uppercase
|
21
30
|
value = value.upcase
|
22
31
|
end
|
23
|
-
|
24
|
-
return nil unless value.is_a?(Integer) || value.to_s =~ %r{^#{Quandl::Pattern.full_code}$}
|
25
|
-
super(value)
|
32
|
+
value
|
26
33
|
end
|
27
34
|
|
28
35
|
end
|
@@ -10,8 +10,16 @@ class Quandl::Client::Superset < Quandl::Client::Base
|
|
10
10
|
validates :column_codes, presence: true
|
11
11
|
validate :column_codes_should_be_valid!
|
12
12
|
|
13
|
+
def self.find_or_build( attributes={} )
|
14
|
+
record = self.find(attributes[:id]) if attributes[:id].present?
|
15
|
+
record = self.where( attributes.slice(:code, :source_code).merge( owner: 'myself' ) ).first unless record.try(:exists?)
|
16
|
+
record = self.new unless record.try(:exists?)
|
17
|
+
record.assign_attributes(attributes)
|
18
|
+
record
|
19
|
+
end
|
20
|
+
|
13
21
|
def self.example
|
14
|
-
self.new( code: "
|
22
|
+
self.new( code: "SUPERSET_EXAMPLE", name: "Superset Name", description: "Superset description", column_codes: ['NSE.OIL.1'], column_names: ['Column Name'] )
|
15
23
|
end
|
16
24
|
|
17
25
|
def data
|
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.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -296,7 +296,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
296
296
|
version: '0'
|
297
297
|
segments:
|
298
298
|
- 0
|
299
|
-
hash: -
|
299
|
+
hash: -1884002126048003470
|
300
300
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
301
301
|
none: false
|
302
302
|
requirements:
|
@@ -305,7 +305,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
305
305
|
version: '0'
|
306
306
|
segments:
|
307
307
|
- 0
|
308
|
-
hash: -
|
308
|
+
hash: -1884002126048003470
|
309
309
|
requirements: []
|
310
310
|
rubyforge_project:
|
311
311
|
rubygems_version: 1.8.23
|