epa 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.autotest +1 -0
- data/.gemtest +0 -0
- data/.gitignore +41 -0
- data/.rspec +3 -0
- data/.yardopts +3 -0
- data/Gemfile +3 -0
- data/LICENSE.md +10 -0
- data/README.md +70 -0
- data/Rakefile +18 -0
- data/epa.gemspec +31 -0
- data/lib/epa.rb +18 -0
- data/lib/epa/client.rb +14 -0
- data/lib/epa/client/connection.rb +19 -0
- data/lib/epa/client/pcs.rb +647 -0
- data/lib/epa/client/rad_info.rb +384 -0
- data/lib/epa/client/request.rb +18 -0
- data/lib/epa/version.rb +3 -0
- data/spec/epa/client/connection.rb +0 -0
- data/spec/epa/client/pcs_spec.rb +282 -0
- data/spec/epa/client/rad_info_spec.rb +87 -0
- data/spec/epa/client/request_spec.rb +0 -0
- data/spec/epa/client_spec.rb +0 -0
- data/spec/epa_spec.rb +10 -0
- data/spec/fixtures/admin_penalty_order.xml +18 -0
- data/spec/fixtures/facility.xml +56 -0
- data/spec/fixtures/facility_type.xml +74 -0
- data/spec/fixtures/pcs_cmpl_schd_viol.xml +95 -0
- data/spec/fixtures/pcs_cmpl_sched.xml +609 -0
- data/spec/fixtures/pcs_code_desc.xml +10 -0
- data/spec/fixtures/pcs_dmr_measurement.xml +10144 -0
- data/spec/fixtures/pcs_effl_lim.xml +2503 -0
- data/spec/fixtures/pcs_effl_lim_concentr.xml +2839 -0
- data/spec/fixtures/pcs_effl_lim_qty.xml +1245 -0
- data/spec/fixtures/pcs_enfor_action.xml +160 -0
- data/spec/fixtures/pcs_evidentiary_hearing_event.xml +16 -0
- data/spec/fixtures/pcs_industrial_user_info.xml +173 -0
- data/spec/fixtures/pcs_inspect.xml +11 -0
- data/spec/fixtures/pcs_pci_audit.xml +54 -0
- data/spec/fixtures/pcs_permit_event.xml +22 -0
- data/spec/fixtures/pcs_permit_facility.xml +66 -0
- data/spec/fixtures/pcs_pipe_sched.xml +290 -0
- data/spec/fixtures/pcs_pipe_sched_lat_long.xml +526 -0
- data/spec/fixtures/pcs_pretreatment_perf_summary.xml +224 -0
- data/spec/fixtures/pcs_single_event_viol.xml +84 -0
- data/spec/fixtures/pcs_sludge.xml +144 -0
- data/spec/fixtures/rad_geo.xml +28 -0
- data/spec/fixtures/rad_reg_prog.xml +108 -0
- data/spec/fixtures/rad_regulation.xml +20 -0
- data/spec/helper.rb +48 -0
- metadata +257 -0
@@ -0,0 +1,384 @@
|
|
1
|
+
module EPA
|
2
|
+
class Client
|
3
|
+
class RadInfo
|
4
|
+
@@lookup_table = {
|
5
|
+
'facility'=> {
|
6
|
+
'CITY_NAME'=>
|
7
|
+
('The name of the city, town, or village where a facility is located.'),
|
8
|
+
'CONGRESSIONAL_DIST_NUM'=>
|
9
|
+
('The number that represents a Congressional District
|
10
|
+
for a state within the United States.'),
|
11
|
+
'COUNTRY_NAME'=>
|
12
|
+
('The name that represents a primary geopolitical
|
13
|
+
unit of the world. The default value for RADInfo is
|
14
|
+
"United States".'),
|
15
|
+
'COUNTY_NAME'=>
|
16
|
+
('The name of U.S. county or county equivalent, as
|
17
|
+
listed in FIPS Pub 6-4.'),
|
18
|
+
'EF_PGM_SOURCE'=>
|
19
|
+
('The abbreviated name of an information management
|
20
|
+
system contained in Envirofacts that may serve as a source
|
21
|
+
for RADInfo data.'),
|
22
|
+
'EPA_REGION_CODE'=>
|
23
|
+
'The code that represents an EPA Region.',
|
24
|
+
'FACILITY_REGISTRY_ID'=>
|
25
|
+
('The identification number assigned by the EPA
|
26
|
+
Facility Registry System to uniquely identify a facility site.'),
|
27
|
+
'FED_FACILITY_CODE'=>
|
28
|
+
('A code identifying whether or not a site is
|
29
|
+
a Federal (U.S. Government) facility. Valid
|
30
|
+
Values=> "D" = Status Undetermined, "Y" = Federal
|
31
|
+
Facility, "N" = Not a Federal Facility.'),
|
32
|
+
'FRS_UPDATE_DATE'=>
|
33
|
+
('The date when RADInfo facility data is updated
|
34
|
+
using the Facility Registry System.'),
|
35
|
+
'HUC_CODE'=>
|
36
|
+
('The hydrologic unit code (HUC) that represents a
|
37
|
+
geographic area representing part or all of a surface-draining
|
38
|
+
basin, a combination of drainage basins, or a distinct hydrologic
|
39
|
+
feature.'),
|
40
|
+
'LOCATION_ADDRESS'=>
|
41
|
+
('The address that describes the physical (geographic)
|
42
|
+
location of the front door or main entrance of a facility
|
43
|
+
site, including urban-style street address or rural address.'),
|
44
|
+
'POSTAL_CODE'=>
|
45
|
+
('The combination of the 5-digit Zone Improvement Plan (ZIP)
|
46
|
+
code and the four-digit extension code (if available) that
|
47
|
+
represents the geographic segment that is a subunit of the
|
48
|
+
ZIP Code, assigned by the U.S. Postal Service to a geographic
|
49
|
+
location to facilitate delivery, or the postal zone specific
|
50
|
+
to the country, other than the U.S., where the mail is delivered.'),
|
51
|
+
'PRIMARY_NAME'=>
|
52
|
+
'The name of a facility site.',
|
53
|
+
'RAD_CHANGE_DATE'=>
|
54
|
+
('The date when RADInfo facility data was altered by a
|
55
|
+
designated RADInfo user.'),
|
56
|
+
'RAD_SYS_ID'=>
|
57
|
+
('The non-intelligent, unique identifier assigned to a RADInfo
|
58
|
+
facility or site.'),
|
59
|
+
'SOURCE_DATA'=>
|
60
|
+
('The initial source of RADInfo information for a facility.
|
61
|
+
Reconciliation with the Facility Registry System may
|
62
|
+
subsequently alter some source data.'),
|
63
|
+
'STATE_CODE'=>
|
64
|
+
('The U.S. Postal Service abbreviation that represents the
|
65
|
+
state of state equivalent for the U.S. and Canada.'),
|
66
|
+
'STATE_NAME'=>
|
67
|
+
('The name of the principal administrative subdivision of the
|
68
|
+
United States.'),
|
69
|
+
'SUPPLEMENTAL_LOCATION'=>
|
70
|
+
('The text that provides additional information about a place,
|
71
|
+
including a building name with its secondary unit and number,
|
72
|
+
an industrial park name, an installation name, or descriptive
|
73
|
+
text where no formal address is available.'),
|
74
|
+
'TRIBAL_LAND_CODE'=>
|
75
|
+
('Code indicating whether or not the facility is located on
|
76
|
+
tribal land. Valid values=> "Y" = yes; "N" = no.'),
|
77
|
+
'TRIBAL_LAND_NAME'=>
|
78
|
+
('The name of an American Indian or Alaskan native area where
|
79
|
+
the facility is located, as identified through query
|
80
|
+
mechanisms available to the Envirofacts network.'),
|
81
|
+
'URL'=>
|
82
|
+
('The URL associated with the web which provides risk data
|
83
|
+
about the associated radioisotope.'),
|
84
|
+
'URL_LINK_DESCRIPTION'=>
|
85
|
+
('A web site description identifying the type of information
|
86
|
+
provided at the URL.'),
|
87
|
+
},
|
88
|
+
'facility_type'=> {
|
89
|
+
'CIT_REF_CODE'=>
|
90
|
+
('The code that represents the environmental regulation with
|
91
|
+
oversight of a facility. For example, the CIT_REF_CODE for a
|
92
|
+
RAD NPL facility would be equal to "40CFR300".'),
|
93
|
+
'FACILITY_TYPE'=>
|
94
|
+
('The type of facility regulated by the governing regulation.
|
95
|
+
Valid Values include=>
|
96
|
+
NESHAPS/Underground Uranium Mine,
|
97
|
+
NESHAPS/DOE RAD Facility (Non-Radon),
|
98
|
+
NESHAPS/Other Federal Facility,
|
99
|
+
NESHAPS/Elemental Phosphorus Plant,
|
100
|
+
NESHAPS/DOE Radon,
|
101
|
+
NESHAPS/Phosphogypsum Stack,
|
102
|
+
NESHAPS/Disposal of Uranium Mill Tailings,
|
103
|
+
NESHAPS/Operating Uranium Mill Tailings,
|
104
|
+
WIPP Facility/Repository,
|
105
|
+
WIPP Facility/Generator Site,
|
106
|
+
RAD NPL Facility'),
|
107
|
+
'SEC_CIT_REF_FLAG'=>
|
108
|
+
('Indicates than an additional Citation Reference Code must
|
109
|
+
be used to uniquely identify this this type of facility. For
|
110
|
+
example, the WIPP repository is uniquely identified as being
|
111
|
+
regulated under both 40CFR191 and 40CFR194. This flag is set to
|
112
|
+
"Y" when a facility has this exact combination of
|
113
|
+
CIT_REF_CODE(s) associated with it. In the near term, no other
|
114
|
+
combination of governing regulations will cause this flag to be
|
115
|
+
set.'),
|
116
|
+
'SUBPART_ID'=>
|
117
|
+
('Identification number assigned to the subpart of the
|
118
|
+
environmental regulation with oversight of the facility.'),
|
119
|
+
},
|
120
|
+
'geo'=> {
|
121
|
+
'COORDINATE_DATA_SOURCE_CODE'=>
|
122
|
+
('The code that represents the party responsible for providing
|
123
|
+
the latitude and longitude coordinates.'),
|
124
|
+
'DATA_COLLECTION_DATE'=>
|
125
|
+
'The calendar date when data were collected.',
|
126
|
+
'EF_PGM_SOURCE'=>
|
127
|
+
('The abbreviated name of an information management system
|
128
|
+
contained in Envirofacts that may serve as a source for
|
129
|
+
RADInfo data.'),
|
130
|
+
'GEOMETRIC_TYPE_CODE'=>
|
131
|
+
('The code that represents the geometric entity represented by
|
132
|
+
one point or a sequence of latitude and longitude points.'),
|
133
|
+
'HORIZONTAL_ACCURACY_MEASURE'=>
|
134
|
+
('The measure of the accuracy (in meters) of the latitude and
|
135
|
+
longitude coordinates.'),
|
136
|
+
'HORIZONTAL_COLLECT_METHOD_CODE'=>
|
137
|
+
('The code that represents the method used to determine the
|
138
|
+
latitude and longitude coordinates for a point on the earth.'),
|
139
|
+
'HORIZONTAL_REFER_DATUM_CODE'=>
|
140
|
+
('The code that represents the reference datum used in
|
141
|
+
determining latitude and longitude coordinates.'),
|
142
|
+
'LATITUDE_MEASURE'=>
|
143
|
+
('The measure of the angular distance on a meridian north or
|
144
|
+
south of the equator.'),
|
145
|
+
'LOCATION_COMMENTS_TEXT'=>
|
146
|
+
('The text that provides additional information about the
|
147
|
+
geographic coordinates.'),
|
148
|
+
'LONGITUDE_MEASURE'=>
|
149
|
+
('The measure of the angular distance on a meridian east or
|
150
|
+
west of the prime meridian.'),
|
151
|
+
'RAD_CHANGE_DATE'=>
|
152
|
+
('The date when RADInfo facility data was altered by a
|
153
|
+
designated RADInfo user.'),
|
154
|
+
'RAD_OVERRIDE'=>
|
155
|
+
('A flag indicating that the latitude and longitude coordinates
|
156
|
+
for the facility in RADInfo are preferred to the designated
|
157
|
+
best value coordinates in the Envirofacts Locational Reference
|
158
|
+
Tables.'),
|
159
|
+
'RAD_SYS_ID'=>
|
160
|
+
('The non-intelligent, unique identifier assigned to a RADInfo
|
161
|
+
facility or site.'),
|
162
|
+
'REFERENCE_POINT_CODE'=>
|
163
|
+
('The code that represents the place for which geographic
|
164
|
+
coordinates were established.'),
|
165
|
+
'SOURCE_MAP_SCALE_NUMBER'=>
|
166
|
+
('The number that represents the proportional distance on the
|
167
|
+
ground for one unit of measure on the map or photo.'),
|
168
|
+
'SUB_ID'=>
|
169
|
+
'Identification number for the operable unit.',
|
170
|
+
'SUB_TYPE_CODE'=>
|
171
|
+
'The code for an operable unit. View a list of permitted values.',
|
172
|
+
'VERTICAL_ACCURACY_MEASURE'=>
|
173
|
+
('The measure of the accuracy (in meters) of the vertical
|
174
|
+
measure (i.e., the altitude) of a reference point.'),
|
175
|
+
'VERTICAL_COLLECT_METHOD_CASE'=>
|
176
|
+
('The code that represents the method used to collect the
|
177
|
+
vertical measure (i.e., the altitude) of a reference point.'),
|
178
|
+
'VERTICAL_MEASURE'=>
|
179
|
+
('The measure of elevation (i.e., the altitude), in meters,
|
180
|
+
above or below a reference datum.'),
|
181
|
+
'VERTICAL_REFERENCE_DATA_CODE'=>
|
182
|
+
('The code that represents the reference datum used to
|
183
|
+
determine the vertical measure (i.e., the altitude).'),
|
184
|
+
},
|
185
|
+
'regulation'=> {
|
186
|
+
'CFR_PART'=>
|
187
|
+
('The Part (name/title) of the regulation related
|
188
|
+
to the facility.'),
|
189
|
+
'CRF_SECTION'=>
|
190
|
+
('The Section (name/title) of the regulation related to
|
191
|
+
the facility.'),
|
192
|
+
'CFR_SUBPART'=>
|
193
|
+
('Subpart related to the specific part of the CFR
|
194
|
+
(e.g. Subpart D).'),
|
195
|
+
'CIT_REF_CODE'=>
|
196
|
+
('The code that represents the environmental regulation with
|
197
|
+
oversight of a facility. For example, the CIT_REF_CODE for a
|
198
|
+
RAD NPL facility would be equal to "40CFR300".'),
|
199
|
+
'PART_ID'=>
|
200
|
+
('The part number of the specific Code of Federal regulation
|
201
|
+
(e.g. Part 60).'),
|
202
|
+
'RAD_CHANGE_DATE'=>
|
203
|
+
('The date when RADInfo facility data was altered by a
|
204
|
+
designated RADInfo user.'),
|
205
|
+
'REG_TITLE'=>
|
206
|
+
'The title (name) of the regulation related to the facility.',
|
207
|
+
'SECTION_ID'=>
|
208
|
+
('The section number of the specific Code of Federal regulation
|
209
|
+
(e.g. Part 60.489).'),
|
210
|
+
'STATUTE'=>
|
211
|
+
('The name of the Federal statute governing the regulations
|
212
|
+
related to the facility.'),
|
213
|
+
'STAT_ACRONYM'=>
|
214
|
+
('The acronym of the Federal statute governing the regulations
|
215
|
+
related to the facility.'),
|
216
|
+
'SUBPART_ID'=>
|
217
|
+
('Identification number assigned to the subpart of the
|
218
|
+
environmental regulation with oversight of the facility.'),
|
219
|
+
'TITLE_ID'=>
|
220
|
+
('The Code of Federal Regulation number related to the
|
221
|
+
regulation (e.g. 40 CFR).'),
|
222
|
+
'URL'=>
|
223
|
+
('The URL associated with the web which provides risk data
|
224
|
+
about the associated radioisotope.'),
|
225
|
+
},
|
226
|
+
'regulatory_program'=> {
|
227
|
+
'CIT_REF_CODE'=>
|
228
|
+
('The code that represents the environmental regulation with
|
229
|
+
oversight of a facility. For example, the CIT_REF_CODE for
|
230
|
+
a RAD NPL facility would be equal to "40CFR300".'),
|
231
|
+
'ENFORCEMENT_AGENCY'=>
|
232
|
+
('The Agency (or Agreement State) responsible for the
|
233
|
+
implementation and enforcement of the radiation standard(s)
|
234
|
+
established. In the case of 40 CFR 190, the NRC or one of the
|
235
|
+
29 Agreement States is identified as the Enforcement Agency
|
236
|
+
under this definition.'),
|
237
|
+
'OPERATING_ORGANIZATION'=>
|
238
|
+
('The facility owner/operator who conducts the daily operations
|
239
|
+
and submits compliance reports to the Enforcement Agency.'),
|
240
|
+
'OVERSIGHT_AGENCY'=>
|
241
|
+
('The Agency responsible for establishing generally applicable
|
242
|
+
radiation standards. In the case of 40 CFR 190, EPA is
|
243
|
+
identified as the Oversight Agency under this definition.'),
|
244
|
+
'PROG_FAC_STATUS'=>
|
245
|
+
('The status of a facility in relation to the program monitoring
|
246
|
+
it. An active facility status means that the facility is
|
247
|
+
currently operational or activities such as remediation are
|
248
|
+
ongoing at the site/facility. An inactive facility status means
|
249
|
+
the facility is no longer operational. A standby status
|
250
|
+
indicates that the facility (i.e., uranium mine) is not
|
251
|
+
currently operating, but has not committed to closing down its
|
252
|
+
operation. An archived facility status means remediation has
|
253
|
+
been completed; such facilities are no longer of regulatory
|
254
|
+
concern and the information associated with them can be placed
|
255
|
+
in an archive database.'),
|
256
|
+
'PROG_FAC_TYPE'=>
|
257
|
+
('Code indicating the type of facility or complex facility that
|
258
|
+
is regulated or monitored by a program. Only those facilities
|
259
|
+
typecast as RAD NESHAPS Facilities and reporting under 40CFR61
|
260
|
+
are contained in the RAD_NESHAPS_FACILITY table. Similarly,
|
261
|
+
only those facilities typecast as WIPP Facilites and governed
|
262
|
+
under 40CFR194, or the combination of 40CFR191 and 40CFR194,
|
263
|
+
are contained in the RAD_WIPP_FACILITY table, and only those
|
264
|
+
facilities that must comply with 40CFR300 and typecast as RAD
|
265
|
+
NPL F acilities are contained in the RAD_NPL_FACILITY table.'),
|
266
|
+
'RAD_CHANGE_DATE'=>
|
267
|
+
('The date when RADInfo facility data was altered by a
|
268
|
+
designated RADInfo user.'),
|
269
|
+
'RAD_SYS_ID'=>
|
270
|
+
('The non-intelligent, unique identifier assigned to a RADInfo
|
271
|
+
facility or site.'),
|
272
|
+
'SEC_CIT_REF_FLAG'=>
|
273
|
+
('Indicates than an additional Citation Reference Code must
|
274
|
+
be used to uniquely identify this this type of facility. For
|
275
|
+
example, the WIPP repository is uniquely identified as being
|
276
|
+
regulated under both 40CFR191 and 40CFR194. This flag is set to
|
277
|
+
"Y" when a facility has this exact combination of
|
278
|
+
CIT_REF_CODE(s) associated with it. In the near term, no other
|
279
|
+
combination of governing regulations will cause this flag to be
|
280
|
+
set.'),
|
281
|
+
'SUBPART_ID'=>
|
282
|
+
('Identification number assigned to the subpart of the
|
283
|
+
environmental regulation with oversight of the facility.'),
|
284
|
+
},
|
285
|
+
}
|
286
|
+
|
287
|
+
# Returns a list of valid tables or columns in a given table
|
288
|
+
# @param database [String] optional table to lookup
|
289
|
+
# @return {Array}
|
290
|
+
# @example
|
291
|
+
# catalog()
|
292
|
+
|
293
|
+
def catalog(database=nil)
|
294
|
+
if database.nil?
|
295
|
+
return @@lookup_table.keys
|
296
|
+
else
|
297
|
+
return @@lookup_table[database].keys
|
298
|
+
end
|
299
|
+
|
300
|
+
end
|
301
|
+
|
302
|
+
# Used to lookup data in the facility table
|
303
|
+
# @param params [Hash] The parameters for the lookup
|
304
|
+
# @param options [Hash] A customizable set of options.
|
305
|
+
# @return {Hash}
|
306
|
+
# @see http://iaspub.epa.gov/enviro/ef_metadata_html.ef_metadata_table?p_table_name=rad_facility&p_topic=radinfo
|
307
|
+
# @example
|
308
|
+
# facility({:column => 'CITY_NAME', :value => 'PASADENA'})
|
309
|
+
|
310
|
+
def facility(params={}, options={})
|
311
|
+
if !params.has_key?(:column)
|
312
|
+
catalog("facility")
|
313
|
+
else
|
314
|
+
EPA.get("rad_facility/#{params[:column]}/#{params[:value]}", options)
|
315
|
+
end
|
316
|
+
end
|
317
|
+
|
318
|
+
# Used to lookup data in the facility type table
|
319
|
+
# @param params [Hash] The parameters for the lookup
|
320
|
+
# @param options [Hash] A customizable set of options.
|
321
|
+
# @return {Hash}
|
322
|
+
# @see http://iaspub.epa.gov/enviro/ef_metadata_html.ef_metadata_table?p_table_name=rad_facility_type&p_topic=radinfo
|
323
|
+
# @example
|
324
|
+
# facility_type(:column => 'SEC_CIT_REF_FLAG', :value => 'N')
|
325
|
+
|
326
|
+
def facility_type(params={}, options={})
|
327
|
+
if !params.has_key?(:column)
|
328
|
+
catalog("facility_type")
|
329
|
+
else
|
330
|
+
EPA.get("rad_facility_type/#{params[:column]}/#{params[:value]}", options)
|
331
|
+
end
|
332
|
+
end
|
333
|
+
|
334
|
+
# Used to lookup data in the geo location table
|
335
|
+
# @param params [Hash] The parameters for the lookup
|
336
|
+
# @param options [Hash] A customizable set of options.
|
337
|
+
# @return {Hash}
|
338
|
+
# @see http://iaspub.epa.gov/enviro/ef_metadata_html.ef_metadata_table?p_table_name=rad_geo_location&p_topic=radinfo
|
339
|
+
# @example
|
340
|
+
# geo(:column => 'RAD_SYS_ID', :value => 'RAD200000137')
|
341
|
+
|
342
|
+
def geo(params={}, options={})
|
343
|
+
if !params.has_key?(:column)
|
344
|
+
catalog("geo")
|
345
|
+
else
|
346
|
+
EPA.get("rad_geo_location/#{params[:column]}/#{params[:value]}", options)
|
347
|
+
end
|
348
|
+
end
|
349
|
+
|
350
|
+
# Used to lookup data in the regulation table
|
351
|
+
# @param params [Hash] The parameters for the lookup
|
352
|
+
# @param options [Hash] A customizable set of options.
|
353
|
+
# @return {Hash}
|
354
|
+
# @see http://iaspub.epa.gov/enviro/ef_metadata_html.ef_metadata_table?p_table_name=rad_regulation&p_topic=radinfo
|
355
|
+
# @example
|
356
|
+
# regulation(:column => 'SUBPART_ID', :value => 'B')
|
357
|
+
|
358
|
+
def regulation(params={}, options={})
|
359
|
+
if !params.has_key?(:column)
|
360
|
+
catalog("regulation")
|
361
|
+
else
|
362
|
+
EPA.get("rad_regulation/#{params[:column]}/#{params[:value]}", options)
|
363
|
+
end
|
364
|
+
end
|
365
|
+
|
366
|
+
# Used to lookup data in the regulatory program table
|
367
|
+
# @param params [Hash] The parameters for the lookup
|
368
|
+
# @param options [Hash] A customizable set of options.
|
369
|
+
# @return {Hash}
|
370
|
+
# @see http://iaspub.epa.gov/enviro/ef_metadata_html.ef_metadata_table?p_table_name=rad_regulatory_prog&p_topic=radinfo
|
371
|
+
# @example
|
372
|
+
# regulatory_program(:column => 'SUBPART_ID', :value => 'B')
|
373
|
+
|
374
|
+
def regulatory_program(params={}, options={})
|
375
|
+
if !params.has_key?(:column)
|
376
|
+
catalog("regulatory_program")
|
377
|
+
else
|
378
|
+
EPA.get("rad_regulatory_prog/#{params[:column]}/#{params[:value]}", options)
|
379
|
+
end
|
380
|
+
end
|
381
|
+
|
382
|
+
end
|
383
|
+
end
|
384
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module EPA
|
2
|
+
class Client
|
3
|
+
module Request
|
4
|
+
def get(path, options={})
|
5
|
+
request(:get, path, options)
|
6
|
+
end
|
7
|
+
|
8
|
+
private
|
9
|
+
|
10
|
+
def request(method, path, options)
|
11
|
+
response = connection.send(method) do |request|
|
12
|
+
request.url(path, options)
|
13
|
+
end
|
14
|
+
response.body
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/lib/epa/version.rb
ADDED
File without changes
|
@@ -0,0 +1,282 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
describe EPA::Client::Pcs do
|
4
|
+
|
5
|
+
before do
|
6
|
+
@client = EPA::Client::Pcs.new
|
7
|
+
end
|
8
|
+
|
9
|
+
describe ".catalog" do
|
10
|
+
|
11
|
+
it "should return the correct list of databases when empty" do
|
12
|
+
test = @client.catalog()
|
13
|
+
test[0].should == "ADMIN_PENALTY_ORDER"
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should return the columns for a given database" do
|
17
|
+
test = @client.catalog("ADMIN_PENALTY_ORDER")
|
18
|
+
test[0].should == 'JUDICIAL_APPEAL_FILED_DATE'
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
describe ".admin_penalty_order" do
|
23
|
+
before do
|
24
|
+
stub_get("PCS_ADMIN_PENALTY_ORDER/NPDES/AKG520535").
|
25
|
+
to_return(:status => 200, :body => fixture("admin_penalty_order.xml"))
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should return the columns for a given database" do
|
29
|
+
test = @client.admin_penalty_order(:column => "NPDES", :value => "AKG520535")
|
30
|
+
a_get("PCS_ADMIN_PENALTY_ORDER/NPDES/AKG520535").should have_been_made
|
31
|
+
test.pcs_admin_penalty_order_list.pcs_admin_penalty_order.npdes.should == 'AKG520535'
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
describe ".permit_event" do
|
36
|
+
before do
|
37
|
+
stub_get("pcs_permit_event/NPDES/AKG520535").
|
38
|
+
to_return(:status => 200, :body => fixture("pcs_permit_event.xml"))
|
39
|
+
end
|
40
|
+
|
41
|
+
it "should return the columns for a given database" do
|
42
|
+
test = @client.permit_event(:column => "NPDES", :value => "AKG520535")
|
43
|
+
a_get("pcs_permit_event/NPDES/AKG520535").should have_been_made
|
44
|
+
test.pcs_permit_event_list.pcs_permit_event[0].npdes.should == 'AKG520535'
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
describe ".pipe_sched_lat_long" do
|
49
|
+
before do
|
50
|
+
stub_get("pcs_pipe_sched_lat_long/NPDES/ALG120113").
|
51
|
+
to_return(:status => 200, :body => fixture("pcs_pipe_sched_lat_long.xml"))
|
52
|
+
end
|
53
|
+
|
54
|
+
it "should return the columns for a given database" do
|
55
|
+
test = @client.pipe_sched_lat_long(:column => "NPDES", :value => "ALG120113")
|
56
|
+
a_get("pcs_pipe_sched_lat_long/NPDES/ALG120113").should have_been_made
|
57
|
+
test.pcs_pipe_sched_lat_long_list.pcs_pipe_sched_lat_long[0].npdes.should == 'ALG120113'
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
describe ".dmr_measurement" do
|
62
|
+
before do
|
63
|
+
stub_get("pcs_dmr_measurement/NPDES/ALG120113").
|
64
|
+
to_return(:status => 200, :body => fixture("pcs_dmr_measurement.xml"))
|
65
|
+
end
|
66
|
+
|
67
|
+
it "should return the columns for a given database" do
|
68
|
+
test = @client.dmr_measurement(:column => "NPDES", :value => "ALG120113")
|
69
|
+
a_get("pcs_dmr_measurement/NPDES/ALG120113").should have_been_made
|
70
|
+
test.pcs_dmr_measurement_list.pcs_dmr_measurement[0].npdes.should == 'ALG120113'
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
describe ".inspection" do
|
75
|
+
before do
|
76
|
+
stub_get("pcs_inspection/NPDES/AKG520535").
|
77
|
+
to_return(:status => 200, :body => fixture("pcs_inspect.xml"))
|
78
|
+
end
|
79
|
+
|
80
|
+
it "should return the columns for a given database" do
|
81
|
+
test = @client.inspection(:column => "NPDES", :value => "AKG520535")
|
82
|
+
a_get("pcs_inspection/NPDES/AKG520535").should have_been_made
|
83
|
+
test.pcs_inspection_list.pcs_inspection.npdes.should == 'AKG520535'
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
describe ".enfor_action" do
|
88
|
+
before do
|
89
|
+
stub_get("pcs_enfor_action/NPDES/AR0020273").
|
90
|
+
to_return(:status => 200, :body => fixture("pcs_enfor_action.xml"))
|
91
|
+
end
|
92
|
+
|
93
|
+
it "should return the columns for a given database" do
|
94
|
+
test = @client.enfor_action(:column => "NPDES", :value => "AR0020273")
|
95
|
+
a_get("pcs_enfor_action/NPDES/AR0020273").should have_been_made
|
96
|
+
test.pcs_enfor_action_list.pcs_enfor_action[0].npdes.should == 'AR0020273'
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
describe ".permit_facility" do
|
101
|
+
before do
|
102
|
+
stub_get("pcs_permit_facility/NPDES/AR0020273").
|
103
|
+
to_return(:status => 200, :body => fixture("pcs_permit_facility.xml"))
|
104
|
+
end
|
105
|
+
|
106
|
+
it "should return the columns for a given database" do
|
107
|
+
test = @client.permit_facility(:column => "NPDES", :value => "AR0020273")
|
108
|
+
a_get("pcs_permit_facility/NPDES/AR0020273").should have_been_made
|
109
|
+
test.pcs_permit_facility_list.pcs_permit_facility.npdes.should == 'AR0020273'
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
describe ".pci_audit" do
|
114
|
+
before do
|
115
|
+
stub_get("pcs_pci_audit/NPDES/AR0020273").
|
116
|
+
to_return(:status => 200, :body => fixture("pcs_pci_audit.xml"))
|
117
|
+
end
|
118
|
+
|
119
|
+
it "should return the columns for a given database" do
|
120
|
+
test = @client.pci_audit(:column => "NPDES", :value => "AR0020273")
|
121
|
+
a_get("pcs_pci_audit/NPDES/AR0020273").should have_been_made
|
122
|
+
test.pcs_pci_audit_list.pcs_pci_audit[0].npdes.should == 'AR0020273'
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
describe ".effl_lim_qty" do
|
127
|
+
before do
|
128
|
+
stub_get("pcs_effl_lim_qty/NPDES/AR0020273").
|
129
|
+
to_return(:status => 200, :body => fixture("pcs_effl_lim_qty.xml"))
|
130
|
+
end
|
131
|
+
|
132
|
+
it "should return the columns for a given database" do
|
133
|
+
test = @client.effl_lim_qty(:column => "NPDES", :value => "AR0020273")
|
134
|
+
a_get("pcs_effl_lim_qty/NPDES/AR0020273").should have_been_made
|
135
|
+
test.pcs_effl_lim_qty_list.pcs_effl_lim_qty[0].npdes.should == 'AR0020273'
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
describe ".cmpl_schd_viol" do
|
140
|
+
before do
|
141
|
+
stub_get("pcs_cmpl_schd_viol/NPDES/AR0020273").
|
142
|
+
to_return(:status => 200, :body => fixture("pcs_cmpl_schd_viol.xml"))
|
143
|
+
end
|
144
|
+
|
145
|
+
it "should return the columns for a given database" do
|
146
|
+
test = @client.cmpl_schd_viol(:column => "NPDES", :value => "AR0020273")
|
147
|
+
a_get("pcs_cmpl_schd_viol/NPDES/AR0020273").should have_been_made
|
148
|
+
test.pcs_cmpl_schd_viol_list.pcs_cmpl_schd_viol[0].npdes.should == 'AR0020273'
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
describe ".pretreatment_perf_summary" do
|
153
|
+
before do
|
154
|
+
stub_get("pcs_pretreatment_perf_summary/NPDES/AR0020273").
|
155
|
+
to_return(:status => 200, :body => fixture("pcs_pretreatment_perf_summary.xml"))
|
156
|
+
end
|
157
|
+
|
158
|
+
it "should return the columns for a given database" do
|
159
|
+
test = @client.pretreatment_perf_summary(:column => "NPDES", :value => "AR0020273")
|
160
|
+
a_get("pcs_pretreatment_perf_summary/NPDES/AR0020273").should have_been_made
|
161
|
+
test.pcs_pretreatment_perf_summary_list.pcs_pretreatment_perf_summary[0].npdes.should == 'AR0020273'
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
describe ".code_desc" do
|
166
|
+
before do
|
167
|
+
stub_get("pcs_code_desc/CODE/110").
|
168
|
+
to_return(:status => 200, :body => fixture("pcs_code_desc.xml"))
|
169
|
+
end
|
170
|
+
|
171
|
+
it "should return the columns for a given database" do
|
172
|
+
test = @client.code_desc(:column => "CODE", :value => "110")
|
173
|
+
a_get("pcs_code_desc/CODE/110").should have_been_made
|
174
|
+
test.pcs_code_desc_list.pcs_code_desc.code.should == '110'
|
175
|
+
end
|
176
|
+
end
|
177
|
+
|
178
|
+
describe ".effl_lim" do
|
179
|
+
before do
|
180
|
+
stub_get("pcs_effl_lim/NPDES/AR0020273").
|
181
|
+
to_return(:status => 200, :body => fixture("pcs_effl_lim.xml"))
|
182
|
+
end
|
183
|
+
|
184
|
+
it "should return the columns for a given database" do
|
185
|
+
test = @client.effl_lim(:column => "NPDES", :value => "AR0020273")
|
186
|
+
a_get("pcs_effl_lim/NPDES/AR0020273").should have_been_made
|
187
|
+
test.pcs_effl_lim_list.pcs_effl_lim[0].npdes.should == 'AR0020273'
|
188
|
+
end
|
189
|
+
end
|
190
|
+
|
191
|
+
describe ".effl_lim_concentr" do
|
192
|
+
before do
|
193
|
+
stub_get("pcs_effl_lim_concentr/NPDES/AR0020273").
|
194
|
+
to_return(:status => 200, :body => fixture("pcs_effl_lim_concentr.xml"))
|
195
|
+
end
|
196
|
+
|
197
|
+
it "should return the columns for a given database" do
|
198
|
+
test = @client.effl_lim_concentr(:column => "NPDES", :value => "AR0020273")
|
199
|
+
a_get("pcs_effl_lim_concentr/NPDES/AR0020273").should have_been_made
|
200
|
+
test.pcs_effl_lim_concentr_list.pcs_effl_lim_concentr[0].npdes.should == 'AR0020273'
|
201
|
+
end
|
202
|
+
end
|
203
|
+
|
204
|
+
describe ".single_event_viol" do
|
205
|
+
before do
|
206
|
+
stub_get("pcs_single_event_viol/NPDES/AR0020273").
|
207
|
+
to_return(:status => 200, :body => fixture("pcs_single_event_viol.xml"))
|
208
|
+
end
|
209
|
+
|
210
|
+
it "should return the columns for a given database" do
|
211
|
+
test = @client.single_event_viol(:column => "NPDES", :value => "AR0020273")
|
212
|
+
a_get("pcs_single_event_viol/NPDES/AR0020273").should have_been_made
|
213
|
+
test.pcs_single_event_viol_list.pcs_single_event_viol[0].npdes.should == 'AR0020273'
|
214
|
+
end
|
215
|
+
end
|
216
|
+
|
217
|
+
describe ".sludge" do
|
218
|
+
before do
|
219
|
+
stub_get("pcs_sludge/HANDLER_STATE/KY").
|
220
|
+
to_return(:status => 200, :body => fixture("pcs_sludge.xml"))
|
221
|
+
end
|
222
|
+
|
223
|
+
it "should return the columns for a given database" do
|
224
|
+
test = @client.sludge(:column => "HANDLER_STATE", :value => "KY")
|
225
|
+
a_get("pcs_sludge/HANDLER_STATE/KY").should have_been_made
|
226
|
+
test.pcs_sludge_list.pcs_sludge[0].handler_state.should == 'KY'
|
227
|
+
end
|
228
|
+
end
|
229
|
+
|
230
|
+
describe ".pipe_sched" do
|
231
|
+
before do
|
232
|
+
stub_get("pcs_pipe_sched/NPDES/AR0020273").
|
233
|
+
to_return(:status => 200, :body => fixture("pcs_pipe_sched.xml"))
|
234
|
+
end
|
235
|
+
|
236
|
+
it "should return the columns for a given database" do
|
237
|
+
test = @client.pipe_sched(:column => "NPDES", :value => "AR0020273")
|
238
|
+
a_get("pcs_pipe_sched/NPDES/AR0020273").should have_been_made
|
239
|
+
test.pcs_pipe_sched_list.pcs_pipe_sched[0].npdes.should == 'AR0020273'
|
240
|
+
end
|
241
|
+
end
|
242
|
+
|
243
|
+
describe ".evidentiary_hearing_event" do
|
244
|
+
before do
|
245
|
+
stub_get("pcs_evidentiary_hearing_event/EVENT_CODE/02099").
|
246
|
+
to_return(:status => 200, :body => fixture("pcs_evidentiary_hearing_event.xml"))
|
247
|
+
end
|
248
|
+
|
249
|
+
it "should return the columns for a given database" do
|
250
|
+
test = @client.evidentiary_hearing_event(:column => "EVENT_CODE", :value => "02099")
|
251
|
+
a_get("pcs_evidentiary_hearing_event/EVENT_CODE/02099").should have_been_made
|
252
|
+
test.pcs_evidentiary_hearing_event_list.pcs_evidentiary_hearing_event[0].npdes.should == 'MA0101681'
|
253
|
+
end
|
254
|
+
end
|
255
|
+
|
256
|
+
describe ".industrial_user_info" do
|
257
|
+
before do
|
258
|
+
stub_get("pcs_industrial_user_info/NPDES/MA0101681").
|
259
|
+
to_return(:status => 200, :body => fixture("pcs_industrial_user_info.xml"))
|
260
|
+
end
|
261
|
+
|
262
|
+
it "should return the columns for a given database" do
|
263
|
+
test = @client.industrial_user_info(:column => "NPDES", :value => "MA0101681")
|
264
|
+
a_get("pcs_industrial_user_info/NPDES/MA0101681").should have_been_made
|
265
|
+
test.pcs_industrial_user_info_list.pcs_industrial_user_info[0].npdes.should == 'MA0101681'
|
266
|
+
end
|
267
|
+
end
|
268
|
+
|
269
|
+
describe ".cmpl_schd" do
|
270
|
+
before do
|
271
|
+
stub_get("pcs_cmpl_schd/NPDES/MA0101681").
|
272
|
+
to_return(:status => 200, :body => fixture("pcs_cmpl_sched.xml"))
|
273
|
+
end
|
274
|
+
|
275
|
+
it "should return the columns for a given database" do
|
276
|
+
test = @client.cmpl_schd(:column => "NPDES", :value => "MA0101681")
|
277
|
+
a_get("pcs_cmpl_schd/NPDES/MA0101681").should have_been_made
|
278
|
+
test.pcs_cmpl_schd_list.pcs_cmpl_schd[0].npdes.should == 'MA0101681'
|
279
|
+
end
|
280
|
+
end
|
281
|
+
|
282
|
+
end
|