usgs-ruby 1.0.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.
Files changed (57) hide show
  1. checksums.yaml +7 -0
  2. data/.rubocop.yml +87 -0
  3. data/CHANGELOG.md +5 -0
  4. data/CODE_OF_CONDUCT.md +84 -0
  5. data/LICENSE.txt +21 -0
  6. data/README.md +256 -0
  7. data/Rakefile +24 -0
  8. data/docs/Usgs/Client.html +563 -0
  9. data/docs/Usgs/DailyValues.html +338 -0
  10. data/docs/Usgs/InstantaneousValues.html +329 -0
  11. data/docs/Usgs/Models/Reading.html +1124 -0
  12. data/docs/Usgs/Models/Site.html +2030 -0
  13. data/docs/Usgs/Models/Statistic.html +3981 -0
  14. data/docs/Usgs/Models.html +117 -0
  15. data/docs/Usgs/Parser.html +346 -0
  16. data/docs/Usgs/Parsers/RdbParser.html +354 -0
  17. data/docs/Usgs/Parsers/SiteParser.html +174 -0
  18. data/docs/Usgs/Parsers/StatisticsParser.html +228 -0
  19. data/docs/Usgs/Parsers/TimeSeriesParser.html +189 -0
  20. data/docs/Usgs/Parsers.html +117 -0
  21. data/docs/Usgs/Site.html +445 -0
  22. data/docs/Usgs/Statistics.html +335 -0
  23. data/docs/Usgs/Utils.html +357 -0
  24. data/docs/Usgs.html +303 -0
  25. data/docs/_index.html +286 -0
  26. data/docs/class_list.html +54 -0
  27. data/docs/css/common.css +1 -0
  28. data/docs/css/full_list.css +58 -0
  29. data/docs/css/style.css +503 -0
  30. data/docs/file.README.html +111 -0
  31. data/docs/file_list.html +59 -0
  32. data/docs/frames.html +22 -0
  33. data/docs/index.html +111 -0
  34. data/docs/js/app.js +344 -0
  35. data/docs/js/full_list.js +242 -0
  36. data/docs/js/jquery.js +4 -0
  37. data/docs/method_list.html +598 -0
  38. data/docs/top-level-namespace.html +110 -0
  39. data/lib/usgs/client.rb +62 -0
  40. data/lib/usgs/daily_values.rb +38 -0
  41. data/lib/usgs/instantaneous_values.rb +35 -0
  42. data/lib/usgs/models/reading.rb +43 -0
  43. data/lib/usgs/models/site.rb +61 -0
  44. data/lib/usgs/models/statistic.rb +95 -0
  45. data/lib/usgs/parser.rb +23 -0
  46. data/lib/usgs/parsers/rdb_parser.rb +55 -0
  47. data/lib/usgs/parsers/site_parser.rb +13 -0
  48. data/lib/usgs/parsers/statistics_parser.rb +40 -0
  49. data/lib/usgs/parsers/time_series_parser.rb +54 -0
  50. data/lib/usgs/site.rb +50 -0
  51. data/lib/usgs/statistics.rb +42 -0
  52. data/lib/usgs/utils.rb +50 -0
  53. data/lib/usgs/version.rb +5 -0
  54. data/lib/usgs.rb +28 -0
  55. data/sig/usgs/ruby.rbs +6 -0
  56. data/usgs-ruby.gemspec +48 -0
  57. metadata +231 -0
@@ -0,0 +1,338 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>
7
+ Module: Usgs::DailyValues
8
+
9
+ &mdash; Documentation by YARD 0.9.37
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="../css/style.css" type="text/css" />
14
+
15
+ <link rel="stylesheet" href="../css/common.css" type="text/css" />
16
+
17
+ <script type="text/javascript">
18
+ pathId = "Usgs::DailyValues";
19
+ relpath = '../';
20
+ </script>
21
+
22
+
23
+ <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
24
+
25
+ <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
26
+
27
+
28
+ </head>
29
+ <body>
30
+ <div class="nav_wrap">
31
+ <iframe id="nav" src="../class_list.html?1"></iframe>
32
+ <div id="resizer"></div>
33
+ </div>
34
+
35
+ <div id="main" tabindex="-1">
36
+ <div id="header">
37
+ <div id="menu">
38
+
39
+ <a href="../_index.html">Index (D)</a> &raquo;
40
+ <span class='title'><span class='object_link'><a href="../Usgs.html" title="Usgs (module)">Usgs</a></span></span>
41
+ &raquo;
42
+ <span class="title">DailyValues</span>
43
+
44
+ </div>
45
+
46
+ <div id="search">
47
+
48
+ <a class="full_list_link" id="class_list_link"
49
+ href="../class_list.html">
50
+
51
+ <svg width="24" height="24">
52
+ <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
53
+ <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
54
+ <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
55
+ </svg>
56
+ </a>
57
+
58
+ </div>
59
+ <div class="clear"></div>
60
+ </div>
61
+
62
+ <div id="content"><h1>Module: Usgs::DailyValues
63
+
64
+
65
+
66
+ </h1>
67
+ <div class="box_info">
68
+
69
+
70
+
71
+
72
+
73
+
74
+ <dl>
75
+ <dt>Includes:</dt>
76
+ <dd><span class='object_link'><a href="Utils.html" title="Usgs::Utils (module)">Utils</a></span></dd>
77
+ </dl>
78
+
79
+
80
+
81
+
82
+ <dl>
83
+ <dt>Included in:</dt>
84
+ <dd><span class='object_link'><a href="Client.html" title="Usgs::Client (class)">Client</a></span></dd>
85
+ </dl>
86
+
87
+
88
+
89
+ <dl>
90
+ <dt>Defined in:</dt>
91
+ <dd>lib/usgs/daily_values.rb</dd>
92
+ </dl>
93
+
94
+ </div>
95
+
96
+
97
+
98
+
99
+
100
+
101
+
102
+
103
+
104
+ <h2>
105
+ Instance Method Summary
106
+ <small><a href="#" class="summary_toggle">collapse</a></small>
107
+ </h2>
108
+
109
+ <ul class="summary">
110
+
111
+ <li class="public ">
112
+ <span class="summary_signature">
113
+
114
+ <a href="#get_dv-instance_method" title="#get_dv (instance method)">#<strong>get_dv</strong>(sites:, parameter_cd: nil, start_date: nil, end_date: nil) &#x21d2; Array&lt;Usgs::Models::Reading&gt; </a>
115
+
116
+
117
+
118
+ </span>
119
+
120
+
121
+
122
+
123
+
124
+
125
+
126
+
127
+
128
+ <span class="summary_desc"><div class='inline'>
129
+ <p>Fetch daily values (DV) from USGS NWIS.</p>
130
+ </div></span>
131
+
132
+ </li>
133
+
134
+
135
+ </ul>
136
+
137
+
138
+
139
+
140
+
141
+
142
+
143
+
144
+
145
+
146
+
147
+ <h3 class="inherited">Methods included from <span class='object_link'><a href="Utils.html" title="Usgs::Utils (module)">Utils</a></span></h3>
148
+ <p class="inherited"><span class='object_link'><a href="Utils.html#format_date-instance_method" title="Usgs::Utils#format_date (method)">#format_date</a></span>, <span class='object_link'><a href="Utils.html#format_datetime-instance_method" title="Usgs::Utils#format_datetime (method)">#format_datetime</a></span>, <span class='object_link'><a href="Utils.html#resolve_parameter_codes-instance_method" title="Usgs::Utils#resolve_parameter_codes (method)">#resolve_parameter_codes</a></span></p>
149
+
150
+
151
+ <div id="instance_method_details" class="method_details_list">
152
+ <h2>Instance Method Details</h2>
153
+
154
+
155
+ <div class="method_details first">
156
+ <h3 class="signature first" id="get_dv-instance_method">
157
+
158
+ #<strong>get_dv</strong>(sites:, parameter_cd: nil, start_date: nil, end_date: nil) &#x21d2; <tt>Array&lt;<span class='object_link'><a href="Models/Reading.html" title="Usgs::Models::Reading (class)">Usgs::Models::Reading</a></span>&gt;</tt>
159
+
160
+
161
+
162
+
163
+
164
+ </h3><div class="docstring">
165
+ <div class="discussion">
166
+
167
+ <p>Fetch daily values (DV) from USGS NWIS</p>
168
+
169
+
170
+ </div>
171
+ </div>
172
+ <div class="tags">
173
+
174
+ <div class="examples">
175
+ <h4 class="tag_title">Examples:</h4>
176
+
177
+
178
+ <h5 class="example_title"><div class='inline'>
179
+ <p>Most recent year</p>
180
+ </div></h5>
181
+
182
+ <pre class="example code"><code><span class='const'><span class='object_link'><a href="../Usgs.html" title="Usgs (module)">Usgs</a></span></span><span class='period'>.</span><span class='id identifier rubyid_client'><span class='object_link'><a href="../Usgs.html#client-class_method" title="Usgs.client (method)">client</a></span></span><span class='period'>.</span><span class='id identifier rubyid_get_dv'>get_dv</span><span class='lparen'>(</span><span class='label'>sites:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>06754000</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>parameter_cd:</span> <span class='symbol'>:discharge</span><span class='rparen'>)</span></code></pre>
183
+
184
+
185
+ <h5 class="example_title"><div class='inline'>
186
+ <p>Full POR</p>
187
+ </div></h5>
188
+
189
+ <pre class="example code"><code><span class='const'><span class='object_link'><a href="../Usgs.html" title="Usgs (module)">Usgs</a></span></span><span class='period'>.</span><span class='id identifier rubyid_client'><span class='object_link'><a href="../Usgs.html#client-class_method" title="Usgs.client (method)">client</a></span></span><span class='period'>.</span><span class='id identifier rubyid_get_dv'>get_dv</span><span class='lparen'>(</span><span class='label'>sites:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>06754000</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>parameter_cd:</span> <span class='symbol'>:discharge</span><span class='comma'>,</span> <span class='label'>start_date:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>1900-01-01</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span></code></pre>
190
+
191
+ </div>
192
+ <p class="tag_title">Parameters:</p>
193
+ <ul class="param">
194
+
195
+ <li>
196
+
197
+ <span class='name'>sites</span>
198
+
199
+
200
+ <span class='type'>(<tt>String</tt>, <tt>Array&lt;String&gt;</tt>)</span>
201
+
202
+
203
+
204
+ &mdash;
205
+ <div class='inline'>
206
+ <p>USGS site ID(s)</p>
207
+ </div>
208
+
209
+ </li>
210
+
211
+ <li>
212
+
213
+ <span class='name'>parameter_cd</span>
214
+
215
+
216
+ <span class='type'>(<tt>Symbol</tt>, <tt>String</tt>, <tt>Array</tt>)</span>
217
+
218
+
219
+ <em class="default">(defaults to: <tt>nil</tt>)</em>
220
+
221
+
222
+ &mdash;
223
+ <div class='inline'>
224
+ <p>e.g. :discharge</p>
225
+ </div>
226
+
227
+ </li>
228
+
229
+ <li>
230
+
231
+ <span class='name'>start_date</span>
232
+
233
+
234
+ <span class='type'>(<tt>Date</tt>, <tt>String</tt>, <tt>nil</tt>)</span>
235
+
236
+
237
+ <em class="default">(defaults to: <tt>nil</tt>)</em>
238
+
239
+
240
+ &mdash;
241
+ <div class='inline'>
242
+ <p>Start date — defaults to 10 years ago if omitted</p>
243
+ </div>
244
+
245
+ </li>
246
+
247
+ <li>
248
+
249
+ <span class='name'>end_date</span>
250
+
251
+
252
+ <span class='type'>(<tt>Date</tt>, <tt>String</tt>, <tt>nil</tt>)</span>
253
+
254
+
255
+ <em class="default">(defaults to: <tt>nil</tt>)</em>
256
+
257
+
258
+ &mdash;
259
+ <div class='inline'>
260
+ <p>End date — defaults to today</p>
261
+ </div>
262
+
263
+ </li>
264
+
265
+ </ul>
266
+
267
+ <p class="tag_title">Returns:</p>
268
+ <ul class="return">
269
+
270
+ <li>
271
+
272
+
273
+ <span class='type'>(<tt>Array&lt;<span class='object_link'><a href="Models/Reading.html" title="Usgs::Models::Reading (class)">Usgs::Models::Reading</a></span>&gt;</tt>)</span>
274
+
275
+
276
+
277
+ </li>
278
+
279
+ </ul>
280
+
281
+ </div><table class="source_code">
282
+ <tr>
283
+ <td>
284
+ <pre class="lines">
285
+
286
+
287
+ 22
288
+ 23
289
+ 24
290
+ 25
291
+ 26
292
+ 27
293
+ 28
294
+ 29
295
+ 30
296
+ 31
297
+ 32
298
+ 33
299
+ 34
300
+ 35
301
+ 36</pre>
302
+ </td>
303
+ <td>
304
+ <pre class="code"><span class="info file"># File 'lib/usgs/daily_values.rb', line 22</span>
305
+
306
+ <span class='kw'>def</span> <span class='id identifier rubyid_get_dv'>get_dv</span><span class='lparen'>(</span><span class='label'>sites:</span><span class='comma'>,</span> <span class='label'>parameter_cd:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>start_date:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>end_date:</span> <span class='kw'>nil</span><span class='rparen'>)</span>
307
+ <span class='id identifier rubyid_site_list'>site_list</span> <span class='op'>=</span> <span class='const'>Array</span><span class='lparen'>(</span><span class='id identifier rubyid_sites'>sites</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>,</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
308
+ <span class='id identifier rubyid_param_list'>param_list</span> <span class='op'>=</span> <span class='id identifier rubyid_resolve_parameter_codes'>resolve_parameter_codes</span><span class='lparen'>(</span><span class='id identifier rubyid_parameter_cd'>parameter_cd</span><span class='rparen'>)</span>
309
+
310
+ <span class='id identifier rubyid_query'>query</span> <span class='op'>=</span> <span class='lbrace'>{</span>
311
+ <span class='label'>format:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>json</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
312
+ <span class='label'>sites:</span> <span class='id identifier rubyid_site_list'>site_list</span><span class='comma'>,</span>
313
+ <span class='label'>parameterCd:</span> <span class='id identifier rubyid_param_list'>param_list</span><span class='comma'>,</span>
314
+ <span class='label'>startDT:</span> <span class='id identifier rubyid_format_date'>format_date</span><span class='lparen'>(</span><span class='id identifier rubyid_start_date'>start_date</span> <span class='op'>||</span> <span class='lparen'>(</span><span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_now'>now</span><span class='period'>.</span><span class='id identifier rubyid_utc'>utc</span> <span class='op'>-</span> <span class='lparen'>(</span><span class='int'>48</span> <span class='op'>*</span> <span class='int'>60</span> <span class='op'>*</span> <span class='int'>60</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='comma'>,</span>
315
+ <span class='label'>endDT:</span> <span class='id identifier rubyid_format_date'>format_date</span><span class='lparen'>(</span><span class='id identifier rubyid_end_date'>end_date</span> <span class='op'>||</span> <span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_now'>now</span><span class='period'>.</span><span class='id identifier rubyid_utc'>utc</span><span class='rparen'>)</span>
316
+ <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_compact'>compact</span>
317
+
318
+ <span class='id identifier rubyid_response'>response</span> <span class='op'>=</span> <span class='id identifier rubyid_api_get'>api_get</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/dv/</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_query'>query</span><span class='rparen'>)</span>
319
+ <span class='const'><span class='object_link'><a href="Parser.html" title="Usgs::Parser (class)">Parser</a></span></span><span class='period'>.</span><span class='id identifier rubyid_parse_time_series_values'><span class='object_link'><a href="Parser.html#parse_time_series_values-class_method" title="Usgs::Parser.parse_time_series_values (method)">parse_time_series_values</a></span></span><span class='lparen'>(</span><span class='const'>JSON</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_response'>response</span><span class='period'>.</span><span class='id identifier rubyid_body'>body</span><span class='rparen'>)</span><span class='rparen'>)</span>
320
+ <span class='kw'>end</span></pre>
321
+ </td>
322
+ </tr>
323
+ </table>
324
+ </div>
325
+
326
+ </div>
327
+
328
+ </div>
329
+
330
+ <div id="footer">
331
+ Generated on Mon Dec 15 21:52:18 2025 by
332
+ <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
333
+ 0.9.37 (ruby-3.2.2).
334
+ </div>
335
+
336
+ </div>
337
+ </body>
338
+ </html>
@@ -0,0 +1,329 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>
7
+ Module: Usgs::InstantaneousValues
8
+
9
+ &mdash; Documentation by YARD 0.9.37
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="../css/style.css" type="text/css" />
14
+
15
+ <link rel="stylesheet" href="../css/common.css" type="text/css" />
16
+
17
+ <script type="text/javascript">
18
+ pathId = "Usgs::InstantaneousValues";
19
+ relpath = '../';
20
+ </script>
21
+
22
+
23
+ <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
24
+
25
+ <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
26
+
27
+
28
+ </head>
29
+ <body>
30
+ <div class="nav_wrap">
31
+ <iframe id="nav" src="../class_list.html?1"></iframe>
32
+ <div id="resizer"></div>
33
+ </div>
34
+
35
+ <div id="main" tabindex="-1">
36
+ <div id="header">
37
+ <div id="menu">
38
+
39
+ <a href="../_index.html">Index (I)</a> &raquo;
40
+ <span class='title'><span class='object_link'><a href="../Usgs.html" title="Usgs (module)">Usgs</a></span></span>
41
+ &raquo;
42
+ <span class="title">InstantaneousValues</span>
43
+
44
+ </div>
45
+
46
+ <div id="search">
47
+
48
+ <a class="full_list_link" id="class_list_link"
49
+ href="../class_list.html">
50
+
51
+ <svg width="24" height="24">
52
+ <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
53
+ <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
54
+ <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
55
+ </svg>
56
+ </a>
57
+
58
+ </div>
59
+ <div class="clear"></div>
60
+ </div>
61
+
62
+ <div id="content"><h1>Module: Usgs::InstantaneousValues
63
+
64
+
65
+
66
+ </h1>
67
+ <div class="box_info">
68
+
69
+
70
+
71
+
72
+
73
+
74
+ <dl>
75
+ <dt>Includes:</dt>
76
+ <dd><span class='object_link'><a href="Utils.html" title="Usgs::Utils (module)">Utils</a></span></dd>
77
+ </dl>
78
+
79
+
80
+
81
+
82
+ <dl>
83
+ <dt>Included in:</dt>
84
+ <dd><span class='object_link'><a href="Client.html" title="Usgs::Client (class)">Client</a></span></dd>
85
+ </dl>
86
+
87
+
88
+
89
+ <dl>
90
+ <dt>Defined in:</dt>
91
+ <dd>lib/usgs/instantaneous_values.rb</dd>
92
+ </dl>
93
+
94
+ </div>
95
+
96
+
97
+
98
+
99
+
100
+
101
+
102
+
103
+
104
+ <h2>
105
+ Instance Method Summary
106
+ <small><a href="#" class="summary_toggle">collapse</a></small>
107
+ </h2>
108
+
109
+ <ul class="summary">
110
+
111
+ <li class="public ">
112
+ <span class="summary_signature">
113
+
114
+ <a href="#get_iv-instance_method" title="#get_iv (instance method)">#<strong>get_iv</strong>(sites:, parameter_cd: nil, start_date: nil, end_date: nil) &#x21d2; Array&lt;Usgs::Models::Reading&gt; </a>
115
+
116
+
117
+
118
+ </span>
119
+
120
+
121
+
122
+
123
+
124
+
125
+
126
+
127
+
128
+ <span class="summary_desc"><div class='inline'>
129
+ <p>Fetch instantaneous values (IV) from USGS NWIS.</p>
130
+ </div></span>
131
+
132
+ </li>
133
+
134
+
135
+ </ul>
136
+
137
+
138
+
139
+
140
+
141
+
142
+
143
+
144
+
145
+
146
+
147
+ <h3 class="inherited">Methods included from <span class='object_link'><a href="Utils.html" title="Usgs::Utils (module)">Utils</a></span></h3>
148
+ <p class="inherited"><span class='object_link'><a href="Utils.html#format_date-instance_method" title="Usgs::Utils#format_date (method)">#format_date</a></span>, <span class='object_link'><a href="Utils.html#format_datetime-instance_method" title="Usgs::Utils#format_datetime (method)">#format_datetime</a></span>, <span class='object_link'><a href="Utils.html#resolve_parameter_codes-instance_method" title="Usgs::Utils#resolve_parameter_codes (method)">#resolve_parameter_codes</a></span></p>
149
+
150
+
151
+ <div id="instance_method_details" class="method_details_list">
152
+ <h2>Instance Method Details</h2>
153
+
154
+
155
+ <div class="method_details first">
156
+ <h3 class="signature first" id="get_iv-instance_method">
157
+
158
+ #<strong>get_iv</strong>(sites:, parameter_cd: nil, start_date: nil, end_date: nil) &#x21d2; <tt>Array&lt;<span class='object_link'><a href="Models/Reading.html" title="Usgs::Models::Reading (class)">Usgs::Models::Reading</a></span>&gt;</tt>
159
+
160
+
161
+
162
+
163
+
164
+ </h3><div class="docstring">
165
+ <div class="discussion">
166
+
167
+ <p>Fetch instantaneous values (IV) from USGS NWIS</p>
168
+
169
+
170
+ </div>
171
+ </div>
172
+ <div class="tags">
173
+
174
+ <div class="examples">
175
+ <h4 class="tag_title">Examples:</h4>
176
+
177
+
178
+ <pre class="example code"><code><span class='const'><span class='object_link'><a href="../Usgs.html" title="Usgs (module)">Usgs</a></span></span><span class='period'>.</span><span class='id identifier rubyid_client'><span class='object_link'><a href="../Usgs.html#client-class_method" title="Usgs.client (method)">client</a></span></span><span class='period'>.</span><span class='id identifier rubyid_get_iv'>get_iv</span><span class='lparen'>(</span><span class='label'>sites:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>06754000</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>parameter_cd:</span> <span class='symbol'>:discharge</span><span class='comma'>,</span> <span class='label'>start_date:</span> <span class='int'>1</span><span class='period'>.</span><span class='id identifier rubyid_day'>day</span><span class='period'>.</span><span class='id identifier rubyid_ago'>ago</span><span class='rparen'>)</span></code></pre>
179
+
180
+ </div>
181
+ <p class="tag_title">Parameters:</p>
182
+ <ul class="param">
183
+
184
+ <li>
185
+
186
+ <span class='name'>sites</span>
187
+
188
+
189
+ <span class='type'>(<tt>String</tt>, <tt>Array&lt;String&gt;</tt>)</span>
190
+
191
+
192
+
193
+ &mdash;
194
+ <div class='inline'>
195
+ <p>One or more USGS site IDs</p>
196
+ </div>
197
+
198
+ </li>
199
+
200
+ <li>
201
+
202
+ <span class='name'>parameter_cd</span>
203
+
204
+
205
+ <span class='type'>(<tt>Symbol</tt>, <tt>String</tt>, <tt>Array</tt>)</span>
206
+
207
+
208
+ <em class="default">(defaults to: <tt>nil</tt>)</em>
209
+
210
+
211
+ &mdash;
212
+ <div class='inline'>
213
+ <p>e.g. :discharge, “00060”, or [:discharge, :gage_height]</p>
214
+ </div>
215
+
216
+ </li>
217
+
218
+ <li>
219
+
220
+ <span class='name'>start_date</span>
221
+
222
+
223
+ <span class='type'>(<tt>DateTime</tt>, <tt>Date</tt>, <tt>Time</tt>, <tt>String</tt>, <tt>nil</tt>)</span>
224
+
225
+
226
+ <em class="default">(defaults to: <tt>nil</tt>)</em>
227
+
228
+
229
+ &mdash;
230
+ <div class='inline'>
231
+ <p>Start time</p>
232
+ </div>
233
+
234
+ </li>
235
+
236
+ <li>
237
+
238
+ <span class='name'>end_date</span>
239
+
240
+
241
+ <span class='type'>(<tt>DateTime</tt>, <tt>Date</tt>, <tt>Time</tt>, <tt>String</tt>, <tt>nil</tt>)</span>
242
+
243
+
244
+ <em class="default">(defaults to: <tt>nil</tt>)</em>
245
+
246
+
247
+ &mdash;
248
+ <div class='inline'>
249
+ <p>End time (default: now)</p>
250
+ </div>
251
+
252
+ </li>
253
+
254
+ </ul>
255
+
256
+ <p class="tag_title">Returns:</p>
257
+ <ul class="return">
258
+
259
+ <li>
260
+
261
+
262
+ <span class='type'>(<tt>Array&lt;<span class='object_link'><a href="Models/Reading.html" title="Usgs::Models::Reading (class)">Usgs::Models::Reading</a></span>&gt;</tt>)</span>
263
+
264
+
265
+
266
+ </li>
267
+
268
+ </ul>
269
+
270
+ </div><table class="source_code">
271
+ <tr>
272
+ <td>
273
+ <pre class="lines">
274
+
275
+
276
+ 18
277
+ 19
278
+ 20
279
+ 21
280
+ 22
281
+ 23
282
+ 24
283
+ 25
284
+ 26
285
+ 27
286
+ 28
287
+ 29
288
+ 30
289
+ 31
290
+ 32
291
+ 33</pre>
292
+ </td>
293
+ <td>
294
+ <pre class="code"><span class="info file"># File 'lib/usgs/instantaneous_values.rb', line 18</span>
295
+
296
+ <span class='kw'>def</span> <span class='id identifier rubyid_get_iv'>get_iv</span><span class='lparen'>(</span><span class='label'>sites:</span><span class='comma'>,</span> <span class='label'>parameter_cd:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>start_date:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>end_date:</span> <span class='kw'>nil</span><span class='rparen'>)</span>
297
+ <span class='id identifier rubyid_site_list'>site_list</span> <span class='op'>=</span> <span class='const'>Array</span><span class='lparen'>(</span><span class='id identifier rubyid_sites'>sites</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>,</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
298
+ <span class='id identifier rubyid_param_list'>param_list</span> <span class='op'>=</span> <span class='id identifier rubyid_resolve_parameter_codes'>resolve_parameter_codes</span><span class='lparen'>(</span><span class='id identifier rubyid_parameter_cd'>parameter_cd</span><span class='rparen'>)</span>
299
+
300
+ <span class='id identifier rubyid_query'>query</span> <span class='op'>=</span> <span class='lbrace'>{</span>
301
+ <span class='label'>format:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>json</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
302
+ <span class='label'>sites:</span> <span class='id identifier rubyid_site_list'>site_list</span><span class='comma'>,</span>
303
+ <span class='label'>parameterCd:</span> <span class='id identifier rubyid_param_list'>param_list</span><span class='comma'>,</span>
304
+ <span class='comment'># Default to the the last 24hrs if not filled out
305
+ </span> <span class='label'>startDT:</span> <span class='id identifier rubyid_format_datetime'>format_datetime</span><span class='lparen'>(</span><span class='id identifier rubyid_start_date'>start_date</span> <span class='op'>||</span> <span class='lparen'>(</span><span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_now'>now</span><span class='period'>.</span><span class='id identifier rubyid_utc'>utc</span> <span class='op'>-</span> <span class='lparen'>(</span><span class='int'>24</span> <span class='op'>*</span> <span class='int'>60</span> <span class='op'>*</span> <span class='int'>60</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='comma'>,</span>
306
+ <span class='label'>endDT:</span> <span class='id identifier rubyid_format_datetime'>format_datetime</span><span class='lparen'>(</span><span class='id identifier rubyid_end_date'>end_date</span> <span class='op'>||</span> <span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_now'>now</span><span class='period'>.</span><span class='id identifier rubyid_utc'>utc</span><span class='rparen'>)</span>
307
+ <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_compact'>compact</span>
308
+
309
+ <span class='id identifier rubyid_response'>response</span> <span class='op'>=</span> <span class='id identifier rubyid_api_get'>api_get</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/iv/</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_query'>query</span><span class='rparen'>)</span>
310
+ <span class='const'><span class='object_link'><a href="Parser.html" title="Usgs::Parser (class)">Parser</a></span></span><span class='period'>.</span><span class='id identifier rubyid_parse_time_series_values'><span class='object_link'><a href="Parser.html#parse_time_series_values-class_method" title="Usgs::Parser.parse_time_series_values (method)">parse_time_series_values</a></span></span><span class='lparen'>(</span><span class='const'>JSON</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_response'>response</span><span class='period'>.</span><span class='id identifier rubyid_body'>body</span><span class='rparen'>)</span><span class='rparen'>)</span>
311
+ <span class='kw'>end</span></pre>
312
+ </td>
313
+ </tr>
314
+ </table>
315
+ </div>
316
+
317
+ </div>
318
+
319
+ </div>
320
+
321
+ <div id="footer">
322
+ Generated on Mon Dec 15 21:52:18 2025 by
323
+ <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
324
+ 0.9.37 (ruby-3.2.2).
325
+ </div>
326
+
327
+ </div>
328
+ </body>
329
+ </html>