barometer 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION.yml +1 -1
- data/bin/barometer +5 -2
- metadata +1 -18
- data/lib/webometer/public/css/master.css +0 -254
- data/lib/webometer/public/css/print.css +0 -90
- data/lib/webometer/public/css/syntax.css +0 -60
- data/lib/webometer/public/images/go.png +0 -0
- data/lib/webometer/public/images/link-out.gif +0 -0
- data/lib/webometer/views/contributing.erb +0 -32
- data/lib/webometer/views/forecast.erb +0 -14
- data/lib/webometer/views/index.erb +0 -66
- data/lib/webometer/views/layout.erb +0 -38
- data/lib/webometer/views/measurement.erb +0 -88
- data/lib/webometer/views/readme.erb +0 -338
- data/lib/webometer/webometer.rb +0 -34
data/VERSION.yml
CHANGED
data/bin/barometer
CHANGED
@@ -65,7 +65,7 @@ require 'yaml'
|
|
65
65
|
KEY_FILE = File.expand_path(File.join('~', '.barometer'))
|
66
66
|
|
67
67
|
class App
|
68
|
-
VERSION = '0.
|
68
|
+
VERSION = '0.2.3'
|
69
69
|
|
70
70
|
attr_reader :options
|
71
71
|
|
@@ -353,6 +353,7 @@ end
|
|
353
353
|
def pretty_info
|
354
354
|
title("INFO", 1)
|
355
355
|
value("GitHub", "http://github.com/attack/barometer")
|
356
|
+
value("Barometer Version", VERSION)
|
356
357
|
end
|
357
358
|
|
358
359
|
def pretty_output(barometer)
|
@@ -374,7 +375,9 @@ end
|
|
374
375
|
|
375
376
|
def run_web_mode(query=nil)
|
376
377
|
|
377
|
-
|
378
|
+
puts
|
379
|
+
puts "This is currently disabled"
|
380
|
+
puts
|
378
381
|
|
379
382
|
#require File.expand_path(File.dirname(__FILE__) + '/../lib/webometer/webometer.rb')
|
380
383
|
#require 'vegas'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: barometer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mark G
|
@@ -57,23 +57,6 @@ files:
|
|
57
57
|
- lib/barometer/services.rb
|
58
58
|
- lib/barometer/weather.rb
|
59
59
|
- lib/barometer.rb
|
60
|
-
- lib/webometer
|
61
|
-
- lib/webometer/public
|
62
|
-
- lib/webometer/public/css
|
63
|
-
- lib/webometer/public/css/master.css
|
64
|
-
- lib/webometer/public/css/print.css
|
65
|
-
- lib/webometer/public/css/syntax.css
|
66
|
-
- lib/webometer/public/images
|
67
|
-
- lib/webometer/public/images/go.png
|
68
|
-
- lib/webometer/public/images/link-out.gif
|
69
|
-
- lib/webometer/views
|
70
|
-
- lib/webometer/views/contributing.erb
|
71
|
-
- lib/webometer/views/forecast.erb
|
72
|
-
- lib/webometer/views/index.erb
|
73
|
-
- lib/webometer/views/layout.erb
|
74
|
-
- lib/webometer/views/measurement.erb
|
75
|
-
- lib/webometer/views/readme.erb
|
76
|
-
- lib/webometer/webometer.rb
|
77
60
|
- spec/barometer_spec.rb
|
78
61
|
- spec/data_current_spec.rb
|
79
62
|
- spec/data_distance_spec.rb
|
@@ -1,254 +0,0 @@
|
|
1
|
-
body {
|
2
|
-
color:#000;
|
3
|
-
font-family:'lucida grande', 'lucida sans unicade', sans-serif;
|
4
|
-
font-size:100%;
|
5
|
-
line-height:1.3;
|
6
|
-
background-color:#fff;
|
7
|
-
margin:0;
|
8
|
-
padding:0;
|
9
|
-
}
|
10
|
-
|
11
|
-
/* HEADER */
|
12
|
-
#head {
|
13
|
-
text-align:center;
|
14
|
-
}
|
15
|
-
#head img {
|
16
|
-
vertical-align:middle;
|
17
|
-
margin:-10px 0 0 -82px;
|
18
|
-
padding:0 15px 0 0;
|
19
|
-
border:0;
|
20
|
-
}
|
21
|
-
#head h1 {
|
22
|
-
color:#000;
|
23
|
-
font-family:'georgia', 'bitstream vera serif', serif;
|
24
|
-
font-size:4em;
|
25
|
-
font-weight:normal;
|
26
|
-
letter-spacing:-3px;
|
27
|
-
line-height:1;
|
28
|
-
margin:0;
|
29
|
-
padding:20px 0 8px 0;
|
30
|
-
}
|
31
|
-
#head h1 a, #head h1 a:link, #head h1 a:visited, #head h1 a:hover {
|
32
|
-
color:#100;
|
33
|
-
text-decoration:none;
|
34
|
-
}
|
35
|
-
#head ul {
|
36
|
-
font-size:1.1em;
|
37
|
-
font-family:"lucida console", "monaco", "andale mono", "bitstream vera sans mono",
|
38
|
-
"consolas", monospace;
|
39
|
-
font-weight:normal;
|
40
|
-
text-transform:uppercase;
|
41
|
-
letter-spacing:2px;
|
42
|
-
text-align:center;
|
43
|
-
margin:0;
|
44
|
-
padding:0 40px 0.25em 40px;
|
45
|
-
}
|
46
|
-
#head ul li {
|
47
|
-
display:inline;
|
48
|
-
list-style-type:none;
|
49
|
-
padding:0 0.5em 0 0;
|
50
|
-
}
|
51
|
-
#head ul a, #head ul a:link, #head ul a:visited {
|
52
|
-
color:#56534f;
|
53
|
-
text-decoration:none;
|
54
|
-
}
|
55
|
-
#head ul a:hover {
|
56
|
-
color:#000;
|
57
|
-
text-decoration:underline
|
58
|
-
}
|
59
|
-
|
60
|
-
/* CONTENT */
|
61
|
-
|
62
|
-
#content {
|
63
|
-
color:#333;
|
64
|
-
font-size:1.1em;
|
65
|
-
max-width:44em;
|
66
|
-
min-width:27em;
|
67
|
-
margin:7px auto;
|
68
|
-
border-top:2px solid #837d7c;
|
69
|
-
}
|
70
|
-
strong {
|
71
|
-
font-weight:bold;
|
72
|
-
}
|
73
|
-
|
74
|
-
/* HEADINGS */
|
75
|
-
|
76
|
-
h1, h2, h3, h4, h5, h6 {
|
77
|
-
color:#000;
|
78
|
-
}
|
79
|
-
h1, h2 {
|
80
|
-
color:#211d1f;
|
81
|
-
font-family:'georgia', 'bitstream vera serif', serif;
|
82
|
-
font-weight:normal;
|
83
|
-
}
|
84
|
-
h1 a, h2 a { color:#222 }
|
85
|
-
h1 {
|
86
|
-
font-size:2.25em;
|
87
|
-
letter-spacing:-1px;
|
88
|
-
margin-bottom:0;
|
89
|
-
}
|
90
|
-
h2 {
|
91
|
-
font-size:1.5em;
|
92
|
-
letter-spacing:-1px;
|
93
|
-
margin:1.25em 0 -0.32em 0;
|
94
|
-
}
|
95
|
-
h3 {
|
96
|
-
color:#211d1f;
|
97
|
-
font-size:1.02em;
|
98
|
-
font-weight:bold;
|
99
|
-
margin:1.8em 0 -0.25em 0;
|
100
|
-
letter-spacing:-1px;
|
101
|
-
}
|
102
|
-
h3 a {
|
103
|
-
color:#000;
|
104
|
-
text-decoration:underline;
|
105
|
-
}
|
106
|
-
|
107
|
-
/* LINKS */
|
108
|
-
a {
|
109
|
-
color:#000;
|
110
|
-
text-decoration:underline;
|
111
|
-
}
|
112
|
-
a:hover {
|
113
|
-
color:#910;
|
114
|
-
text-decoration:underline;
|
115
|
-
}
|
116
|
-
a img {
|
117
|
-
border:none;
|
118
|
-
}
|
119
|
-
a.out {
|
120
|
-
background: url('/images/link-out.gif') center right no-repeat;
|
121
|
-
padding-right: 12px;
|
122
|
-
}
|
123
|
-
|
124
|
-
|
125
|
-
/* CODE */
|
126
|
-
|
127
|
-
code, pre, textarea, tt {
|
128
|
-
font-family:"lucida console", "monaco", "andale mono", "bitstream vera sans mono",
|
129
|
-
"consolas", monospace;
|
130
|
-
}
|
131
|
-
pre {
|
132
|
-
font-size:0.85em;
|
133
|
-
background:#f4f5f5;
|
134
|
-
border:2px solid #d5d0d2;
|
135
|
-
padding:0.5em;
|
136
|
-
line-height:1.15;
|
137
|
-
color:#222;
|
138
|
-
}
|
139
|
-
code, tt {
|
140
|
-
font-size:0.85em;
|
141
|
-
color:#444;
|
142
|
-
}
|
143
|
-
h1 code, h2 code, h3 code, h4 code {
|
144
|
-
color:#333;
|
145
|
-
}
|
146
|
-
pre code {
|
147
|
-
font-size:1em;
|
148
|
-
color:#222;
|
149
|
-
}
|
150
|
-
|
151
|
-
/* MISC */
|
152
|
-
|
153
|
-
hr {
|
154
|
-
margin:3em 0;
|
155
|
-
padding:0;
|
156
|
-
color:#eee;
|
157
|
-
}
|
158
|
-
|
159
|
-
/* HOME */
|
160
|
-
|
161
|
-
body#home {
|
162
|
-
background: #fff url(../images/legend.gif) no-repeat fixed right 130px;
|
163
|
-
}
|
164
|
-
#home #content {
|
165
|
-
font-size:1.05em;
|
166
|
-
margin:20px 0 0 0;
|
167
|
-
padding:0 20px;
|
168
|
-
border-width:0;
|
169
|
-
}
|
170
|
-
#home #head, #home #foot {
|
171
|
-
display:none;
|
172
|
-
}
|
173
|
-
.pipe {
|
174
|
-
clear:both;
|
175
|
-
padding:50px 0;
|
176
|
-
}
|
177
|
-
.pipe p {
|
178
|
-
color:#000;
|
179
|
-
font-size:62px;
|
180
|
-
font-family:'georgia', 'bitstream vera serif', serif;
|
181
|
-
letter-spacing:-3px;
|
182
|
-
line-height:1;
|
183
|
-
text-align:right;
|
184
|
-
margin:0em 43% 0 0;
|
185
|
-
padding:0 60px 0 0;
|
186
|
-
}
|
187
|
-
.pipe pre {
|
188
|
-
float:right;
|
189
|
-
background:transparent;
|
190
|
-
font-size:28px;
|
191
|
-
margin:0;
|
192
|
-
padding:5px 0 0 0;
|
193
|
-
width:42%;
|
194
|
-
border-width:0;
|
195
|
-
}
|
196
|
-
.pipe pre code {
|
197
|
-
color:#666;
|
198
|
-
background:transparent;
|
199
|
-
}
|
200
|
-
.pipe.shell p {
|
201
|
-
font-size:56px;
|
202
|
-
}
|
203
|
-
.pipe.shell pre {
|
204
|
-
font-size:18px;
|
205
|
-
}
|
206
|
-
.pipe.nav p {
|
207
|
-
font-size:100px;
|
208
|
-
letter-spacing:-6px;
|
209
|
-
}
|
210
|
-
.pipe.nav pre {
|
211
|
-
font-size:36px;
|
212
|
-
padding-top:20px;
|
213
|
-
text-transform:uppercase;
|
214
|
-
letter-spacing:4px;
|
215
|
-
line-height:1.25;
|
216
|
-
}
|
217
|
-
.pipe.nav {
|
218
|
-
padding:25px 0 50px 0;
|
219
|
-
}
|
220
|
-
.pipe.nav a, .pipe.nav a:link, .pipe.nav a:visited {
|
221
|
-
color:#444;
|
222
|
-
text-decoration:none;
|
223
|
-
}
|
224
|
-
.pipe.nav a:hover {
|
225
|
-
color:#000;
|
226
|
-
text-decoration:underline;
|
227
|
-
}
|
228
|
-
|
229
|
-
form {
|
230
|
-
text-align: center;
|
231
|
-
}
|
232
|
-
|
233
|
-
form .text-input input {
|
234
|
-
font-family: "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Helvetica, Arial, sans-serif;
|
235
|
-
margin: 10px 0 5px 10px;
|
236
|
-
color: #686868;
|
237
|
-
font-size: 40px;
|
238
|
-
text-align: left;
|
239
|
-
text-transform: lowercase;
|
240
|
-
}
|
241
|
-
|
242
|
-
form .submit-input input {
|
243
|
-
position: relative;
|
244
|
-
margin: 0 7% 0 0;
|
245
|
-
float: right;
|
246
|
-
}
|
247
|
-
|
248
|
-
form .options-input {
|
249
|
-
position: relative;
|
250
|
-
margin: 0 7% 0 0;
|
251
|
-
float: left;
|
252
|
-
text-align: left;
|
253
|
-
}
|
254
|
-
|
@@ -1,90 +0,0 @@
|
|
1
|
-
body
|
2
|
-
{ color: #000;
|
3
|
-
background: #fff;
|
4
|
-
font-size: 85%;
|
5
|
-
font-family: Helvetica, sans-serif;
|
6
|
-
line-height: 130%;
|
7
|
-
margin: 0.5cm; }
|
8
|
-
|
9
|
-
a
|
10
|
-
{ color: #000;
|
11
|
-
text-decoration: underline; }
|
12
|
-
|
13
|
-
a img
|
14
|
-
{ border: none; }
|
15
|
-
|
16
|
-
/* HEADER */
|
17
|
-
#head {
|
18
|
-
text-align: center;
|
19
|
-
}
|
20
|
-
#head img {
|
21
|
-
vertical-align:middle;
|
22
|
-
margin:-10px 0 0 -82px;
|
23
|
-
padding:0 15px 0 0;
|
24
|
-
border:0;
|
25
|
-
}
|
26
|
-
#head h1 {
|
27
|
-
color: #172533;
|
28
|
-
font-family: Georgia, "Times New Roman", 'bitstream vera serif', serif;
|
29
|
-
font-size: 500%;
|
30
|
-
font-weight: normal;
|
31
|
-
letter-spacing: -0.1em;
|
32
|
-
line-height: 1;
|
33
|
-
margin: 0;
|
34
|
-
padding: 20px 0 16px 0;
|
35
|
-
}
|
36
|
-
#head h1 a, #head h1 a:link, #head h1 a:visited, #head h1 a:hover {
|
37
|
-
color: #172533;
|
38
|
-
text-decoration: none;
|
39
|
-
}
|
40
|
-
#head ul {
|
41
|
-
font-size:1.1em;
|
42
|
-
font-family: 'Lucida Grande', 'lucida sans unicade', Verdana, sans-serif;
|
43
|
-
font-weight: normal;
|
44
|
-
text-transform: uppercase;
|
45
|
-
text-align: center;
|
46
|
-
margin: 0;
|
47
|
-
padding: 0 40px 10px 40px;
|
48
|
-
}
|
49
|
-
#head ul li {
|
50
|
-
display: inline;
|
51
|
-
list-style-type: none;
|
52
|
-
padding: 0 1.5em 0 0;
|
53
|
-
}
|
54
|
-
#head ul a, #head ul a:link, #head ul a:visited {
|
55
|
-
color: #1d2e40;
|
56
|
-
text-decoration: none;
|
57
|
-
}
|
58
|
-
#head ul a:hover {
|
59
|
-
color: #0e1c29;
|
60
|
-
text-decoration:underline
|
61
|
-
}
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
h2 {
|
66
|
-
font-size: 1.5em;
|
67
|
-
letter-spacing: -0.05em;
|
68
|
-
padding: 1.15em 0 0 0;
|
69
|
-
margin: 1.25em 0 0.25em 0;
|
70
|
-
border-top: 1mm solid #999;
|
71
|
-
}
|
72
|
-
|
73
|
-
h3 {
|
74
|
-
font-size: 1.1em;
|
75
|
-
font-weight:bold;
|
76
|
-
margin: 1.8em 0 0.25em 0;
|
77
|
-
letter-spacing: -0.05em;
|
78
|
-
}
|
79
|
-
|
80
|
-
h3 a {
|
81
|
-
text-decoration:underline;
|
82
|
-
}
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
pre {
|
87
|
-
border: 1pt solid #ccc;
|
88
|
-
padding: 0.5em;
|
89
|
-
white-space: pre-wrap; white-space: -moz-pre-wrap !important;
|
90
|
-
}
|
@@ -1,60 +0,0 @@
|
|
1
|
-
.highlight { background: #ffffff; }
|
2
|
-
.highlight .c { color: #999988; font-style: italic } /* Comment */
|
3
|
-
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
|
4
|
-
.highlight .k { font-weight: bold; } /* Keyword */
|
5
|
-
.highlight .o { font-weight: bold } /* Operator */
|
6
|
-
.highlight .cm { color: #999988; font-style: italic } /* Comment.Multiline */
|
7
|
-
.highlight .cp { color: #999999; font-weight: bold } /* Comment.Preproc */
|
8
|
-
.highlight .c1 { color: #999988; font-style: italic } /* Comment.Single */
|
9
|
-
.highlight .cs { color: #999999; font-weight: bold; font-style: italic } /* Comment.Special */
|
10
|
-
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
|
11
|
-
.highlight .gd .x { color: #000000; background-color: #ffaaaa } /* Generic.Deleted.Specific */
|
12
|
-
.highlight .ge { font-style: italic } /* Generic.Emph */
|
13
|
-
.highlight .gr { color: #aa0000 } /* Generic.Error */
|
14
|
-
.highlight .gh { color: #999999 } /* Generic.Heading */
|
15
|
-
.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
|
16
|
-
.highlight .gi .x { color: #000000; background-color: #aaffaa } /* Generic.Inserted.Specific */
|
17
|
-
.highlight .go { color: #888888 } /* Generic.Output */
|
18
|
-
.highlight .gp { color: #555555 } /* Generic.Prompt */
|
19
|
-
.highlight .gs { font-weight: bold } /* Generic.Strong */
|
20
|
-
.highlight .gu { color: #aaaaaa } /* Generic.Subheading */
|
21
|
-
.highlight .gt { color: #aa0000 } /* Generic.Traceback */
|
22
|
-
.highlight .kc { font-weight: bold } /* Keyword.Constant */
|
23
|
-
.highlight .kd { font-weight: bold } /* Keyword.Declaration */
|
24
|
-
.highlight .kp { font-weight: bold } /* Keyword.Pseudo */
|
25
|
-
.highlight .kr { font-weight: bold } /* Keyword.Reserved */
|
26
|
-
.highlight .kt { color: #445588; font-weight: bold } /* Keyword.Type */
|
27
|
-
.highlight .m { color: #009999 } /* Literal.Number */
|
28
|
-
.highlight .s { color: #444 } /* Literal.String */
|
29
|
-
.highlight .na { color: #008080 } /* Name.Attribute */
|
30
|
-
.highlight .nb { color: #0086B3 } /* Name.Builtin */
|
31
|
-
.highlight .nc { color: #445588; font-weight: bold } /* Name.Class */
|
32
|
-
.highlight .no { color: #008080 } /* Name.Constant */
|
33
|
-
.highlight .ni { color: #800080 } /* Name.Entity */
|
34
|
-
.highlight .ne { color: #990000; font-weight: bold } /* Name.Exception */
|
35
|
-
.highlight .nf { color: #990000; font-weight: bold } /* Name.Function */
|
36
|
-
.highlight .nn { color: #555555 } /* Name.Namespace */
|
37
|
-
.highlight .nt { color: #000080 } /* Name.Tag */
|
38
|
-
.highlight .nv { color: #008080 } /* Name.Variable */
|
39
|
-
.highlight .ow { font-weight: bold } /* Operator.Word */
|
40
|
-
.highlight .w { color: #bbbbbb } /* Text.Whitespace */
|
41
|
-
.highlight .mf { color: #009999 } /* Literal.Number.Float */
|
42
|
-
.highlight .mh { color: #009999 } /* Literal.Number.Hex */
|
43
|
-
.highlight .mi { color: #009999 } /* Literal.Number.Integer */
|
44
|
-
.highlight .mo { color: #009999 } /* Literal.Number.Oct */
|
45
|
-
.highlight .sb { color: #444 } /* Literal.String.Backtick */
|
46
|
-
.highlight .sc { color: #444 } /* Literal.String.Char */
|
47
|
-
.highlight .sd { color: #444 } /* Literal.String.Doc */
|
48
|
-
.highlight .s2 { color: #444 } /* Literal.String.Double */
|
49
|
-
.highlight .se { color: #444 } /* Literal.String.Escape */
|
50
|
-
.highlight .sh { color: #444 } /* Literal.String.Heredoc */
|
51
|
-
.highlight .si { color: #444 } /* Literal.String.Interpol */
|
52
|
-
.highlight .sx { color: #444 } /* Literal.String.Other */
|
53
|
-
.highlight .sr { color: #009926 } /* Literal.String.Regex */
|
54
|
-
.highlight .s1 { color: #444 } /* Literal.String.Single */
|
55
|
-
.highlight .ss { color: #990073 } /* Literal.String.Symbol */
|
56
|
-
.highlight .bp { color: #999999 } /* Name.Builtin.Pseudo */
|
57
|
-
.highlight .vc { color: #008080 } /* Name.Variable.Class */
|
58
|
-
.highlight .vg { color: #008080 } /* Name.Variable.Global */
|
59
|
-
.highlight .vi { color: #008080 } /* Name.Variable.Instance */
|
60
|
-
.highlight .il { color: #009999 } /* Literal.Number.Integer.Long */
|
Binary file
|
Binary file
|
@@ -1,32 +0,0 @@
|
|
1
|
-
<h1 id='contribute'>Contribute</h1>
|
2
|
-
|
3
|
-
<p>Want to advance Barometer? Help out by contributing!</p>
|
4
|
-
|
5
|
-
<h2 id='find_a_bug'>Find a bug?</h2>
|
6
|
-
|
7
|
-
<p>Add it to GitHub by <a href='http://github.com/attack/barometer/issues'>creating a new issue</a>. Be sure to include all relevant information, like the versions of Barometer and Ruby you’re using. A <a href='http://gist.github.com/'>gist</a> of the code that caused the issue as well as any error messages are also very helpful.</p>
|
8
|
-
|
9
|
-
<h2 id='have_a_patch'>Have a patch?</h2>
|
10
|
-
|
11
|
-
<p>Bugs and feature requests that include patches are much more likely to get attention. Here are some guidelines that will help ensure your patch can be applied as quickly as possible:</p>
|
12
|
-
|
13
|
-
<ol>
|
14
|
-
<li>
|
15
|
-
<p><strong>Use <a href='http://git-scm.com'>Git</a> and <a href='http://github.com'>GitHub</a>:</strong> The easiest way to get setup is to fork the <a href='http://github.com/attack/barometer/'>attack/barometer repo</a>.
|
16
|
-
</p>
|
17
|
-
|
18
|
-
</li>
|
19
|
-
|
20
|
-
<li>
|
21
|
-
<p><strong>Write spec tests:</strong> If you add or modify functionality, it must include spec tests.</p>
|
22
|
-
</li>
|
23
|
-
|
24
|
-
<li>
|
25
|
-
<p><strong>Mind the <code>README</code>:</strong> If the patch adds or modifies a major feature, modify the <code>README.rdoc</code> file to reflect that.</p>
|
26
|
-
|
27
|
-
</li>
|
28
|
-
|
29
|
-
<li>
|
30
|
-
<p><strong>Push it:</strong> Once you’re ready, push your changes to a topic branch and add a note to the ticket with the URL to your branch. Or, say something like, “you can find the patch on johndoe/foobranch”.</p>
|
31
|
-
</li>
|
32
|
-
</ol>
|
@@ -1,14 +0,0 @@
|
|
1
|
-
<h4>for: <%= forecast.date %></h4>
|
2
|
-
<p>
|
3
|
-
<ul>
|
4
|
-
<li>Date: <%= forecast.date %></li>
|
5
|
-
<li>Icon: <%= forecast.icon %></li>
|
6
|
-
<li>Condition: <%= forecast.condition %></li>
|
7
|
-
<li>High: <%= forecast.high %></li>
|
8
|
-
<li>Low: <%= forecast.low %></li>
|
9
|
-
<li>POP: <%= forecast.pop %></li>
|
10
|
-
<% if forecast.sun %>
|
11
|
-
<li>Sun: rise - <%= forecast.sun.rise %>, set - <%= forecast.sun.set %></li>
|
12
|
-
<% end %>
|
13
|
-
</ul>
|
14
|
-
</p>
|
@@ -1,66 +0,0 @@
|
|
1
|
-
<h2 id='demo'>Measure the weather for:</h2>
|
2
|
-
|
3
|
-
<br/>
|
4
|
-
<form action="/" class="" id="" method="post">
|
5
|
-
<div class="text-input">
|
6
|
-
<input id="query_q" name="query[q]" size="25" type="text" />
|
7
|
-
</div>
|
8
|
-
<div class="submit-input">
|
9
|
-
<input src="/images/go.png" type="image" value="go →" />
|
10
|
-
</div>
|
11
|
-
<br/>
|
12
|
-
<div class="options-input">
|
13
|
-
Metric? :
|
14
|
-
<input id="query_metric" name="query[metric]" type="checkbox" value="1" checked="checked" />
|
15
|
-
<br/>
|
16
|
-
Source :
|
17
|
-
<input type="radio" name="query[source]" value="wunderground" checked="checked" /> Wunderground
|
18
|
-
<input type="radio" name="query[source]" value="yahoo" /> Yahoo
|
19
|
-
<input type="radio" name="query[source]" value="google" /> Google
|
20
|
-
<br/>
|
21
|
-
Force Geocode? :
|
22
|
-
<input id="query_geocode" name="query[geocode]" type="checkbox" value="1" checked="checked" />
|
23
|
-
</div>
|
24
|
-
</form>
|
25
|
-
|
26
|
-
<p> </p>
|
27
|
-
<br/>
|
28
|
-
|
29
|
-
<% if params[:query] && !params[:query][:q].empty? %>
|
30
|
-
<h2>query: "<%= params[:query][:q] %>"</h2>
|
31
|
-
<% end %>
|
32
|
-
|
33
|
-
<% if @weather %>
|
34
|
-
|
35
|
-
<h2>Summary</h2>
|
36
|
-
<p>
|
37
|
-
<ul>
|
38
|
-
<li>Day?: <%= @weather.day? %></li>
|
39
|
-
<li>Sunny?: <%= @weather.sunny? %></li>
|
40
|
-
<li>Windy?: <%= @weather.windy? %></li>
|
41
|
-
<li>Wet?: <%= @weather.wet? %></li>
|
42
|
-
</ul>
|
43
|
-
</p>
|
44
|
-
|
45
|
-
<% if @barometer.query %>
|
46
|
-
<h3>Query</h3>
|
47
|
-
<p>
|
48
|
-
<ul>
|
49
|
-
<li>Format: <%= @barometer.query.format %></li>
|
50
|
-
<% if @barometer.query.geo %>
|
51
|
-
<li>Locality: <%= @barometer.query.geo.locality %></li>
|
52
|
-
<li>Region: <%= @barometer.query.geo.region %></li>
|
53
|
-
<li>Country: <%= @barometer.query.geo.country %></li>
|
54
|
-
<li>Country Code: <%= @barometer.query.geo.country_code %></li>
|
55
|
-
<li>Latitude: <%= @barometer.query.geo.latitude %></li>
|
56
|
-
<li>Longitude: <%= @barometer.query.geo.longitude %></li>
|
57
|
-
<% end %>
|
58
|
-
</ul>
|
59
|
-
</p>
|
60
|
-
<% end %>
|
61
|
-
|
62
|
-
<% @weather.measurements.each do |measurement| %>
|
63
|
-
<%= erb(:measurement, :locals => { :measurement => measurement }, :layout => false) %>
|
64
|
-
<% end %>
|
65
|
-
|
66
|
-
<% end %>
|
@@ -1,38 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
5
|
-
<title>Barometer</title>
|
6
|
-
<link rel='stylesheet' href='/css/master.css' type='text/css' media="screen, projection">
|
7
|
-
<link rel='stylesheet' href='/css/syntax.css' type='text/css' media="screen, projection">
|
8
|
-
<link rel='stylesheet' href='/css/print.css' type='text/css' media="print">
|
9
|
-
<link rel='shortcut icon' href='/images/favicon.ico'>
|
10
|
-
<link rel='alternate' href='http://attack.github.com/feed.xml' type='application/atom+xml' title='Sinatra Blog'>
|
11
|
-
|
12
|
-
</head>
|
13
|
-
<body id=''>
|
14
|
-
|
15
|
-
<div id='wrap'>
|
16
|
-
|
17
|
-
<div id='head'>
|
18
|
-
<h1><a href='/'>Barometer</a></h1>
|
19
|
-
<ul>
|
20
|
-
<li><a href='/'>Demo</a></li>
|
21
|
-
<li><a href='/readme.html'>README</a></li>
|
22
|
-
<li><a href='/contributing.html'>Contribute</a></li>
|
23
|
-
<li><a class="out" href='http://github.com/attack/barometer'>Code</a></li>
|
24
|
-
</ul>
|
25
|
-
</div>
|
26
|
-
|
27
|
-
<div id='content'>
|
28
|
-
<%= yield %>
|
29
|
-
</div>
|
30
|
-
|
31
|
-
<div id='foot'>
|
32
|
-
</div>
|
33
|
-
|
34
|
-
</div>
|
35
|
-
|
36
|
-
<a href="http://github.com/attack/barometer"><img style="position: absolute; top: 0; right: 0; border: 0;" src="http://s3.amazonaws.com/github/ribbons/forkme_right_gray_6d6d6d.png" alt="Fork me on GitHub" /></a>
|
37
|
-
</body>
|
38
|
-
</html>
|
@@ -1,88 +0,0 @@
|
|
1
|
-
<h2><%= measurement.source.to_s.capitalize %></h2>
|
2
|
-
<p>
|
3
|
-
<ul>
|
4
|
-
<li>Source: <%= measurement.source %></li>
|
5
|
-
<li>Time: <%= measurement.time %></li>
|
6
|
-
<li>Metric: <%= measurement.metric? %></li>
|
7
|
-
<li>Success: <%= measurement.success? %></li>
|
8
|
-
</ul>
|
9
|
-
</p>
|
10
|
-
|
11
|
-
<% if measurement.location %>
|
12
|
-
<h3>Location</h3>
|
13
|
-
<p>
|
14
|
-
<ul>
|
15
|
-
<li>id: <%= measurement.location.id %></li>
|
16
|
-
<li>Name: <%= measurement.location.name %></li>
|
17
|
-
<li>City: <%= measurement.location.city %> %</li>
|
18
|
-
<li>State Name: <%= measurement.location.state_name %></li>
|
19
|
-
<li>State Code: <%= measurement.location.state_code %></li>
|
20
|
-
<li>Country: <%= measurement.location.country %></li>
|
21
|
-
<li>Country Code: <%= measurement.location.country_code %></li>
|
22
|
-
<li>Zip Code: <%= measurement.location.zip_code %></li>
|
23
|
-
<li>Latitude: <%= measurement.location.latitude %></li>
|
24
|
-
<li>Longitude: <%= measurement.location.longitude %></li>
|
25
|
-
</ul>
|
26
|
-
</p>
|
27
|
-
<% end %>
|
28
|
-
|
29
|
-
<% if measurement.station %>
|
30
|
-
<h3>Station</h3>
|
31
|
-
<p>
|
32
|
-
<ul>
|
33
|
-
<li>id: <%= measurement.station.id %></li>
|
34
|
-
<li>Name: <%= measurement.station.name %></li>
|
35
|
-
<li>City: <%= measurement.station.city %> %</li>
|
36
|
-
<li>State Name: <%= measurement.station.state_name %></li>
|
37
|
-
<li>State Code: <%= measurement.station.state_code %></li>
|
38
|
-
<li>Country: <%= measurement.station.country %></li>
|
39
|
-
<li>Country Code: <%= measurement.station.country_code %></li>
|
40
|
-
<li>Zip Code: <%= measurement.station.zip_code %></li>
|
41
|
-
<li>Latitude: <%= measurement.station.latitude %></li>
|
42
|
-
<li>Longitude: <%= measurement.station.longitude %></li>
|
43
|
-
</ul>
|
44
|
-
</p>
|
45
|
-
<% end %>
|
46
|
-
|
47
|
-
<% if measurement.timezone %>
|
48
|
-
<h3>Timezone</h3>
|
49
|
-
<p>
|
50
|
-
<ul>
|
51
|
-
<li>Long: <%= measurement.timezone.timezone %></li>
|
52
|
-
<li>Code: <%= measurement.timezone.code %></li>
|
53
|
-
<li>DST?: <%= measurement.timezone.dst? %></li>
|
54
|
-
</ul>
|
55
|
-
</p>
|
56
|
-
<% end %>
|
57
|
-
|
58
|
-
<% if measurement.current %>
|
59
|
-
<h3>Current</h3>
|
60
|
-
<p>
|
61
|
-
<ul>
|
62
|
-
<li>Time: <%= measurement.current.time %></li>
|
63
|
-
<li>Local Time: <%= measurement.current.local_time %></li>
|
64
|
-
<li>Humidity: <%= measurement.current.humidity %> %</li>
|
65
|
-
<li>Icon: <%= measurement.current.icon %></li>
|
66
|
-
<li>Condition: <%= measurement.current.condition %></li>
|
67
|
-
<li>Temperature: <%= measurement.current.temperature %></li>
|
68
|
-
<li>Dew Point: <%= measurement.current.dew_point %></li>
|
69
|
-
<li>Heat Index: <%= measurement.current.heat_index %></li>
|
70
|
-
<li>Wind Chill: <%= measurement.current.wind_chill %></li>
|
71
|
-
<li>Wind: <%= measurement.current.wind %> @ <%= measurement.current.wind.direction %> [<%= measurement.current.wind.degrees %> degrees]</li>
|
72
|
-
<li>Pressure: <%= measurement.current.pressure %></li>
|
73
|
-
<li>Visibility: <%= measurement.current.visibility %></li>
|
74
|
-
<% if measurement.current.sun %>
|
75
|
-
<li>Sun: rise - <%= measurement.current.sun.rise %>, set - <%= measurement.current.sun.set %></li>
|
76
|
-
<% end %>
|
77
|
-
</ul>
|
78
|
-
</p>
|
79
|
-
<% end %>
|
80
|
-
|
81
|
-
<% if measurement.forecast %>
|
82
|
-
<h3>Forecast</h3>
|
83
|
-
|
84
|
-
<% measurement.forecast.each do |forecast| %>
|
85
|
-
<%= erb(:forecast, :locals => { :forecast => forecast }, :layout => false) %>
|
86
|
-
<% end %>
|
87
|
-
|
88
|
-
<% end %>
|
@@ -1,338 +0,0 @@
|
|
1
|
-
<h1>barometer</h1>
|
2
|
-
<p>
|
3
|
-
A multi API consuming weather forecasting superstar.
|
4
|
-
|
5
|
-
</p>
|
6
|
-
<p>
|
7
|
-
Barometer provides a common public API to one or more weather services
|
8
|
-
(APIs) of your choice. Weather services can co-exist to retrieve extensive
|
9
|
-
information, or they can be used in a hierarchical configuration where
|
10
|
-
lower preferred weather services are only used if previous services are
|
11
|
-
unavailable.
|
12
|
-
</p>
|
13
|
-
<h2>status</h2>
|
14
|
-
<p>
|
15
|
-
Currently this project is in development and will only work for a few
|
16
|
-
weather services (wunderground, google, yahoo).
|
17
|
-
</p>
|
18
|
-
<p>
|
19
|
-
Features to be added before first release:
|
20
|
-
</p>
|
21
|
-
<ul>
|
22
|
-
<li>gem setup/config, apply to rubyforge
|
23
|
-
|
24
|
-
</li>
|
25
|
-
</ul>
|
26
|
-
<p>
|
27
|
-
|
28
|
-
Features to be added in future releases:
|
29
|
-
</p>
|
30
|
-
<ul>
|
31
|
-
<li>even more weather service drivers (noaa, weather.com, weatherbug)
|
32
|
-
|
33
|
-
</li>
|
34
|
-
<li>ability to query multiple services and combine/average the results
|
35
|
-
|
36
|
-
</li>
|
37
|
-
<li>support iaco as a query format
|
38
|
-
|
39
|
-
</li>
|
40
|
-
</ul>
|
41
|
-
<h1>dependencies</h1>
|
42
|
-
<h3>HTTParty</h3>
|
43
|
-
<p>
|
44
|
-
Why? HTTParty was created and designed specifically for consuming web
|
45
|
-
services. I choose to use this over using the Net::HTTP library directly to
|
46
|
-
allow for faster development of this project.
|
47
|
-
</p>
|
48
|
-
|
49
|
-
<p>
|
50
|
-
HTTParty is also extended to include configurable Timoout support.
|
51
|
-
</p>
|
52
|
-
<h3>tzinfo</h3>
|
53
|
-
<p>
|
54
|
-
Why? Barometer deals with time information for locations all over the
|
55
|
-
world. This information doesn’t mean that much if it can’t be
|
56
|
-
converted to times that don’t correspond to the applicable timezone.
|
57
|
-
Tzinfo handles this time zone manipulation.
|
58
|
-
</p>
|
59
|
-
<h3>graticule (very soft dependency)</h3>
|
60
|
-
<p>
|
61
|
-
Why? Barometer returns the weather for a given location. Most weather
|
62
|
-
service APIs are somewhat restricted on the query format they receive. To
|
63
|
-
bridge this gap and allow for maximum flexibility on the
|
64
|
-
‘barometer’ query format, the query will be geo-coded using the
|
65
|
-
Google geocoding service, if required. Graticule can provide this geocoding
|
66
|
-
interface.
|
67
|
-
|
68
|
-
</p>
|
69
|
-
<p>
|
70
|
-
Using Graticule requires a free Google API key for geocoding. It is
|
71
|
-
possible to use barometer without geocoding, though your query format will
|
72
|
-
be limited to that of the weather service API.
|
73
|
-
</p>
|
74
|
-
<p>
|
75
|
-
ALTERNATE: If you supply a Google API key but don’t install the
|
76
|
-
Graticule gem, HTTParty will be used instead to provide the same geocoding.
|
77
|
-
Basically Graticule is only used if it exists.
|
78
|
-
</p>
|
79
|
-
<p>
|
80
|
-
NOTE: you can force Barometer not to use Graticule, even if you have it
|
81
|
-
installed using the following:
|
82
|
-
</p>
|
83
|
-
<pre>
|
84
|
-
Barometer.skip_graticule = true
|
85
|
-
</pre>
|
86
|
-
<h1>usage</h1>
|
87
|
-
|
88
|
-
<p>
|
89
|
-
You can use barometer right out of the box, as it is configured to use one
|
90
|
-
register-less (no API key required) international weather service
|
91
|
-
(wunderground.com).
|
92
|
-
</p>
|
93
|
-
<p>
|
94
|
-
For better results, signup for a google-map key and enhance your barometer
|
95
|
-
with geo-coding.
|
96
|
-
</p>
|
97
|
-
<pre>
|
98
|
-
require 'barometer'
|
99
|
-
|
100
|
-
Barometer.google_geocode_key = "THE_GOOGLE_API_KEY"
|
101
|
-
barometer = Barometer.new("Paris")
|
102
|
-
weather = barometer.measure
|
103
|
-
|
104
|
-
puts weather.current.temperture
|
105
|
-
</pre>
|
106
|
-
<h2>multiple weather API, with hierarchy</h2>
|
107
|
-
|
108
|
-
<pre>
|
109
|
-
require 'barometer'
|
110
|
-
|
111
|
-
Barometer.google_geocode_key = "THE_GOOGLE_API_KEY"
|
112
|
-
# use yahoo and google, if they both fail, use wunderground
|
113
|
-
Barometer.selection = { 1 => [:yahoo, :google], 2 => :wunderground }
|
114
|
-
|
115
|
-
barometer = Barometer.new("Paris")
|
116
|
-
weather = barometer.measure
|
117
|
-
|
118
|
-
puts weather.current.temperture
|
119
|
-
</pre>
|
120
|
-
<h2>command line</h2>
|
121
|
-
<p>
|
122
|
-
|
123
|
-
You can use barometer from the command line.
|
124
|
-
</p>
|
125
|
-
<pre>
|
126
|
-
# barometer berlin
|
127
|
-
</pre>
|
128
|
-
<p>
|
129
|
-
This will output the weather information for the given query.
|
130
|
-
</p>
|
131
|
-
<h3>fail</h3>
|
132
|
-
<p>
|
133
|
-
What would cause a weather service to fail? The most obvious is that the
|
134
|
-
particular weather service in currently unavailable or not reachable. Other
|
135
|
-
possible reasons would include not having the API (or a valid API key for
|
136
|
-
the particular weather service, if required), not providing a valid query,
|
137
|
-
or providing a query for a location not supported by the weather service.
|
138
|
-
</p>
|
139
|
-
<p>
|
140
|
-
For example, if you look at the example above, the query of
|
141
|
-
"Paris" refers to a city in France. Yahoo weather services only
|
142
|
-
supports weather results for USA (at least at the time of writing).
|
143
|
-
Therefore, Barometer would not use Yahoo, just Google and failover to use
|
144
|
-
Wunderground (if needed).
|
145
|
-
|
146
|
-
</p>
|
147
|
-
<h3>bootstrapping</h3>
|
148
|
-
<p>
|
149
|
-
You can use weather service drivers directly. Below is an example to use
|
150
|
-
Wunderground, but since the driver interface is abstracted it will be the
|
151
|
-
same for all supported services.
|
152
|
-
</p>
|
153
|
-
<pre>
|
154
|
-
require 'barometer'
|
155
|
-
Barometer.google_geocode_key = "THE_GOOGLE_API_KEY"
|
156
|
-
|
157
|
-
query = Barometer::Query.new("Paris")
|
158
|
-
weather = Barometer::Service.source(:wunderground).measure(query)
|
159
|
-
|
160
|
-
puts weather.current.temperture
|
161
|
-
|
162
|
-
# OR, even more raw
|
163
|
-
|
164
|
-
measurement = Barometer::Measurement.new
|
165
|
-
weather = Barometer::Wunderground.measure_all(measurement, "Paris")
|
166
|
-
|
167
|
-
puts weather.current.temperture
|
168
|
-
|
169
|
-
</pre>
|
170
|
-
<p>
|
171
|
-
NOTE: The disadvantage to using the drivers directly is that you lose the
|
172
|
-
advantage of redundancy/failover added by the Module as a whole.
|
173
|
-
</p>
|
174
|
-
<p>
|
175
|
-
NOTE: You still must create the Barometer::Query object with your query
|
176
|
-
string instead of directly feeding the query string to the service (as in
|
177
|
-
bootstrap example #1). The Barometer::Query object has behavior required by
|
178
|
-
the service that a regular String doesn’t have. Using a driver
|
179
|
-
directly WILL accept a String (as in bootstrap example #2).
|
180
|
-
</p>
|
181
|
-
<h2>searching</h2>
|
182
|
-
<p>
|
183
|
-
After you have measured the data, Barometer provides several methods to
|
184
|
-
help you get the data you are after. All examples assume you already have
|
185
|
-
measured the data as shown in the above examples.
|
186
|
-
</p>
|
187
|
-
<h3>by preference (default service)</h3>
|
188
|
-
<pre>
|
189
|
-
weather.default # returns measurement for default source
|
190
|
-
weather.current # returns current_measurement for default
|
191
|
-
weather.now # returns current_measurement for default
|
192
|
-
weather.forecast # returns all forecast_measurements for default
|
193
|
-
weather.today # returns forecast_measurement for default today
|
194
|
-
weather.tomorrow # returns forecast_measurement for default tomorrow
|
195
|
-
|
196
|
-
puts weather.now.temperature.c
|
197
|
-
puts weather.tomorrow.high.c
|
198
|
-
|
199
|
-
</pre>
|
200
|
-
<h3>by source</h3>
|
201
|
-
<pre>
|
202
|
-
weather.source(:wunderground) # returns measurement for specified source
|
203
|
-
weather.sources # lists all successful sources
|
204
|
-
|
205
|
-
puts weather.source(:wunderground).current.temperature.c
|
206
|
-
</pre>
|
207
|
-
<h3>by date</h3>
|
208
|
-
<pre>
|
209
|
-
# note, the date is the date of the locations weather, not the date of the
|
210
|
-
# user measuring the weather
|
211
|
-
date = Date.parse("01-01-2009")
|
212
|
-
weather.for(date) # returns forecast_measurement for default on date
|
213
|
-
weather.source(:wunderground).for(date) # same as above but specific source
|
214
|
-
|
215
|
-
puts weather.source(:wunderground).for(date).high.c
|
216
|
-
</pre>
|
217
|
-
<h3>by time</h3>
|
218
|
-
|
219
|
-
<pre>
|
220
|
-
# note, the time is the time of the locations weather, not the time of the
|
221
|
-
# user measuring the weather
|
222
|
-
time = Time.parse("13:00 01-01-2009")
|
223
|
-
weather.for(time) # returns forecast_measurement for default at time
|
224
|
-
weather.source(:wunderground).for(time) # same as above but specific source
|
225
|
-
|
226
|
-
puts weather.source(:wunderground).for(time).low.f
|
227
|
-
</pre>
|
228
|
-
<h2>simple answers</h2>
|
229
|
-
<p>
|
230
|
-
After you have measured the data, Barometer provides several "simple
|
231
|
-
answer" methods to help you get answers to some basic questions. All
|
232
|
-
examples assume you already have measured the data as shown in the above
|
233
|
-
examples.
|
234
|
-
</p>
|
235
|
-
<p>
|
236
|
-
All of these questions are ultimately specific to the weather source(s) you
|
237
|
-
are configured to use. All sources that have successfully measured data
|
238
|
-
will be asked, but if there is no data that can answer the question then
|
239
|
-
there will be no answer.
|
240
|
-
</p>
|
241
|
-
|
242
|
-
<h3>is it windy?</h3>
|
243
|
-
<pre>
|
244
|
-
# 1st parameter is the threshold wind speed for being windy
|
245
|
-
# 2nd parameter is the utc_time for which you want to know the answer,
|
246
|
-
# this defaults to the current time
|
247
|
-
# NOTE: in my example the values are metric, so the threshold is 10 kph
|
248
|
-
|
249
|
-
weather.windy?(10)
|
250
|
-
</pre>
|
251
|
-
<h3>is it wet?</h3>
|
252
|
-
<pre>
|
253
|
-
# 1st parameter is the threshold pop (%) for being wet
|
254
|
-
# 2nd parameter is the utc_time for which you want to know the answer,
|
255
|
-
# this defaults to the current time
|
256
|
-
# NOTE: in my example the threshold is 50 %
|
257
|
-
|
258
|
-
weather.wet?(50)
|
259
|
-
</pre>
|
260
|
-
<h3>is it sunny?</h3>
|
261
|
-
<pre>
|
262
|
-
# 1st parameter is the utc_time for which you want to know the answer,
|
263
|
-
# this defaults to the current time
|
264
|
-
|
265
|
-
weather.sunny?
|
266
|
-
|
267
|
-
</pre>
|
268
|
-
<h3>is it day?</h3>
|
269
|
-
<pre>
|
270
|
-
# 1st parameter is the utc_time for which you want to know the answer,
|
271
|
-
# this defaults to the current time
|
272
|
-
|
273
|
-
weather.day?
|
274
|
-
</pre>
|
275
|
-
<h3>is it night?</h3>
|
276
|
-
<pre>
|
277
|
-
# 1st parameter is the utc_time for which you want to know the answer,
|
278
|
-
# this defaults to the current time
|
279
|
-
|
280
|
-
weather.night?
|
281
|
-
</pre>
|
282
|
-
<h1>design</h1>
|
283
|
-
<ul>
|
284
|
-
<li>create a Barometer instance
|
285
|
-
|
286
|
-
|
287
|
-
</li>
|
288
|
-
<li>supply a query, there are very little restrictions on the format:
|
289
|
-
|
290
|
-
<ul>
|
291
|
-
<li>city, country, specific address (basically anything Google will geocode)
|
292
|
-
|
293
|
-
</li>
|
294
|
-
<li>US zip code (skips geocoding if weather service accepts this directly)
|
295
|
-
|
296
|
-
</li>
|
297
|
-
<li>postal code (skips geocoding if weather service accepts this directly)
|
298
|
-
|
299
|
-
</li>
|
300
|
-
<li>latitude and longitude (skips geocoding if weather service accepts this
|
301
|
-
directly)
|
302
|
-
|
303
|
-
</li>
|
304
|
-
<li>TODO: international airport code (skips geocoding if weather service
|
305
|
-
accepts this directly)
|
306
|
-
|
307
|
-
</li>
|
308
|
-
</ul>
|
309
|
-
</li>
|
310
|
-
<li>if geocoding required, geocode the query
|
311
|
-
|
312
|
-
</li>
|
313
|
-
|
314
|
-
<li>determine which weather services will be queried (one or multiple)
|
315
|
-
|
316
|
-
</li>
|
317
|
-
<li>query the weather services
|
318
|
-
|
319
|
-
</li>
|
320
|
-
<li>save the data
|
321
|
-
|
322
|
-
</li>
|
323
|
-
<li>repeat weather service queries as needed
|
324
|
-
|
325
|
-
</li>
|
326
|
-
</ul>
|
327
|
-
<h1>extending</h1>
|
328
|
-
<p>
|
329
|
-
Barometer attempts to be a common API to any weather service API. I have
|
330
|
-
included several weather service ‘drivers’, but I know there
|
331
|
-
are many more available. Please use the provided ones as examples to create
|
332
|
-
more.
|
333
|
-
</p>
|
334
|
-
<h2>copyright</h2>
|
335
|
-
|
336
|
-
<p>
|
337
|
-
Copyright © 2009 Mark G. See LICENSE for details.
|
338
|
-
</p>
|
data/lib/webometer/webometer.rb
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'sinatra'
|
3
|
-
|
4
|
-
require 'barometer'
|
5
|
-
Barometer.google_geocode_key ||= "ABQIAAAAq8TH4offRcGrok8JVY_MyxRi_j0U6kJrkFvY4-OX2XYmEAa76BSFwMlSow1YgX8BOPUeve_shMG7xw"
|
6
|
-
|
7
|
-
class Webometer < Sinatra::Default
|
8
|
-
|
9
|
-
get '/' do
|
10
|
-
erb :index
|
11
|
-
end
|
12
|
-
|
13
|
-
post '/' do
|
14
|
-
# apply options
|
15
|
-
Barometer.force_geocode = (params[:query][:geocode].to_s == "1" ? true : false)
|
16
|
-
Barometer.selection = { 1 => [ params[:query][:source].to_sym ] }
|
17
|
-
metric = (params[:query][:metric].to_s == "1" ? true : false)
|
18
|
-
|
19
|
-
if params[:query] && !params[:query][:q].empty?
|
20
|
-
@barometer = Barometer.new(params[:query][:q])
|
21
|
-
@weather = @barometer.measure(metric)
|
22
|
-
end
|
23
|
-
erb :index
|
24
|
-
end
|
25
|
-
|
26
|
-
get '/contributing.html' do
|
27
|
-
erb :contributing
|
28
|
-
end
|
29
|
-
|
30
|
-
get '/readme.html' do
|
31
|
-
erb :readme
|
32
|
-
end
|
33
|
-
|
34
|
-
end
|