quandl_location 0.1.2 → 0.2.0

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.
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # quandl_location changelog
2
2
 
3
+ ## 0.2.0
4
+
5
+ * Remove Quandl::Location::Data.find. Add Quandl::Location.find to return instance of Data class.
6
+ * Quandl::Location::Data does not have to be directly accessed.
7
+ * 0.2.0 introduces breaking changes and is not compatible with 0.1.x
8
+
3
9
  ## 0.1.2
4
10
 
5
11
  * Add save_data! method to send data directly to storage engine, bypassing raw_data and data_changed validation.
data/README.md CHANGED
@@ -69,16 +69,16 @@ File system stores location data using the location_id as the file name.
69
69
  Creates new key, or overwrites existing key with new data.
70
70
 
71
71
  ``` ruby
72
- location_data = Quandl::Location::Data.find(location_id)
73
- location_data.data = [1,2,3]
74
- location_data.save
72
+ location = Quandl::Location.find(location_id)
73
+ location.data = [1,2,3]
74
+ location.save
75
75
  ```
76
76
 
77
77
  To send data directly to storage engine (and to bypass changed? validation and setting via data=) use save_data! method.
78
78
 
79
79
  ```ruby
80
- location_data = Quandl::Location::Data.find(location_id)
81
- location_data.save_data!([1,2, 3])
80
+ location = Quandl::Location.find(location_id)
81
+ location.save_data!([1,2, 3])
82
82
  ```
83
83
 
84
84
  #### Retrieve data
@@ -86,7 +86,7 @@ location_data.save_data!([1,2, 3])
86
86
  Returns the data, or returns nil if data does not exist.
87
87
 
88
88
  ```ruby
89
- raw_data = Quandl::Location::Data.find(location_id).data
89
+ raw_data = Quandl::Location.find(location_id).data
90
90
  ```
91
91
 
92
92
  #### Check for data
@@ -96,13 +96,13 @@ Use exists? method to check if the data exits in the storage engine. The get met
96
96
  Quandl::Storage::Redis returns true if there is a key with value location_id, and Quandl::Storage::FileSystem returns true if there is a file present with name location_id.
97
97
 
98
98
  ```ruby
99
- location_data = Quandl::Location::Data.find(new_location_id)
100
- location_data.exists?
99
+ location = Quandl::Location.find(new_location_id)
100
+ location.exists?
101
101
  => false
102
- location_data.data = [1,2,3]
103
- location_data.exists?
102
+ location.data = [1,2,3]
103
+ location.exists?
104
104
  => false
105
- location_data.save
106
- location_data.exists?
105
+ location.save
106
+ location.exists?
107
107
  => true
108
108
 
@@ -14,6 +14,15 @@ module Quandl
14
14
 
15
15
  class << self
16
16
 
17
+ # Create a new instance of Quandl::Locatin::Data
18
+ #
19
+ # id - Location id Fixnum
20
+ #
21
+ # Returns Quandl::Location::Data
22
+ def find(id)
23
+ Quandl::Location::Data.new(id)
24
+ end
25
+
17
26
  # The list of supported storage engines for locations
18
27
  #
19
28
  # Returns array
@@ -2,19 +2,6 @@ module Quandl
2
2
  module Location
3
3
  class Data
4
4
 
5
- class << self
6
-
7
- # Create a new location data instance
8
- #
9
- # id - The location id
10
- #
11
- # Returns Quandl::Location::Data
12
- def find(id)
13
- self.new(id)
14
- end
15
-
16
- end
17
-
18
5
  attr_accessor :id, :data
19
6
 
20
7
  # Constructor
@@ -1,5 +1,5 @@
1
1
  module Quandl
2
2
  module Location
3
- VERSION = "0.1.2"
3
+ VERSION = "0.2.0"
4
4
  end
5
5
  end
@@ -11,14 +11,6 @@ describe Quandl::Location::Data do
11
11
  before(:each) do
12
12
  Quandl::Location::Data.any_instance.stub(:storage).and_return(storage_mock)
13
13
  end
14
-
15
- describe '#find' do
16
-
17
- it 'should return a new Quandl::Location::Data instance' do
18
- Quandl::Location::Data.find(230).should be_kind_of(Quandl::Location::Data)
19
- end
20
-
21
- end
22
14
 
23
15
  describe '#data=' do
24
16
 
@@ -18,6 +18,16 @@ describe Quandl::Location do
18
18
 
19
19
  end
20
20
 
21
+ describe '#find' do
22
+
23
+ it 'should return a new Location data instance' do
24
+ location_id = (1..100).to_a.sample
25
+ Quandl::Location::Data.should_receive(:new).with(location_id)
26
+ Quandl::Location.find(location_id)
27
+ end
28
+
29
+ end
30
+
21
31
  describe '#use' do
22
32
 
23
33
  it 'it should raise an error for unsupported storage engines' 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.2
4
+ version: 0.2.0
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-23 00:00:00.000000000 Z
12
+ date: 2013-10-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler