quandl_location 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -0
- data/CHANGELOG.md +4 -0
- data/README.md +15 -5
- data/lib/quandl/location/data.rb +10 -0
- data/lib/quandl/location/version.rb +1 -1
- data/quandl_location.gemspec +1 -1
- data/spec/quandl/location/data_spec.rb +9 -0
- metadata +2 -2
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# Quandl Location
|
2
2
|
|
3
|
-
|
3
|
+
|
4
|
+
[![Build Status](https://travis-ci.org/quandl/quandl_location.png?branch=master)](https://travis-ci.org/quandl/quandl_location)
|
4
5
|
|
5
6
|
## Installation
|
6
7
|
|
@@ -24,9 +25,7 @@ quandl_location provides a getter/setter class to store key-value data, but abst
|
|
24
25
|
Any supported storage engine can be configured at run time. Currently supports Redis and Unix file system.
|
25
26
|
|
26
27
|
|
27
|
-
##
|
28
|
-
|
29
|
-
|
28
|
+
## Configuration
|
30
29
|
|
31
30
|
#### Configure Redis storage
|
32
31
|
|
@@ -63,6 +62,8 @@ end
|
|
63
62
|
|
64
63
|
File system stores location data using the location_id as the file name.
|
65
64
|
|
65
|
+
## Usage
|
66
|
+
|
66
67
|
#### Save data
|
67
68
|
|
68
69
|
Creates new key, or overwrites existing key with new data.
|
@@ -72,6 +73,14 @@ location_data = Quandl::Location::Data.find(location_id)
|
|
72
73
|
location_data.data = [1,2,3]
|
73
74
|
location_data.save
|
74
75
|
```
|
76
|
+
|
77
|
+
To send data directly to storage engine (and to bypass changed? validation and setting via data=) use save_data! method.
|
78
|
+
|
79
|
+
```ruby
|
80
|
+
location_data = Quandl::Location::Data.find(location_id)
|
81
|
+
location_data.save_data!([1,2, 3])
|
82
|
+
```
|
83
|
+
|
75
84
|
#### Retrieve data
|
76
85
|
|
77
86
|
Returns the data, or returns nil if data does not exist.
|
@@ -95,4 +104,5 @@ location_data.exists?
|
|
95
104
|
=> false
|
96
105
|
location_data.save
|
97
106
|
location_data.exists?
|
98
|
-
=> true
|
107
|
+
=> true
|
108
|
+
|
data/lib/quandl/location/data.rb
CHANGED
@@ -56,6 +56,16 @@ module Quandl
|
|
56
56
|
storage.set(id, @raw_data)
|
57
57
|
end
|
58
58
|
|
59
|
+
# Save the data directory. By passes setting @raw_data and
|
60
|
+
# does not check if data was changed. Data is sent directly to the storage engine
|
61
|
+
#
|
62
|
+
# data - Raw location data as string
|
63
|
+
#
|
64
|
+
# Returns boolean
|
65
|
+
def save_data!(data)
|
66
|
+
storage.set(id, data)
|
67
|
+
end
|
68
|
+
|
59
69
|
# Check if data exists in storage engine
|
60
70
|
#
|
61
71
|
# Return boolean
|
data/quandl_location.gemspec
CHANGED
@@ -13,7 +13,6 @@ Gem::Specification.new do |spec|
|
|
13
13
|
spec.homepage = "https://github.com/quandl/quandl_location"
|
14
14
|
|
15
15
|
spec.files = `git ls-files`.split($/)
|
16
|
-
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
16
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
17
|
spec.require_paths = ["lib"]
|
19
18
|
|
@@ -25,4 +24,5 @@ Gem::Specification.new do |spec|
|
|
25
24
|
|
26
25
|
spec.add_runtime_dependency "redis"
|
27
26
|
spec.add_runtime_dependency "activesupport", "~> 3"
|
27
|
+
|
28
28
|
end
|
@@ -89,6 +89,15 @@ describe Quandl::Location::Data do
|
|
89
89
|
|
90
90
|
end
|
91
91
|
|
92
|
+
describe '#save_data!' do
|
93
|
+
|
94
|
+
it 'should send data directly to storage engine' do
|
95
|
+
storage_mock.should_receive(:set).with(location_id, fake_data)
|
96
|
+
data_object.save_data!(fake_data)
|
97
|
+
end
|
98
|
+
|
99
|
+
end
|
100
|
+
|
92
101
|
describe '#exists?' do
|
93
102
|
|
94
103
|
it 'should return status through storage engine' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: quandl_location
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-10-
|
12
|
+
date: 2013-10-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|