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 CHANGED
@@ -1,3 +1,5 @@
1
+ cookbooks/*
2
+ Cheffile.lock
1
3
  *.gem
2
4
  *.rbc
3
5
  .bundle
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # quandl_location changelog
2
2
 
3
+ ## 0.1.2
4
+
5
+ * Add save_data! method to send data directly to storage engine, bypassing raw_data and data_changed validation.
6
+
3
7
  ## 0.1.1
4
8
 
5
9
  * Update gemspec.
data/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # Quandl Location
2
2
 
3
- [![Build Status](https://magnum.travis-ci.com/quandl/quandl_location.png?token=Jqe6yYPbokJgKw6u73eU&branch=master)](https://magnum.travis-ci.com/quandl/quandl_location)
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
- ## Usage
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
+
@@ -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
@@ -1,5 +1,5 @@
1
1
  module Quandl
2
2
  module Location
3
- VERSION = "0.1.1"
3
+ VERSION = "0.1.2"
4
4
  end
5
5
  end
@@ -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.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-21 00:00:00.000000000 Z
12
+ date: 2013-10-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler