quandl 1.0.3 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -13
- data/lib/quandl/api_config.rb +5 -3
- data/lib/quandl/connection.rb +16 -16
- data/lib/quandl/model/base.rb +2 -0
- data/lib/quandl/model/data.rb +5 -3
- data/lib/quandl/model/database.rb +3 -3
- data/lib/quandl/model/list.rb +4 -2
- data/lib/quandl/util.rb +1 -1
- data/lib/quandl/version.rb +3 -1
- metadata +13 -70
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 80ea9bcba8e1e41ce54f2597a53c57212446dfb4
|
4
|
+
data.tar.gz: 2ebfbd12cb5cc59320aa7d03e383ee6ccf36df22
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ed08bdf3333b1b60ffdb57a9d9dbeec20b5dd45d0a20d4837e068d3d42731a94fdc8f4f58dab6b45d696955216f0fb42c464daf8f377c347a1bc2ccf7806016
|
7
|
+
data.tar.gz: 3d56f83a6fd3380f1a67ca369d697b6c77b340ce301c24b59c95413c9712f28c2de9e309b7f83266650d1631690be202c76a905b254ec7614c29574acd76705b
|
data/README.md
CHANGED
@@ -2,13 +2,6 @@
|
|
2
2
|
|
3
3
|
The official ruby gem for all your data needs! The Quandl client can be used to interact with the latest version of the [Quandl RESTful API](https://www.quandl.com/docs/api).
|
4
4
|
|
5
|
-
## Deprecation of old package
|
6
|
-
|
7
|
-
With the release of our v3 API we are officially deprecating version 2 of the `quandl_client` ruby gem. We have re-written the package from the ground up and will be moving forward with a 1.x.x package with the name of `quandl` that will rely on version 3 of our restful api. During this transitional period you can continue to use the old package here:
|
8
|
-
|
9
|
-
https://rubygems.org/gems/quandl_client
|
10
|
-
|
11
|
-
|
12
5
|
## Installation
|
13
6
|
|
14
7
|
```ruby
|
@@ -32,7 +25,7 @@ Quandl::ApiConfig.api_version = '2015-04-09'
|
|
32
25
|
|
33
26
|
### Dataset
|
34
27
|
|
35
|
-
Retrieving dataset data can be done in a similar way to Databases. For example to retrieve a dataset use its full code:
|
28
|
+
Retrieving dataset data can be done in a similar way to Databases. For example to retrieve a dataset use its full code:
|
36
29
|
|
37
30
|
```ruby
|
38
31
|
require 'quandl'
|
@@ -189,10 +182,6 @@ databases = Quandl::Database.all.to_csv
|
|
189
182
|
=> "Id,Name,Database Code,Description,Datasets Count,Downloads,Premium,Image,Bundle Ids,Plan ...
|
190
183
|
```
|
191
184
|
|
192
|
-
## Questions/Comments
|
193
|
-
|
194
|
-
For any questions, comments or inquires about this package please open a ticket on the github repo or email the development team at <dev@quandl.com>. For any questions about data provided by the API please email connect@quandl.com
|
195
|
-
|
196
185
|
## Additional Links
|
197
186
|
|
198
187
|
* [Quandl](https://www.quandl.com)
|
@@ -202,4 +191,3 @@ For any questions, comments or inquires about this package please open a ticket
|
|
202
191
|
## License
|
203
192
|
|
204
193
|
[MIT License](http://opensource.org/licenses/MIT)
|
205
|
-
|
data/lib/quandl/api_config.rb
CHANGED
@@ -1,8 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Quandl
|
2
4
|
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'
|
5
|
+
API_KEY_THREAD_KEY = 'quandl_api_key'.freeze
|
6
|
+
API_BASE_THREAD_KEY = 'quandl_api_base'.freeze
|
7
|
+
API_VERSION_THREAD_KEY = 'quandl_api_version_key'.freeze
|
6
8
|
|
7
9
|
@api_key = nil
|
8
10
|
@api_base = nil
|
data/lib/quandl/connection.rb
CHANGED
@@ -46,29 +46,29 @@ module Quandl
|
|
46
46
|
|
47
47
|
case code_letter
|
48
48
|
when 'L'
|
49
|
-
|
50
|
-
resp.headers, code)
|
51
|
-
when 'M'
|
52
|
-
fail InternalServerError.new(message, resp.code, resp.body, error_body,
|
49
|
+
raise LimitExceededError.new(message, resp.code, resp.body, error_body,
|
53
50
|
resp.headers, code)
|
51
|
+
when 'M'
|
52
|
+
raise InternalServerError.new(message, resp.code, resp.body, error_body,
|
53
|
+
resp.headers, code)
|
54
54
|
when 'A'
|
55
|
-
|
56
|
-
|
55
|
+
raise AuthenticationError.new(message, resp.code, resp.body, error_body,
|
56
|
+
resp.headers, code)
|
57
57
|
when 'P'
|
58
|
-
|
59
|
-
|
58
|
+
raise ForbiddenError.new(message, resp.code, resp.body, error_body,
|
59
|
+
resp.headers, code)
|
60
60
|
when 'S'
|
61
|
-
|
62
|
-
|
61
|
+
raise InvalidRequestError.new(message, resp.code, resp.body, error_body,
|
62
|
+
resp.headers, code)
|
63
63
|
when 'C'
|
64
|
-
|
65
|
-
|
64
|
+
raise NotFoundError.new(message, resp.code, resp.body, error_body,
|
65
|
+
resp.headers, code)
|
66
66
|
when 'X'
|
67
|
-
|
68
|
-
|
67
|
+
raise ServiceUnavailableError.new(message, resp.code, resp.body,
|
68
|
+
error_body, resp.headers, code)
|
69
69
|
else
|
70
|
-
|
71
|
-
|
70
|
+
raise QuandlError.new(message, resp.code, resp.body, error_body,
|
71
|
+
resp.headers, code)
|
72
72
|
end
|
73
73
|
end
|
74
74
|
end
|
data/lib/quandl/model/base.rb
CHANGED
@@ -22,10 +22,12 @@ module Quandl
|
|
22
22
|
|
23
23
|
private
|
24
24
|
|
25
|
+
# rubocop:disable MethodMissing
|
25
26
|
def method_missing(method_name, *args, &block)
|
26
27
|
return @raw_data[method_name.to_s] if @raw_data.key?(method_name.to_s)
|
27
28
|
return @raw_data.method(method_name.to_s).call(*args, &block) if @raw_data.respond_to?(method_name.to_s)
|
28
29
|
super
|
29
30
|
end
|
31
|
+
# rubocop:enable MethodMissing
|
30
32
|
end
|
31
33
|
end
|
data/lib/quandl/model/data.rb
CHANGED
@@ -3,10 +3,10 @@ module Quandl
|
|
3
3
|
include Quandl::Operations::List
|
4
4
|
|
5
5
|
def self.create_list_from_response(_response, data)
|
6
|
-
if data['dataset_data']['data'].
|
6
|
+
if !data['dataset_data']['data'].empty? &&
|
7
7
|
data['dataset_data']['column_names'].length != data['dataset_data']['data'].first.length
|
8
|
-
|
9
|
-
|
8
|
+
raise InvalidDataError.new('number of column names does not match number of data points in a row!',
|
9
|
+
nil, nil, data)
|
10
10
|
end
|
11
11
|
values = data['dataset_data'].delete('data')
|
12
12
|
metadata = data['dataset_data']
|
@@ -29,9 +29,11 @@ module Quandl
|
|
29
29
|
|
30
30
|
private
|
31
31
|
|
32
|
+
# rubocop:disable MethodMissing
|
32
33
|
def method_missing(method_name, *args, &block)
|
33
34
|
return @meta[method_name.to_s] if @meta.key?(method_name.to_s)
|
34
35
|
super
|
35
36
|
end
|
37
|
+
# rubocop:enable MethodMissing
|
36
38
|
end
|
37
39
|
end
|
@@ -29,7 +29,7 @@ module Quandl
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def bulk_download_to_file(file_or_folder_path, options = {})
|
32
|
-
|
32
|
+
raise(QuandlError, 'You must specific a file handle or folder to write to.') if file_or_folder_path.blank?
|
33
33
|
|
34
34
|
# Retrieve the location of the bulk download url
|
35
35
|
path = bulk_download_path
|
@@ -37,8 +37,8 @@ module Quandl
|
|
37
37
|
if response.code == 302
|
38
38
|
response.headers[:location]
|
39
39
|
else
|
40
|
-
Quandl::Connection.handle_api_error(response) if response
|
41
|
-
|
40
|
+
Quandl::Connection.handle_api_error(response) if response && response.body
|
41
|
+
raise(QuandlError, 'Unexpected result when fetching bulk download URI.')
|
42
42
|
end
|
43
43
|
end
|
44
44
|
uri = URI.parse(download_url)
|
data/lib/quandl/model/list.rb
CHANGED
@@ -10,7 +10,7 @@ module Quandl
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def more_results?
|
13
|
-
|
13
|
+
raise(QuandlError, "#{@klass} does not support pagination yet") if !@meta.key?('total_pages') && !@meta.key?('current_page')
|
14
14
|
@meta['total_pages'] > @meta['current_page']
|
15
15
|
end
|
16
16
|
|
@@ -19,7 +19,7 @@ module Quandl
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def to_csv
|
22
|
-
|
22
|
+
raise(QuandlError, 'No values to export') if @values.empty?
|
23
23
|
|
24
24
|
CSV.generate do |csv|
|
25
25
|
csv << @values.first.column_names
|
@@ -35,11 +35,13 @@ module Quandl
|
|
35
35
|
|
36
36
|
private
|
37
37
|
|
38
|
+
# rubocop:disable MethodMissing
|
38
39
|
def method_missing(method_name, *args, &block)
|
39
40
|
return @meta[method_name.to_s] if @meta.key?(method_name.to_s)
|
40
41
|
return @meta[*args] if method_name.to_s == '[]' && @meta.key?(args[0].to_s)
|
41
42
|
return @values.method(method_name).call(*args, &block) if @values.respond_to?(method_name)
|
42
43
|
super
|
43
44
|
end
|
45
|
+
# rubocop:enable MethodMissing
|
44
46
|
end
|
45
47
|
end
|
data/lib/quandl/util.rb
CHANGED
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.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Clement Leung
|
@@ -9,78 +9,50 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2017-05-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- - "
|
18
|
+
- - "~>"
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: 4.2.
|
20
|
+
version: 4.2.8
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
|
-
- - "
|
25
|
+
- - "~>"
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: 4.2.
|
27
|
+
version: 4.2.8
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: rest-client
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
32
|
- - "~>"
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version:
|
34
|
+
version: 2.0.2
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
39
|
- - "~>"
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version:
|
41
|
+
version: 2.0.2
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: json
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
46
|
- - "~>"
|
47
47
|
- !ruby/object:Gem::Version
|
48
|
-
version: 1.
|
48
|
+
version: 2.1.0
|
49
49
|
type: :runtime
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
53
|
- - "~>"
|
54
54
|
- !ruby/object:Gem::Version
|
55
|
-
version: 1.
|
56
|
-
- !ruby/object:Gem::Dependency
|
57
|
-
name: bundler
|
58
|
-
requirement: !ruby/object:Gem::Requirement
|
59
|
-
requirements:
|
60
|
-
- - "~>"
|
61
|
-
- !ruby/object:Gem::Version
|
62
|
-
version: '1.10'
|
63
|
-
type: :development
|
64
|
-
prerelease: false
|
65
|
-
version_requirements: !ruby/object:Gem::Requirement
|
66
|
-
requirements:
|
67
|
-
- - "~>"
|
68
|
-
- !ruby/object:Gem::Version
|
69
|
-
version: '1.10'
|
70
|
-
- !ruby/object:Gem::Dependency
|
71
|
-
name: rake
|
72
|
-
requirement: !ruby/object:Gem::Requirement
|
73
|
-
requirements:
|
74
|
-
- - "~>"
|
75
|
-
- !ruby/object:Gem::Version
|
76
|
-
version: '10.0'
|
77
|
-
type: :development
|
78
|
-
prerelease: false
|
79
|
-
version_requirements: !ruby/object:Gem::Requirement
|
80
|
-
requirements:
|
81
|
-
- - "~>"
|
82
|
-
- !ruby/object:Gem::Version
|
83
|
-
version: '10.0'
|
55
|
+
version: 2.1.0
|
84
56
|
- !ruby/object:Gem::Dependency
|
85
57
|
name: rspec
|
86
58
|
requirement: !ruby/object:Gem::Requirement
|
@@ -95,34 +67,20 @@ dependencies:
|
|
95
67
|
- - ">="
|
96
68
|
- !ruby/object:Gem::Version
|
97
69
|
version: '0'
|
98
|
-
- !ruby/object:Gem::Dependency
|
99
|
-
name: pry-byebug
|
100
|
-
requirement: !ruby/object:Gem::Requirement
|
101
|
-
requirements:
|
102
|
-
- - "~>"
|
103
|
-
- !ruby/object:Gem::Version
|
104
|
-
version: 3.1.0
|
105
|
-
type: :development
|
106
|
-
prerelease: false
|
107
|
-
version_requirements: !ruby/object:Gem::Requirement
|
108
|
-
requirements:
|
109
|
-
- - "~>"
|
110
|
-
- !ruby/object:Gem::Version
|
111
|
-
version: 3.1.0
|
112
70
|
- !ruby/object:Gem::Dependency
|
113
71
|
name: webmock
|
114
72
|
requirement: !ruby/object:Gem::Requirement
|
115
73
|
requirements:
|
116
74
|
- - "~>"
|
117
75
|
- !ruby/object:Gem::Version
|
118
|
-
version:
|
76
|
+
version: 3.0.1
|
119
77
|
type: :development
|
120
78
|
prerelease: false
|
121
79
|
version_requirements: !ruby/object:Gem::Requirement
|
122
80
|
requirements:
|
123
81
|
- - "~>"
|
124
82
|
- !ruby/object:Gem::Version
|
125
|
-
version:
|
83
|
+
version: 3.0.1
|
126
84
|
- !ruby/object:Gem::Dependency
|
127
85
|
name: factory_girl
|
128
86
|
requirement: !ruby/object:Gem::Requirement
|
@@ -137,20 +95,6 @@ dependencies:
|
|
137
95
|
- - "~>"
|
138
96
|
- !ruby/object:Gem::Version
|
139
97
|
version: 4.5.0
|
140
|
-
- !ruby/object:Gem::Dependency
|
141
|
-
name: rubocopter
|
142
|
-
requirement: !ruby/object:Gem::Requirement
|
143
|
-
requirements:
|
144
|
-
- - ">="
|
145
|
-
- !ruby/object:Gem::Version
|
146
|
-
version: '0'
|
147
|
-
type: :development
|
148
|
-
prerelease: false
|
149
|
-
version_requirements: !ruby/object:Gem::Requirement
|
150
|
-
requirements:
|
151
|
-
- - ">="
|
152
|
-
- !ruby/object:Gem::Version
|
153
|
-
version: '0'
|
154
98
|
description: A ruby implementation of the quandl client to be used as an ORM for quandl's
|
155
99
|
restful APIs.
|
156
100
|
email:
|
@@ -194,9 +138,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
194
138
|
version: '0'
|
195
139
|
requirements: []
|
196
140
|
rubyforge_project:
|
197
|
-
rubygems_version: 2.
|
141
|
+
rubygems_version: 2.6.12
|
198
142
|
signing_key:
|
199
143
|
specification_version: 4
|
200
144
|
summary: An ORM interface into the quandl api.
|
201
145
|
test_files: []
|
202
|
-
has_rdoc:
|