quandl 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/quandl/connection.rb +1 -1
- data/lib/quandl/version.rb +1 -1
- metadata +3 -5
- data/lib/quandl/api_config.rb.orig +0 -48
- data/lib/quandl/model/list.rb.orig +0 -48
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3a80d550c3a42a20073ce20ec17b9565e3dacd26
|
4
|
+
data.tar.gz: 1377601b7d60dfc17faa807d25add882bc4418e0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 481d5c5b7a5089c23a9abba7c52ffcc48aa626f70f7c221f16ea1e552a367c4bf1fa5e48aea2cc1bf93eeefd1bc961f5ee8a9d1d32321c6a7cd3a6053ae32810
|
7
|
+
data.tar.gz: d2f63dcf21bfc4be9bf169ea161f32ce32ac30f1cb0c8ad6aeb01ac942ea10bf743f5054cbc0dbbf9fbed390de419bdbba7ad9e02ff695981549515bd8788c5c
|
data/lib/quandl/connection.rb
CHANGED
@@ -5,7 +5,7 @@ module Quandl
|
|
5
5
|
headers = options.delete(:headers) || {}
|
6
6
|
accept_value = 'application/json'
|
7
7
|
accept_value += ", application/vnd.quandl+json;version=#{ApiConfig.api_version}" if ApiConfig.api_version
|
8
|
-
headers = { accept: accept_value }.merge(headers)
|
8
|
+
headers = { accept: accept_value, request_source: 'ruby', request_source_version: Quandl::VERSION }.merge(headers)
|
9
9
|
headers = { x_api_token: ApiConfig.api_key }.merge(headers) if ApiConfig.api_key
|
10
10
|
|
11
11
|
request_url = ApiConfig.api_base + '/' + url
|
data/lib/quandl/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: quandl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Clement Leung
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-08-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -162,7 +162,6 @@ files:
|
|
162
162
|
- README.md
|
163
163
|
- lib/quandl.rb
|
164
164
|
- lib/quandl/api_config.rb
|
165
|
-
- lib/quandl/api_config.rb.orig
|
166
165
|
- lib/quandl/connection.rb
|
167
166
|
- lib/quandl/errors/quandl_error.rb
|
168
167
|
- lib/quandl/model/base.rb
|
@@ -170,7 +169,6 @@ files:
|
|
170
169
|
- lib/quandl/model/database.rb
|
171
170
|
- lib/quandl/model/dataset.rb
|
172
171
|
- lib/quandl/model/list.rb
|
173
|
-
- lib/quandl/model/list.rb.orig
|
174
172
|
- lib/quandl/operations/base.rb
|
175
173
|
- lib/quandl/operations/get.rb
|
176
174
|
- lib/quandl/operations/list.rb
|
@@ -196,7 +194,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
196
194
|
version: '0'
|
197
195
|
requirements: []
|
198
196
|
rubyforge_project:
|
199
|
-
rubygems_version: 2.4.
|
197
|
+
rubygems_version: 2.4.5
|
200
198
|
signing_key:
|
201
199
|
specification_version: 4
|
202
200
|
summary: An ORM interface into the quandl api.
|
@@ -1,48 +0,0 @@
|
|
1
|
-
module Quandl
|
2
|
-
class ApiConfig
|
3
|
-
API_KEY_THREAD_KEY = 'quandl_api_key'
|
4
|
-
API_BASE_THREAD_KEY = 'quandl_api_base'
|
5
|
-
API_VERSION_THREAD_KEY = 'quandl_api_version_key'
|
6
|
-
<<<<<<< HEAD
|
7
|
-
=======
|
8
|
-
DEFAULT_PER_PAGE_THREAD_KEY = 'default_per_page'
|
9
|
-
>>>>>>> abd0bfd... Implement Database and Dataset get and list
|
10
|
-
|
11
|
-
class << self
|
12
|
-
def api_key=(api_key)
|
13
|
-
Thread.current[API_KEY_THREAD_KEY] = api_key
|
14
|
-
end
|
15
|
-
|
16
|
-
def api_key
|
17
|
-
Thread.current[API_KEY_THREAD_KEY]
|
18
|
-
end
|
19
|
-
|
20
|
-
def api_base=(api_base)
|
21
|
-
Thread.current[API_BASE_THREAD_KEY] = api_base
|
22
|
-
end
|
23
|
-
|
24
|
-
def api_base
|
25
|
-
Thread.current[API_BASE_THREAD_KEY] || 'https://www.quandl.com/api/v3'
|
26
|
-
end
|
27
|
-
|
28
|
-
def api_version=(api_version)
|
29
|
-
Thread.current[API_VERSION_THREAD_KEY] = api_version
|
30
|
-
end
|
31
|
-
|
32
|
-
def api_version
|
33
|
-
Thread.current[API_VERSION_THREAD_KEY]
|
34
|
-
end
|
35
|
-
<<<<<<< HEAD
|
36
|
-
=======
|
37
|
-
|
38
|
-
def default_per_page=(per_page)
|
39
|
-
Thread.current[DEFAULT_PER_PAGE_THREAD_KEY] = per_page
|
40
|
-
end
|
41
|
-
|
42
|
-
def default_per_page
|
43
|
-
Thread.current[DEFAULT_PER_PAGE_THREAD_KEY] || 25
|
44
|
-
end
|
45
|
-
>>>>>>> abd0bfd... Implement Database and Dataset get and list
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
@@ -1,48 +0,0 @@
|
|
1
|
-
module Quandl
|
2
|
-
class List
|
3
|
-
attr_reader :meta
|
4
|
-
attr_reader :values
|
5
|
-
|
6
|
-
def initialize(klass, values, meta)
|
7
|
-
@klass = klass
|
8
|
-
@values = values.map { |v| klass.new(v, meta: meta) }
|
9
|
-
@meta = meta
|
10
|
-
end
|
11
|
-
|
12
|
-
def more_results?
|
13
|
-
<<<<<<< HEAD
|
14
|
-
=======
|
15
|
-
fail(QuandlError, "#{@klass} does not support pagination yet") if !@meta.key?('total_pages') && !@meta.key?('current_page')
|
16
|
-
>>>>>>> b480b01... pre-release version of quandl gem
|
17
|
-
@meta['total_pages'] > @meta['current_page']
|
18
|
-
end
|
19
|
-
|
20
|
-
def to_a
|
21
|
-
@values.map(&:to_a)
|
22
|
-
end
|
23
|
-
|
24
|
-
def to_csv
|
25
|
-
fail(QuandlError, 'No values to export') if @values.empty?
|
26
|
-
|
27
|
-
CSV.generate do |csv|
|
28
|
-
csv << @values.first.column_names
|
29
|
-
@values.each do |row|
|
30
|
-
csv << row.to_a
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
def inspect
|
36
|
-
{ meta: @meta, values: @values }.to_s
|
37
|
-
end
|
38
|
-
|
39
|
-
private
|
40
|
-
|
41
|
-
def method_missing(method_name, *args, &block)
|
42
|
-
return @meta[method_name.to_s] if @meta.key?(method_name.to_s)
|
43
|
-
return @meta[*args] if method_name.to_s == '[]' && @meta.key?(args[0].to_s)
|
44
|
-
return @values.method(method_name).call(*args, &block) if @values.respond_to?(method_name)
|
45
|
-
super
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|