quandl_client 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +14 -17
- data/lib/quandl/client/models/sheet.rb +13 -13
- data/lib/quandl/client/version.rb +1 -1
- metadata +2 -2
data/README.md
CHANGED
@@ -64,16 +64,16 @@ d.data_table
|
|
64
64
|
|
65
65
|
|
66
66
|
|
67
|
-
## Quandl::Client::
|
67
|
+
## Quandl::Client::Source
|
68
68
|
|
69
69
|
|
70
70
|
#### Search
|
71
71
|
|
72
72
|
```ruby
|
73
73
|
|
74
|
-
|
74
|
+
sources = Quandl::Client::Source.query('canada').page(2).all
|
75
75
|
|
76
|
-
=> [#<Quandl::Client::
|
76
|
+
=> [#<Quandl::Client::Source(sources) code="STATCAN1" title="Stat Can">,...]
|
77
77
|
|
78
78
|
```
|
79
79
|
|
@@ -82,7 +82,7 @@ sheets = Quandl::Client::Sheet.url_title('housing').query('hood').page(2).all
|
|
82
82
|
|
83
83
|
```ruby
|
84
84
|
|
85
|
-
sheet = Quandl::Client::
|
85
|
+
sheet = Quandl::Client::Source.find('STATCAN1')
|
86
86
|
|
87
87
|
```
|
88
88
|
|
@@ -95,16 +95,8 @@ sheet = Quandl::Client::Sheet.find_by_url_title('housing/hood')
|
|
95
95
|
|
96
96
|
```ruby
|
97
97
|
|
98
|
-
|
99
|
-
|
100
|
-
Quandl::Client.use 'http://localhost:3000/api/'
|
101
|
-
|
102
|
-
sources = Quandl::Client::Source.query('canada').all
|
103
|
-
=> [#<Quandl::Client::Source(sources) code="STATSCAN5" datasets_count=1>,...]
|
104
|
-
|
105
|
-
source = Quandl::Client::Source.find('STATSCAN5')
|
106
|
-
dataset = source.datasets.page(2).first
|
107
|
-
dataset.data_table
|
98
|
+
sheets = Quandl::Client::Sheet.query('canada').all
|
99
|
+
=> [[#<Quandl::Client::Sheet(sheets) title="La Canada Flintridge>,...]
|
108
100
|
|
109
101
|
```
|
110
102
|
|
@@ -113,7 +105,7 @@ dataset.data_table
|
|
113
105
|
|
114
106
|
```ruby
|
115
107
|
|
116
|
-
sheet = Quandl::Client::Sheet.
|
108
|
+
sheet = Quandl::Client::Sheet.find('housing/hood')
|
117
109
|
|
118
110
|
```
|
119
111
|
|
@@ -123,9 +115,13 @@ sheet = Quandl::Client::Sheet.find_by_url_title('housing/hood')
|
|
123
115
|
|
124
116
|
```ruby
|
125
117
|
|
126
|
-
Quandl::Client.
|
118
|
+
s = Quandl::Client::Sheet.create( title: 'ocean' )
|
119
|
+
s = Quandl::Client::Sheet.create( full_url_title: 'ocean/river', title: 'River' )
|
120
|
+
s = Quandl::Client::Sheet.create( full_url_title: 'ocean/river/lake', title: 'Lake!' )
|
127
121
|
|
128
|
-
s = Quandl::Client::Sheet.
|
122
|
+
s = Quandl::Client::Sheet.find('ocean')
|
123
|
+
|
124
|
+
s = Quandl::Client::Sheet.create(url_title: 'housing/city/hi_there', title: 'Hi there', content: 'magic')
|
129
125
|
|
130
126
|
```
|
131
127
|
|
@@ -153,6 +149,7 @@ require 'quandl/client'
|
|
153
149
|
Quandl::Client.use 'http://localhost:3000/api/'
|
154
150
|
Quandl::Client.token = 'xyz'
|
155
151
|
|
152
|
+
|
156
153
|
s = Quandl::Client::Sheet.find_by_url_title('testing')
|
157
154
|
s.title = 'more testing'
|
158
155
|
s.save
|
@@ -10,7 +10,7 @@ class Sheet
|
|
10
10
|
|
11
11
|
scope_builder_for :search
|
12
12
|
|
13
|
-
search_scope :query, :page, :
|
13
|
+
search_scope :query, :page, :parent_url_title
|
14
14
|
search_helper :all, ->{ connection.where(attributes).fetch.to_a }
|
15
15
|
search_helper :connection, -> { self.class.parent }
|
16
16
|
|
@@ -18,25 +18,25 @@ class Sheet
|
|
18
18
|
delegate *Array.forwardable_methods, to: :all
|
19
19
|
end
|
20
20
|
|
21
|
-
class << self
|
22
|
-
|
23
|
-
def find_by_url_title(title)
|
24
|
-
where( url_title: title ).find('show')
|
25
|
-
end
|
26
|
-
|
27
|
-
end
|
28
|
-
|
29
21
|
# ORM
|
30
22
|
include Her::Model
|
31
23
|
use_api Client.her_api
|
32
|
-
attributes :title, :url_title, :
|
24
|
+
attributes :title, :content, :url_title, :full_url_title
|
33
25
|
|
34
26
|
def html
|
35
|
-
@html ||=
|
27
|
+
@html ||= self.attributes[:html] || Sheet.find(full_url_title).attributes[:html]
|
28
|
+
end
|
29
|
+
|
30
|
+
def parent
|
31
|
+
@parent ||= Sheet.find(parent_url_title)
|
32
|
+
end
|
33
|
+
|
34
|
+
def children
|
35
|
+
Sheet.parent_url_title(self.full_url_title)
|
36
36
|
end
|
37
37
|
|
38
|
-
def
|
39
|
-
'
|
38
|
+
def parent_url_title
|
39
|
+
@parent_url_title ||= self.full_url_title.split('/')[0..-2].join()
|
40
40
|
end
|
41
41
|
|
42
42
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: quandl_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.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-06-
|
12
|
+
date: 2013-06-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|