smoke 0.5.17 → 0.5.19
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +5 -5
- data/Rakefile +1 -0
- data/VERSION.yml +2 -2
- data/lib/core_ext/array.rb +12 -0
- data/lib/smoke.rb +24 -13
- data/lib/smoke/cache.rb +4 -4
- data/lib/smoke/origin.rb +6 -11
- data/lib/smoke/request.rb +5 -14
- data/lib/smoke/transformer.rb +7 -0
- data/lib/smoke/transformers/json.rb +15 -0
- data/lib/smoke/transformers/ruby.rb +11 -0
- data/lib/smoke/{output → transformers}/xml.rb +12 -6
- data/lib/smoke/transformers/yaml.rb +15 -0
- data/spec/smoke/origin_spec.rb +4 -0
- data/spec/smoke/request_spec.rb +7 -0
- data/spec/smoke/{output → transformers}/xml_spec.rb +4 -6
- data/spec/smoke/transformers_spec.rb +35 -0
- data/spec/smoke_spec.rb +18 -10
- data/spec/supports/twitter_timeline.json +22 -0
- metadata +23 -30
- data/rdoc/classes/Smoke.html +0 -260
- data/rdoc/classes/Smoke/Origin.html +0 -340
- data/rdoc/classes/Smoke/Source/Data.html +0 -126
- data/rdoc/classes/Smoke/Source/Feed.html +0 -117
- data/rdoc/classes/Smoke/Source/YQL.html +0 -223
- data/rdoc/created.rid +0 -1
- data/rdoc/files/README_markdown.html +0 -180
- data/rdoc/files/lib/core_ext/hash_rb.html +0 -49
- data/rdoc/files/lib/smoke/origin_rb.html +0 -49
- data/rdoc/files/lib/smoke/request_rb.html +0 -49
- data/rdoc/files/lib/smoke/source/data_rb.html +0 -49
- data/rdoc/files/lib/smoke/source/feed_rb.html +0 -49
- data/rdoc/files/lib/smoke/source/join_rb.html +0 -49
- data/rdoc/files/lib/smoke/source/yql_rb.html +0 -49
- data/rdoc/files/lib/smoke_rb.html +0 -65
- data/rdoc/fr_class_index.html +0 -21
- data/rdoc/fr_file_index.html +0 -28
- data/rdoc/fr_method_index.html +0 -4459
- data/rdoc/index.html +0 -15
- data/rdoc/rdoc-style.css +0 -319
- data/spec/smoke/input/xls_spec.rb +0 -15
- data/spec/smoke/shared_spec.rb +0 -182
- data/spec/supports/gov_act_toliets.xls +0 -0
@@ -1,126 +0,0 @@
|
|
1
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
2
|
-
<html lang='en'>
|
3
|
-
<head>
|
4
|
-
<title>: Smoke::Source::Data [smoke]</title>
|
5
|
-
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'>
|
6
|
-
<link href='../../../rdoc-style.css' media='screen' rel='stylesheet' type='text/css'>
|
7
|
-
<script type='text/javascript'>
|
8
|
-
//<![CDATA[
|
9
|
-
function popupCode(url) {
|
10
|
-
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
11
|
-
}
|
12
|
-
|
13
|
-
function toggleCode(id) {
|
14
|
-
var code = document.getElementById(id)
|
15
|
-
|
16
|
-
code.style.display = code.style.display != 'block' ? 'block' : 'none'
|
17
|
-
return true
|
18
|
-
}
|
19
|
-
|
20
|
-
// Make codeblocks hidden by default
|
21
|
-
document.writeln('<' + 'style type="text/css">.method .source pre { display: none }<\/style>')
|
22
|
-
//]]>
|
23
|
-
</script>
|
24
|
-
</head>
|
25
|
-
<body class='page'>
|
26
|
-
<div class='class' id='wrapper'>
|
27
|
-
<div class='header'>
|
28
|
-
<h1 class='name'>
|
29
|
-
<span class='type'>Class</span>
|
30
|
-
Smoke::Source::Data
|
31
|
-
</h1>
|
32
|
-
<ol class='paths'>
|
33
|
-
<li>
|
34
|
-
<a href="../../../files/lib/smoke/source/data_rb.html">lib/smoke/source/data.rb</a>
|
35
|
-
</li>
|
36
|
-
</ol>
|
37
|
-
<div class='parent'>
|
38
|
-
Parent:
|
39
|
-
<strong><a href="../Origin.html">Smoke::Origin</a></strong>
|
40
|
-
</div>
|
41
|
-
</div>
|
42
|
-
<div id='content'>
|
43
|
-
<div id='text'>
|
44
|
-
<div id='description'>
|
45
|
-
<p>
|
46
|
-
The “Data” source allows you to query datasources that are
|
47
|
-
“complete” urls and rely on the automagic object parsing that
|
48
|
-
smoke provides.
|
49
|
-
</p>
|
50
|
-
<p>
|
51
|
-
For example, you may use this source to query a complete restful api call
|
52
|
-
unpackage the xml response and get a clean ruby object.
|
53
|
-
</p>
|
54
|
-
<p>
|
55
|
-
<a href="Data.html">Data</a> can take as many urls as you’d like to
|
56
|
-
throw at it.
|
57
|
-
</p>
|
58
|
-
<p>
|
59
|
-
Usage:
|
60
|
-
</p>
|
61
|
-
<pre>Smoke.data(:ruby) do
 url "http://api.flickr.com/services/rest/?user_id=36821533%40N00&tags=benschwarz-site&nojsoncallback=1&method=flickr.photos.search&format=json&api_key=your_api_key_here
 path :photos, :photo
end</pre>
|
62
|
-
</div>
|
63
|
-
<div id='method-list'>
|
64
|
-
<h2>Methods</h2>
|
65
|
-
<h3>public instance</h3>
|
66
|
-
<ol>
|
67
|
-
<li><a href="#M000012">url</a></li>
|
68
|
-
</ol>
|
69
|
-
<h3>protected instance</h3>
|
70
|
-
<ol>
|
71
|
-
<li><a href="#M000013">dispatch</a></li>
|
72
|
-
</ol>
|
73
|
-
</div>
|
74
|
-
<div id='section'>
|
75
|
-
<div id='attribute-list'>
|
76
|
-
<h2 class='section-bar'>Attributes</h2>
|
77
|
-
<div class='name-list'>
|
78
|
-
<table>
|
79
|
-
<tr class='top-aligned-row context-row'>
|
80
|
-
<td class='context-item-name'>request</td>
|
81
|
-
<td class='context-item-value'>[R]</td>
|
82
|
-
<td class='context-item-desc'></td>
|
83
|
-
</tr>
|
84
|
-
</table>
|
85
|
-
</div>
|
86
|
-
</div>
|
87
|
-
<div id='methods'>
|
88
|
-
<h2>Public instance methods</h2>
|
89
|
-
<div class='public-instance method' id='method-M000012'>
|
90
|
-
<a name='M000012'> </a>
|
91
|
-
<div class='synopsis'>
|
92
|
-
<span class='name'>url</span>
|
93
|
-
<span class='arguments'>(source_url)</span>
|
94
|
-
</div>
|
95
|
-
<div class='source'>
|
96
|
-
<a class='source-toggle' href='#' onclick="toggleCode('M000012-source'); return false">
|
97
|
-
[show source]
|
98
|
-
</a>
|
99
|
-
<pre id='M000012-source'> <span class="ruby-comment cmt"># File lib/smoke/source/data.rb, line 24</span>
24: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">url</span>(<span class="ruby-identifier">source_url</span>)
25: <span class="ruby-ivar">@url</span> = <span class="ruby-identifier">source_url</span>
26: <span class="ruby-keyword kw">end</span></pre>
|
100
|
-
</div>
|
101
|
-
</div>
|
102
|
-
<h2>Protected instance methods</h2>
|
103
|
-
<div class='protected-instance method' id='method-M000013'>
|
104
|
-
<a name='M000013'> </a>
|
105
|
-
<div class='synopsis'>
|
106
|
-
<span class='name'>dispatch</span>
|
107
|
-
<span class='arguments'>()</span>
|
108
|
-
</div>
|
109
|
-
<div class='source'>
|
110
|
-
<a class='source-toggle' href='#' onclick="toggleCode('M000013-source'); return false">
|
111
|
-
[show source]
|
112
|
-
</a>
|
113
|
-
<pre id='M000013-source'> <span class="ruby-comment cmt"># File lib/smoke/source/data.rb, line 29</span>
29: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">dispatch</span>
30: <span class="ruby-ivar">@request</span> = <span class="ruby-constant">Smoke</span><span class="ruby-operator">::</span><span class="ruby-constant">Request</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@url</span>)
31: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">items</span> = (<span class="ruby-ivar">@path</span>.<span class="ruby-identifier">nil?</span>) <span class="ruby-operator">?</span> <span class="ruby-ivar">@request</span>.<span class="ruby-identifier">body</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">drill</span>(<span class="ruby-ivar">@request</span>.<span class="ruby-identifier">body</span>, <span class="ruby-operator">*</span><span class="ruby-ivar">@path</span>)
32: <span class="ruby-keyword kw">end</span></pre>
|
114
|
-
</div>
|
115
|
-
</div>
|
116
|
-
</div>
|
117
|
-
</div>
|
118
|
-
</div>
|
119
|
-
</div>
|
120
|
-
<div id='footer-push'></div>
|
121
|
-
</div>
|
122
|
-
<div id='footer'>
|
123
|
-
<a href="http://github.com/mislav/hanna/tree/master"><strong>Hanna</strong> RDoc template</a>
|
124
|
-
</div>
|
125
|
-
</body>
|
126
|
-
</html>
|
@@ -1,117 +0,0 @@
|
|
1
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
2
|
-
<html lang='en'>
|
3
|
-
<head>
|
4
|
-
<title>: Smoke::Source::Feed [smoke]</title>
|
5
|
-
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'>
|
6
|
-
<link href='../../../rdoc-style.css' media='screen' rel='stylesheet' type='text/css'>
|
7
|
-
<script type='text/javascript'>
|
8
|
-
//<![CDATA[
|
9
|
-
function popupCode(url) {
|
10
|
-
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
11
|
-
}
|
12
|
-
|
13
|
-
function toggleCode(id) {
|
14
|
-
var code = document.getElementById(id)
|
15
|
-
|
16
|
-
code.style.display = code.style.display != 'block' ? 'block' : 'none'
|
17
|
-
return true
|
18
|
-
}
|
19
|
-
|
20
|
-
// Make codeblocks hidden by default
|
21
|
-
document.writeln('<' + 'style type="text/css">.method .source pre { display: none }<\/style>')
|
22
|
-
//]]>
|
23
|
-
</script>
|
24
|
-
</head>
|
25
|
-
<body class='page'>
|
26
|
-
<div class='class' id='wrapper'>
|
27
|
-
<div class='header'>
|
28
|
-
<h1 class='name'>
|
29
|
-
<span class='type'>Class</span>
|
30
|
-
Smoke::Source::Feed
|
31
|
-
</h1>
|
32
|
-
<ol class='paths'>
|
33
|
-
<li>
|
34
|
-
<a href="../../../files/lib/smoke/source/feed_rb.html">lib/smoke/source/feed.rb</a>
|
35
|
-
</li>
|
36
|
-
</ol>
|
37
|
-
<div class='parent'>
|
38
|
-
Parent:
|
39
|
-
<strong><a href="../Origin.html">Smoke::Origin</a></strong>
|
40
|
-
</div>
|
41
|
-
</div>
|
42
|
-
<div id='content'>
|
43
|
-
<div id='text'>
|
44
|
-
<div id='description'>
|
45
|
-
<p>
|
46
|
-
<a href="Feed.html">Feed</a> can take multiple rss or atom feeds and munge
|
47
|
-
them up together.
|
48
|
-
</p>
|
49
|
-
<p>
|
50
|
-
Usage:
|
51
|
-
</p>
|
52
|
-
<pre>Smoke.feed(:ruby) do
 url "domain.tld/rss"
 url "site.tld/atom"
end</pre>
|
53
|
-
</div>
|
54
|
-
<div id='method-list'>
|
55
|
-
<h2>Methods</h2>
|
56
|
-
<h3>public instance</h3>
|
57
|
-
<ol>
|
58
|
-
<li><a href="#M000010">url</a></li>
|
59
|
-
</ol>
|
60
|
-
<h3>protected instance</h3>
|
61
|
-
<ol>
|
62
|
-
<li><a href="#M000011">dispatch</a></li>
|
63
|
-
</ol>
|
64
|
-
</div>
|
65
|
-
<div id='section'>
|
66
|
-
<div id='attribute-list'>
|
67
|
-
<h2 class='section-bar'>Attributes</h2>
|
68
|
-
<div class='name-list'>
|
69
|
-
<table>
|
70
|
-
<tr class='top-aligned-row context-row'>
|
71
|
-
<td class='context-item-name'>requests</td>
|
72
|
-
<td class='context-item-value'>[R]</td>
|
73
|
-
<td class='context-item-desc'></td>
|
74
|
-
</tr>
|
75
|
-
</table>
|
76
|
-
</div>
|
77
|
-
</div>
|
78
|
-
<div id='methods'>
|
79
|
-
<h2>Public instance methods</h2>
|
80
|
-
<div class='public-instance method' id='method-M000010'>
|
81
|
-
<a name='M000010'> </a>
|
82
|
-
<div class='synopsis'>
|
83
|
-
<span class='name'>url</span>
|
84
|
-
<span class='arguments'>(feed_uri)</span>
|
85
|
-
</div>
|
86
|
-
<div class='source'>
|
87
|
-
<a class='source-toggle' href='#' onclick="toggleCode('M000010-source'); return false">
|
88
|
-
[show source]
|
89
|
-
</a>
|
90
|
-
<pre id='M000010-source'> <span class="ruby-comment cmt"># File lib/smoke/source/feed.rb, line 13</span>
13: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">url</span>(<span class="ruby-identifier">feed_uri</span>)
14: (<span class="ruby-ivar">@feeds</span> <span class="ruby-operator">||=</span> [] ) <span class="ruby-operator"><<</span> <span class="ruby-identifier">feed_uri</span>
15: <span class="ruby-keyword kw">end</span></pre>
|
91
|
-
</div>
|
92
|
-
</div>
|
93
|
-
<h2>Protected instance methods</h2>
|
94
|
-
<div class='protected-instance method' id='method-M000011'>
|
95
|
-
<a name='M000011'> </a>
|
96
|
-
<div class='synopsis'>
|
97
|
-
<span class='name'>dispatch</span>
|
98
|
-
<span class='arguments'>()</span>
|
99
|
-
</div>
|
100
|
-
<div class='source'>
|
101
|
-
<a class='source-toggle' href='#' onclick="toggleCode('M000011-source'); return false">
|
102
|
-
[show source]
|
103
|
-
</a>
|
104
|
-
<pre id='M000011-source'> <span class="ruby-comment cmt"># File lib/smoke/source/feed.rb, line 18</span>
18: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">dispatch</span>
19: <span class="ruby-ivar">@requests</span> = <span class="ruby-ivar">@feeds</span>.<span class="ruby-identifier">map</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span> <span class="ruby-constant">Smoke</span><span class="ruby-operator">::</span><span class="ruby-constant">Request</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">f</span>, <span class="ruby-identifier">:raw_response</span>) }
20: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">items</span> = <span class="ruby-ivar">@requests</span>.<span class="ruby-identifier">map</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">r</span><span class="ruby-operator">|</span> <span class="ruby-operator">::</span><span class="ruby-constant">SimpleRSS</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">r</span>.<span class="ruby-identifier">body</span>).<span class="ruby-identifier">items</span> }.<span class="ruby-identifier">flatten</span>
21: <span class="ruby-keyword kw">end</span></pre>
|
105
|
-
</div>
|
106
|
-
</div>
|
107
|
-
</div>
|
108
|
-
</div>
|
109
|
-
</div>
|
110
|
-
</div>
|
111
|
-
<div id='footer-push'></div>
|
112
|
-
</div>
|
113
|
-
<div id='footer'>
|
114
|
-
<a href="http://github.com/mislav/hanna/tree/master"><strong>Hanna</strong> RDoc template</a>
|
115
|
-
</div>
|
116
|
-
</body>
|
117
|
-
</html>
|
@@ -1,223 +0,0 @@
|
|
1
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
2
|
-
<html lang='en'>
|
3
|
-
<head>
|
4
|
-
<title>: Smoke::Source::YQL [smoke]</title>
|
5
|
-
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'>
|
6
|
-
<link href='../../../rdoc-style.css' media='screen' rel='stylesheet' type='text/css'>
|
7
|
-
<script type='text/javascript'>
|
8
|
-
//<![CDATA[
|
9
|
-
function popupCode(url) {
|
10
|
-
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
11
|
-
}
|
12
|
-
|
13
|
-
function toggleCode(id) {
|
14
|
-
var code = document.getElementById(id)
|
15
|
-
|
16
|
-
code.style.display = code.style.display != 'block' ? 'block' : 'none'
|
17
|
-
return true
|
18
|
-
}
|
19
|
-
|
20
|
-
// Make codeblocks hidden by default
|
21
|
-
document.writeln('<' + 'style type="text/css">.method .source pre { display: none }<\/style>')
|
22
|
-
//]]>
|
23
|
-
</script>
|
24
|
-
</head>
|
25
|
-
<body class='page'>
|
26
|
-
<div class='class' id='wrapper'>
|
27
|
-
<div class='header'>
|
28
|
-
<h1 class='name'>
|
29
|
-
<span class='type'>Class</span>
|
30
|
-
Smoke::Source::YQL
|
31
|
-
</h1>
|
32
|
-
<ol class='paths'>
|
33
|
-
<li>
|
34
|
-
<a href="../../../files/lib/smoke/source/yql_rb.html">lib/smoke/source/yql.rb</a>
|
35
|
-
</li>
|
36
|
-
</ol>
|
37
|
-
<div class='parent'>
|
38
|
-
Parent:
|
39
|
-
<strong><a href="../Origin.html">Smoke::Origin</a></strong>
|
40
|
-
</div>
|
41
|
-
</div>
|
42
|
-
<div id='content'>
|
43
|
-
<div id='text'>
|
44
|
-
<div id='description'>
|
45
|
-
<p>
|
46
|
-
<a href="YQL.html">YQL</a> will call to Yahoo <a href="YQL.html">YQL</a>
|
47
|
-
services
|
48
|
-
</p>
|
49
|
-
<p>
|
50
|
-
Usage:
|
51
|
-
</p>
|
52
|
-
<pre>Smoke.yql(:ruby) do
 select :all
 from "search.web"
 where :query, "ruby"
end</pre>
|
53
|
-
</div>
|
54
|
-
<div id='method-list'>
|
55
|
-
<h2>Methods</h2>
|
56
|
-
<h3>public instance</h3>
|
57
|
-
<ol>
|
58
|
-
<li><a href="#M000015">from</a></li>
|
59
|
-
<li><a href="#M000014">select</a></li>
|
60
|
-
<li><a href="#M000017">use</a></li>
|
61
|
-
<li><a href="#M000016">where</a></li>
|
62
|
-
</ol>
|
63
|
-
<h3>protected instance</h3>
|
64
|
-
<ol>
|
65
|
-
<li><a href="#M000019">dispatch</a></li>
|
66
|
-
<li><a href="#M000018">params</a></li>
|
67
|
-
</ol>
|
68
|
-
</div>
|
69
|
-
<div id='section'>
|
70
|
-
<div id='constants-list'>
|
71
|
-
<h2>Constants</h2>
|
72
|
-
<div class='name-list'>
|
73
|
-
<table summary='Constants'>
|
74
|
-
<tr class='top-aligned-row context-row'>
|
75
|
-
<td class='context-item-name'>API_BASE</td>
|
76
|
-
<td>=</td>
|
77
|
-
<td class='context-item-value'>"http://query.yahooapis.com/v1/public/yql"</td>
|
78
|
-
</tr>
|
79
|
-
</table>
|
80
|
-
</div>
|
81
|
-
</div>
|
82
|
-
<div id='attribute-list'>
|
83
|
-
<h2 class='section-bar'>Attributes</h2>
|
84
|
-
<div class='name-list'>
|
85
|
-
<table>
|
86
|
-
<tr class='top-aligned-row context-row'>
|
87
|
-
<td class='context-item-name'>request</td>
|
88
|
-
<td class='context-item-value'>[R]</td>
|
89
|
-
<td class='context-item-desc'></td>
|
90
|
-
</tr>
|
91
|
-
</table>
|
92
|
-
</div>
|
93
|
-
</div>
|
94
|
-
<div id='methods'>
|
95
|
-
<h2>Public instance methods</h2>
|
96
|
-
<div class='public-instance method' id='method-M000015'>
|
97
|
-
<a name='M000015'> </a>
|
98
|
-
<div class='synopsis'>
|
99
|
-
<span class='name'>from</span>
|
100
|
-
<span class='arguments'>(source)</span>
|
101
|
-
</div>
|
102
|
-
<div class='description'>
|
103
|
-
<p>
|
104
|
-
from corresponds to the from fragment of the <a href="YQL.html">YQL</a>
|
105
|
-
query Usage:
|
106
|
-
</p>
|
107
|
-
<pre>from "search.web"</pre>
|
108
|
-
<p>
|
109
|
-
or
|
110
|
-
</p>
|
111
|
-
<pre>from :html</pre>
|
112
|
-
</div>
|
113
|
-
<div class='source'>
|
114
|
-
<a class='source-toggle' href='#' onclick="toggleCode('M000015-source'); return false">
|
115
|
-
[show source]
|
116
|
-
</a>
|
117
|
-
<pre id='M000015-source'> <span class="ruby-comment cmt"># File lib/smoke/source/yql.rb, line 34</span>
34: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">from</span>(<span class="ruby-identifier">source</span>)
35: <span class="ruby-ivar">@from</span> = <span class="ruby-identifier">source</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">','</span>) <span class="ruby-keyword kw">and</span> <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">source</span>.<span class="ruby-identifier">is_a?</span> <span class="ruby-constant">Array</span>
36: <span class="ruby-ivar">@from</span> = <span class="ruby-identifier">source</span>.<span class="ruby-identifier">to_s</span>
37: <span class="ruby-keyword kw">end</span></pre>
|
118
|
-
</div>
|
119
|
-
</div>
|
120
|
-
<div class='public-instance method' id='method-M000014'>
|
121
|
-
<a name='M000014'> </a>
|
122
|
-
<div class='synopsis'>
|
123
|
-
<span class='name'>select</span>
|
124
|
-
<span class='arguments'>(what = :all)</span>
|
125
|
-
</div>
|
126
|
-
<div class='description'>
|
127
|
-
<p>
|
128
|
-
Select indicates what <a href="YQL.html">YQL</a> will be selecting Usage:
|
129
|
-
</p>
|
130
|
-
<pre>select :all
=> "SELECT *"
select :title
=> "SELECT title"
select :title, :description
=> "SELECT title, description"</pre>
|
131
|
-
</div>
|
132
|
-
<div class='source'>
|
133
|
-
<a class='source-toggle' href='#' onclick="toggleCode('M000014-source'); return false">
|
134
|
-
[show source]
|
135
|
-
</a>
|
136
|
-
<pre id='M000014-source'> <span class="ruby-comment cmt"># File lib/smoke/source/yql.rb, line 23</span>
23: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">select</span>(<span class="ruby-identifier">what</span> = <span class="ruby-identifier">:all</span>)
24: <span class="ruby-ivar">@select</span> = <span class="ruby-identifier">what</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">","</span>) <span class="ruby-keyword kw">and</span> <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">what</span>.<span class="ruby-identifier">is_a?</span> <span class="ruby-constant">Array</span>
25: <span class="ruby-ivar">@select</span> = <span class="ruby-value str">"*"</span> <span class="ruby-keyword kw">and</span> <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">what</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:all</span>
26: <span class="ruby-ivar">@select</span> = <span class="ruby-identifier">what</span>.<span class="ruby-identifier">to_s</span>
27: <span class="ruby-keyword kw">end</span></pre>
|
137
|
-
</div>
|
138
|
-
</div>
|
139
|
-
<div class='public-instance method' id='method-M000017'>
|
140
|
-
<a name='M000017'> </a>
|
141
|
-
<div class='synopsis'>
|
142
|
-
<span class='name'>use</span>
|
143
|
-
<span class='arguments'>(url)</span>
|
144
|
-
</div>
|
145
|
-
<div class='description'>
|
146
|
-
<p>
|
147
|
-
`use` can be used to set the url location of the data-table that you want
|
148
|
-
<a href="YQL.html">YQL</a> to search upon
|
149
|
-
</p>
|
150
|
-
<p>
|
151
|
-
Usage:
|
152
|
-
</p>
|
153
|
-
<pre>use "http://datatables.org/alltables.env"</pre>
|
154
|
-
</div>
|
155
|
-
<div class='source'>
|
156
|
-
<a class='source-toggle' href='#' onclick="toggleCode('M000017-source'); return false">
|
157
|
-
[show source]
|
158
|
-
</a>
|
159
|
-
<pre id='M000017-source'> <span class="ruby-comment cmt"># File lib/smoke/source/yql.rb, line 55</span>
55: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">use</span>(<span class="ruby-identifier">url</span>)
56: <span class="ruby-identifier">params</span>.<span class="ruby-identifier">merge!</span>({<span class="ruby-identifier">:env</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">url</span>})
57: <span class="ruby-keyword kw">end</span></pre>
|
160
|
-
</div>
|
161
|
-
</div>
|
162
|
-
<div class='public-instance method' id='method-M000016'>
|
163
|
-
<a name='M000016'> </a>
|
164
|
-
<div class='synopsis'>
|
165
|
-
<span class='name'>where</span>
|
166
|
-
<span class='arguments'>(column, value)</span>
|
167
|
-
</div>
|
168
|
-
<div class='description'>
|
169
|
-
<p>
|
170
|
-
where is a straight up match, no fancy matchers are currently supported
|
171
|
-
Usage:
|
172
|
-
</p>
|
173
|
-
<pre>where :xpath, "//div/div/a"</pre>
|
174
|
-
<p>
|
175
|
-
or
|
176
|
-
</p>
|
177
|
-
<pre>where :query, "python"</pre>
|
178
|
-
</div>
|
179
|
-
<div class='source'>
|
180
|
-
<a class='source-toggle' href='#' onclick="toggleCode('M000016-source'); return false">
|
181
|
-
[show source]
|
182
|
-
</a>
|
183
|
-
<pre id='M000016-source'> <span class="ruby-comment cmt"># File lib/smoke/source/yql.rb, line 45</span>
45: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">where</span>(<span class="ruby-identifier">column</span>, <span class="ruby-identifier">value</span>)
46: <span class="ruby-ivar">@where</span> = <span class="ruby-ivar">@where</span> <span class="ruby-operator">||</span> []
47: <span class="ruby-ivar">@where</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"#{column.to_s} = '#{value}'"</span>
48: <span class="ruby-keyword kw">end</span></pre>
|
184
|
-
</div>
|
185
|
-
</div>
|
186
|
-
<h2>Protected instance methods</h2>
|
187
|
-
<div class='protected-instance method' id='method-M000019'>
|
188
|
-
<a name='M000019'> </a>
|
189
|
-
<div class='synopsis'>
|
190
|
-
<span class='name'>dispatch</span>
|
191
|
-
<span class='arguments'>()</span>
|
192
|
-
</div>
|
193
|
-
<div class='source'>
|
194
|
-
<a class='source-toggle' href='#' onclick="toggleCode('M000019-source'); return false">
|
195
|
-
[show source]
|
196
|
-
</a>
|
197
|
-
<pre id='M000019-source'> <span class="ruby-comment cmt"># File lib/smoke/source/yql.rb, line 64</span>
64: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">dispatch</span>
65: <span class="ruby-ivar">@request</span> = <span class="ruby-constant">Smoke</span><span class="ruby-operator">::</span><span class="ruby-constant">Request</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">build_uri</span>)
66: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">items</span> = [(<span class="ruby-ivar">@path</span>.<span class="ruby-identifier">nil?</span>) <span class="ruby-operator">?</span> <span class="ruby-ivar">@request</span>.<span class="ruby-identifier">body</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">drill</span>(<span class="ruby-ivar">@request</span>.<span class="ruby-identifier">body</span>, <span class="ruby-operator">*</span><span class="ruby-ivar">@path</span>)]
67: <span class="ruby-keyword kw">end</span></pre>
|
198
|
-
</div>
|
199
|
-
</div>
|
200
|
-
<div class='protected-instance method' id='method-M000018'>
|
201
|
-
<a name='M000018'> </a>
|
202
|
-
<div class='synopsis'>
|
203
|
-
<span class='name'>params</span>
|
204
|
-
<span class='arguments'>()</span>
|
205
|
-
</div>
|
206
|
-
<div class='source'>
|
207
|
-
<a class='source-toggle' href='#' onclick="toggleCode('M000018-source'); return false">
|
208
|
-
[show source]
|
209
|
-
</a>
|
210
|
-
<pre id='M000018-source'> <span class="ruby-comment cmt"># File lib/smoke/source/yql.rb, line 60</span>
60: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">params</span> 
61: <span class="ruby-ivar">@params</span> <span class="ruby-operator">||</span> <span class="ruby-ivar">@params</span> = {}
62: <span class="ruby-keyword kw">end</span></pre>
|
211
|
-
</div>
|
212
|
-
</div>
|
213
|
-
</div>
|
214
|
-
</div>
|
215
|
-
</div>
|
216
|
-
</div>
|
217
|
-
<div id='footer-push'></div>
|
218
|
-
</div>
|
219
|
-
<div id='footer'>
|
220
|
-
<a href="http://github.com/mislav/hanna/tree/master"><strong>Hanna</strong> RDoc template</a>
|
221
|
-
</div>
|
222
|
-
</body>
|
223
|
-
</html>
|