quandl 1.1.0 → 1.1.1

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
- SHA1:
3
- metadata.gz: 25ffd1e5e9c3fbdd7ff563d58acb81cab3055277
4
- data.tar.gz: 36bc78f61265575606b1dce740a6c7981b19bf0e
2
+ SHA256:
3
+ metadata.gz: 8481bd2e2b3c7f1cf717957487dd202dd480499ca654a158b3f2c05d6d79a849
4
+ data.tar.gz: dae3cfe235ca3195fd537bca6a1ac9a4a74f91d8f8110e85cd9a04f145a3d7fe
5
5
  SHA512:
6
- metadata.gz: 4aeff43b56a7f9202c50b6eed100d72431b3da979dba515f8a7fe3d993b4caa9c59a3b3c406a042e37c0dbe7d5a9384aee09be14ca75d7e073e697bba5b5de89
7
- data.tar.gz: 5fa0406218d01c38fe57d0089973809398f968dcd15b1ad090eacab6f6291b0a2576c61c9736b913976397d8b5cfcec96ae7746572ef8ba8354a6adb9324d3da
6
+ metadata.gz: 16e109f9880cabb3fd880e4a5dc1b68c9bb7bd179137b67de8812cf6ded8c1a73dc89b4e262c877840d6ce43b89802f8ed31a680fc1287a33f423cd7d6d32acd
7
+ data.tar.gz: 7b67c735c72a6170a0aa00c328cd21af6743c8ce1f40f4dc072b71a7fc256fbf842099d5f18b8b4b01e9198d37446c2442bc920fde931a32c2da75146908c627
data/README.md CHANGED
@@ -53,7 +53,7 @@ Quandl::Dataset.get('WIKI/AAPL').data
53
53
  => ... data ...
54
54
  ```
55
55
 
56
- you can access the data much like you would other lists. In addition all the data column fields are mapped to their column_names for convenience:
56
+ You can access the data much like you would other lists. In addition all the data column fields are mapped to their column_names for convenience:
57
57
 
58
58
  ```ruby
59
59
  Quandl::Dataset.get('WIKI/AAPL').data.first.date
@@ -120,7 +120,7 @@ database.data_fields
120
120
  => ["id", "name", "database_code", "description", "datasets_count", "downloads", "premium", "image"]
121
121
  ```
122
122
 
123
- You can then uses these methods in your code. Additionally you can access the data by using the hash equalivalent lookup.
123
+ You can then uses these methods in your code. Additionally you can access the data by using the hash equivalent lookup.
124
124
 
125
125
  ```ruby
126
126
  database = Quandl::Database.get('WIKI')
@@ -2,9 +2,9 @@
2
2
 
3
3
  module Quandl
4
4
  class ApiConfig
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
5
+ API_KEY_THREAD_KEY = 'quandl_api_key'
6
+ API_BASE_THREAD_KEY = 'quandl_api_base'
7
+ API_VERSION_THREAD_KEY = 'quandl_api_version_key'
8
8
 
9
9
  @api_key = nil
10
10
  @api_base = nil
@@ -12,7 +12,7 @@ module Quandl
12
12
 
13
13
  class << self
14
14
  def api_key=(api_key)
15
- @api_key = api_key if @api_key.nil?
15
+ @api_key ||= api_key
16
16
  Thread.current[API_KEY_THREAD_KEY] = api_key
17
17
  end
18
18
 
@@ -21,7 +21,7 @@ module Quandl
21
21
  end
22
22
 
23
23
  def api_base=(api_base)
24
- @api_base = api_base if @api_base.nil?
24
+ @api_base ||= api_base
25
25
  Thread.current[API_BASE_THREAD_KEY] = api_base
26
26
  end
27
27
 
@@ -30,7 +30,7 @@ module Quandl
30
30
  end
31
31
 
32
32
  def api_version=(api_version)
33
- @api_version = api_base if @api_version.nil?
33
+ @api_version ||= api_version
34
34
  Thread.current[API_VERSION_THREAD_KEY] = api_version
35
35
  end
36
36
 
@@ -22,12 +22,11 @@ module Quandl
22
22
 
23
23
  private
24
24
 
25
- # rubocop:disable MethodMissing
26
25
  def method_missing(method_name, *args, &block)
27
26
  return @raw_data[method_name.to_s] if @raw_data.key?(method_name.to_s)
28
27
  return @raw_data.method(method_name.to_s).call(*args, &block) if @raw_data.respond_to?(method_name.to_s)
28
+
29
29
  super
30
30
  end
31
- # rubocop:enable MethodMissing
32
31
  end
33
32
  end
@@ -29,11 +29,10 @@ module Quandl
29
29
 
30
30
  private
31
31
 
32
- # rubocop:disable MethodMissing
33
32
  def method_missing(method_name, *args, &block)
34
33
  return @meta[method_name.to_s] if @meta.key?(method_name.to_s)
34
+
35
35
  super
36
36
  end
37
- # rubocop:enable MethodMissing
38
37
  end
39
38
  end
@@ -37,7 +37,7 @@ 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 && response.body
40
+ Quandl::Connection.handle_api_error(response) if response&.body
41
41
  raise(QuandlError, 'Unexpected result when fetching bulk download URI.')
42
42
  end
43
43
  end
@@ -46,9 +46,7 @@ module Quandl
46
46
  # Check that we can write to the directory
47
47
  file = file_or_folder_path
48
48
  unless file_or_folder_path.is_a?(File)
49
- if File.directory?(file_or_folder_path)
50
- file_or_folder_path = Pathname.new(file_or_folder_path.to_s).join(File.basename(uri.path))
51
- end
49
+ file_or_folder_path = Pathname.new(file_or_folder_path.to_s).join(File.basename(uri.path)) if File.directory?(file_or_folder_path)
52
50
  file = File.open(file_or_folder_path, 'wb')
53
51
  end
54
52
 
@@ -3,11 +3,11 @@ module Quandl
3
3
  include Quandl::Operations::Get
4
4
  include Quandl::Operations::List
5
5
 
6
- # rubocop:disable Style/AccessorMethodName
6
+ # rubocop:disable Naming/AccessorMethodName
7
7
  def self.get_path
8
8
  default_path + '/metadata'
9
9
  end
10
- # rubocop:enable Style/AccessorMethodName
10
+ # rubocop:enable Naming/AccessorMethodName
11
11
 
12
12
  def database
13
13
  Quandl::Database.get(database_code)
@@ -11,6 +11,7 @@ module Quandl
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
15
  @meta['total_pages'] > @meta['current_page']
15
16
  end
16
17
 
@@ -35,13 +36,12 @@ module Quandl
35
36
 
36
37
  private
37
38
 
38
- # rubocop:disable MethodMissing
39
39
  def method_missing(method_name, *args, &block)
40
40
  return @meta[method_name.to_s] if @meta.key?(method_name.to_s)
41
41
  return @meta[*args] if method_name.to_s == '[]' && @meta.key?(args[0].to_s)
42
42
  return @values.method(method_name).call(*args, &block) if @values.respond_to?(method_name)
43
+
43
44
  super
44
45
  end
45
- # rubocop:enable MethodMissing
46
46
  end
47
47
  end
@@ -10,11 +10,11 @@ module Quandl
10
10
  new(response_data[lookup_key.singularize])
11
11
  end
12
12
 
13
- # rubocop:disable Style/AccessorMethodName
13
+ # rubocop:disable Naming/AccessorMethodName
14
14
  def get_path
15
15
  default_path
16
16
  end
17
- # rubocop:enable Style/AccessorMethodName
17
+ # rubocop:enable Naming/AccessorMethodName
18
18
  end
19
19
  end
20
20
  end
@@ -6,6 +6,7 @@ module Quandl
6
6
 
7
7
  def self.convert_to_dates(hash)
8
8
  return hash unless hash.is_a?(Hash)
9
+
9
10
  hash.update(hash) do |_k, v|
10
11
  if v.is_a?(String) && v =~ /^\d{4}-\d{2}-\d{2}$/ # Date
11
12
  Date.parse(v)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Quandl
4
- VERSION = '1.1.0'.freeze
4
+ VERSION = '1.1.1'
5
5
  end
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.1.0
4
+ version: 1.1.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: 2017-06-28 00:00:00.000000000 Z
12
+ date: 2020-07-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -17,14 +17,28 @@ dependencies:
17
17
  requirements:
18
18
  - - ">="
19
19
  - !ruby/object:Gem::Version
20
- version: 4.2.8
20
+ version: 5.2.4.3
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.8
27
+ version: 5.2.4.3
28
+ - !ruby/object:Gem::Dependency
29
+ name: json
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - "~>"
33
+ - !ruby/object:Gem::Version
34
+ version: 2.3.0
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - "~>"
40
+ - !ruby/object:Gem::Version
41
+ version: 2.3.0
28
42
  - !ruby/object:Gem::Dependency
29
43
  name: rest-client
30
44
  requirement: !ruby/object:Gem::Requirement
@@ -40,19 +54,19 @@ dependencies:
40
54
  - !ruby/object:Gem::Version
41
55
  version: 2.0.2
42
56
  - !ruby/object:Gem::Dependency
43
- name: json
57
+ name: factory_girl
44
58
  requirement: !ruby/object:Gem::Requirement
45
59
  requirements:
46
60
  - - "~>"
47
61
  - !ruby/object:Gem::Version
48
- version: 2.1.0
49
- type: :runtime
62
+ version: 4.5.0
63
+ type: :development
50
64
  prerelease: false
51
65
  version_requirements: !ruby/object:Gem::Requirement
52
66
  requirements:
53
67
  - - "~>"
54
68
  - !ruby/object:Gem::Version
55
- version: 2.1.0
69
+ version: 4.5.0
56
70
  - !ruby/object:Gem::Dependency
57
71
  name: rspec
58
72
  requirement: !ruby/object:Gem::Requirement
@@ -68,33 +82,33 @@ dependencies:
68
82
  - !ruby/object:Gem::Version
69
83
  version: '0'
70
84
  - !ruby/object:Gem::Dependency
71
- name: webmock
85
+ name: rubocop
72
86
  requirement: !ruby/object:Gem::Requirement
73
87
  requirements:
74
- - - "~>"
88
+ - - ">="
75
89
  - !ruby/object:Gem::Version
76
- version: 3.0.1
90
+ version: '0'
77
91
  type: :development
78
92
  prerelease: false
79
93
  version_requirements: !ruby/object:Gem::Requirement
80
94
  requirements:
81
- - - "~>"
95
+ - - ">="
82
96
  - !ruby/object:Gem::Version
83
- version: 3.0.1
97
+ version: '0'
84
98
  - !ruby/object:Gem::Dependency
85
- name: factory_girl
99
+ name: webmock
86
100
  requirement: !ruby/object:Gem::Requirement
87
101
  requirements:
88
102
  - - "~>"
89
103
  - !ruby/object:Gem::Version
90
- version: 4.5.0
104
+ version: 3.0.1
91
105
  type: :development
92
106
  prerelease: false
93
107
  version_requirements: !ruby/object:Gem::Requirement
94
108
  requirements:
95
109
  - - "~>"
96
110
  - !ruby/object:Gem::Version
97
- version: 4.5.0
111
+ version: 3.0.1
98
112
  description: A ruby implementation of the quandl client to be used as an ORM for quandl's
99
113
  restful APIs.
100
114
  email:
@@ -137,8 +151,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
137
151
  - !ruby/object:Gem::Version
138
152
  version: '0'
139
153
  requirements: []
140
- rubyforge_project:
141
- rubygems_version: 2.6.12
154
+ rubygems_version: 3.0.6
142
155
  signing_key:
143
156
  specification_version: 4
144
157
  summary: An ORM interface into the quandl api.