quata 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7974b74f540308b621c8a7fc0de260af55852223
4
- data.tar.gz: e1277a24096c30ddc75b819cdc62be04740a4b68
3
+ metadata.gz: 7784275cd18e6a826b6a74a9099cfa0270557779
4
+ data.tar.gz: c4f4655ae4b3436aa4f0fd289673d9c748682201
5
5
  SHA512:
6
- metadata.gz: 8475fd5c7e82dcac96a77744f2e45b3c8ef6c18b9e576f48391553bdd9827c8a0bf0ba513c89ff679895bbdebf5aa7cb2b26184b87ab8ce2358c135f4882e3a3
7
- data.tar.gz: 998facc8591d26543bcdc618d9bfa96654bcb1dee09d7f75102aad7ebf36bc5f4689aed56a173b3932eb2a94d919159b5e28be0bd74ddd53cb83be80297a58f9
6
+ metadata.gz: ff5064da6fd39ba64ef4b57df65f694d537129febcfbfb458065c7bf6c7e86e66260b7c8b91d6b9c375d95b89b3e1c15a3db563ac161cade625fc3fe28c47798
7
+ data.tar.gz: fe0b245fcfdfb8204b99f76223008460229d2bb0446fc1a9810b5b7ad7884c3a3069ee2f578062c0e57f0884e695ac7749ecbc814fd7e30275d4c46afc23f07b
data/README.md CHANGED
@@ -83,8 +83,8 @@ you for the following requests is also easy:
83
83
  ```ruby
84
84
  quandl.debug = true
85
85
  quandl.param rows: 10, order: 'asc'
86
- puts quandl.get 'WIKI/AAPL'
87
- # => https://www.quandl.com/api/v3/WIKI/AAPL.json?auth_token=key&rows=10&order=asc
86
+ puts quandl.datasets 'WIKI/AAPL'
87
+ # => https://www.quandl.com/api/v3/datasets/WIKI/AAPL.json?auth_token=key&rows=10&order=asc
88
88
 
89
89
  quandl.param order: nil # remove param
90
90
  ```
@@ -166,8 +166,8 @@ To enable caching for the command line, simply set one or both of
166
166
  these environment variables:
167
167
 
168
168
  ```
169
- $ export QUANDL_CACHE_DIR=cache
170
- $ export QUANDL_CACHE_LIFE=120
169
+ $ export QUANDL_CACHE_DIR=cache # default: 'cache'
170
+ $ export QUANDL_CACHE_LIFE=120 # default: 3600 (1 hour)
171
171
  $ quata get datasets/WIKI/AAPL
172
172
  # => This call will be cached
173
173
  ```
@@ -1,3 +1,3 @@
1
1
  module Quata
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
@@ -7,7 +7,7 @@ module Quata
7
7
  # A general purpose HTTP wrapper. This is poor man's HTTParty with
8
8
  # dynamic methods.
9
9
  class WebAPI
10
- attr_reader :base_url, :after_request_block
10
+ attr_reader :base_url, :after_request_block, :last_error
11
11
  attr_accessor :debug, :format
12
12
 
13
13
  def initialize(base_url)
@@ -33,11 +33,6 @@ module Quata
33
33
  @cache ||= WebCache.new
34
34
  end
35
35
 
36
- # Return the last HTTP error, or false if all was good
37
- def last_error
38
- cache.last_error
39
- end
40
-
41
36
  # Set a block to be executed after the request. This is called only when
42
37
  # using `get` and not when using `get!`. Good for JSON decoding, for
43
38
  # example.
@@ -63,7 +58,11 @@ module Quata
63
58
  path = "#{path}/#{extra}" if extra
64
59
  url = construct_url path, params
65
60
 
66
- debug ? url : cache.get(url)
61
+ return url if debug
62
+
63
+ response = cache.get(url)
64
+ @last_error = response.error
65
+ response.content
67
66
  end
68
67
 
69
68
  # Save the response from the API to a file.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: quata
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Danny Ben Shitrit
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-21 00:00:00.000000000 Z
11
+ date: 2016-07-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: docopt
@@ -185,9 +185,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
185
185
  version: '0'
186
186
  requirements: []
187
187
  rubyforge_project:
188
- rubygems_version: 2.4.6
188
+ rubygems_version: 2.6.6
189
189
  signing_key:
190
190
  specification_version: 4
191
191
  summary: Quandl API Library and Command Line
192
192
  test_files: []
193
- has_rdoc: