geoblacklight 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (31) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/geoblacklight/modules/layer_opacity.js +11 -8
  3. data/app/assets/stylesheets/geoblacklight/_geoblacklight.css.scss +1 -0
  4. data/app/assets/stylesheets/geoblacklight/modules/item.css.scss +4 -0
  5. data/app/assets/stylesheets/geoblacklight/modules/layer_opacity.css.scss +42 -13
  6. data/app/assets/stylesheets/geoblacklight/modules/mixins.css.scss +5 -0
  7. data/app/helpers/geoblacklight_helper.rb +0 -1
  8. data/app/views/catalog/_show_sidebar.html.erb +18 -5
  9. data/app/views/shared/_header_navbar.html.erb +1 -1
  10. data/lib/geoblacklight.rb +5 -0
  11. data/lib/geoblacklight/constants.rb +18 -0
  12. data/lib/geoblacklight/reference.rb +21 -0
  13. data/lib/geoblacklight/references.rb +55 -0
  14. data/lib/geoblacklight/solr_document.rb +9 -1
  15. data/lib/geoblacklight/version.rb +1 -1
  16. data/lib/geoblacklight/view_helper_override.rb +1 -1
  17. data/spec/features/dct_references_generate.rb +100 -0
  18. data/spec/features/dct_references_spec.rb +77 -0
  19. data/spec/features/download_layer_spec.rb +23 -7
  20. data/spec/features/search_bar_spec.rb +12 -0
  21. data/spec/fixtures/test-dct-references1.json +38 -0
  22. data/spec/fixtures/test-dct-references2.json +41 -0
  23. data/spec/fixtures/test-dct-references3.json +45 -0
  24. data/spec/fixtures/test-dct-references4.json +60 -0
  25. data/spec/fixtures/test-dct-references5.json +57 -0
  26. data/spec/fixtures/test-dct-references6.json +52 -0
  27. data/spec/fixtures/test-dct-references7.json +42 -0
  28. data/spec/fixtures/test-dct-references8.json +46 -0
  29. data/spec/lib/geoblacklight/references_spec.rb +86 -0
  30. data/spec/lib/geoblacklight/{solr_document.rb → solr_document_spec.rb} +35 -2
  31. metadata +32 -4
@@ -0,0 +1,42 @@
1
+ {
2
+ "uuid": "urn:hul.harvard.edu:HARVARD.SDE.TG95NYCTYPY",
3
+ "dc_description_s": "This datalayer displays the counties for the state, based on a ground condition of January 1, 1990. The primary legal divisions of most states are termed ''counties.'' Each county and statistically equivalent entity is assigned a three-digit Federal Information Processing Standards code that is unique within the state. These codes are assigned in alphabetical order of county or county equivalent within each state.",
4
+ "dc_format_s": "Shapefile",
5
+ "dc_identifier_s": "urn:hul.harvard.edu:HARVARD.SDE.TG95NYCTYPY",
6
+ "dc_language_s": "English",
7
+ "dc_publisher_s": "U.S. Department of Commerce, Bureau of the Census, Geography Division",
8
+ "dc_rights_s": "Public",
9
+ "dc_subject_sm": [
10
+ "boundaries",
11
+ "Census",
12
+ "Administrative",
13
+ "divisions",
14
+ "County",
15
+ "government"
16
+ ],
17
+ "dc_title_s": "Census Counties, 1990 - New York (State)",
18
+ "dc_type_s": "Dataset",
19
+ "dct_references_s": "{\"http://schema.org/downloadUrl\":\"http://example.com/urn:hul.harvard.edu:HARVARD.SDE.TG95NYCTYPY/data.json\"}",
20
+ "dct_spatial_sm": [
21
+ "New York (State)"
22
+ ],
23
+ "dct_temporal_sm": [
24
+ "1990"
25
+ ],
26
+ "dct_issued_s": "2000",
27
+ "dct_provenance_s": "Harvard",
28
+ "georss_box_s": "40.496105 -79.762152 45.01258 -71.85615",
29
+ "georss_polygon_s": "45.01258 -79.762152 45.01258 -71.85615 40.496105 -71.85615 40.496105 -79.762152 45.01258 -79.762152",
30
+ "layer_slug_s": "harvard-tg95nyctypy",
31
+ "layer_id_s": "sde:SDE.TG95NYCTYPY",
32
+ "layer_geom_type_s": "Polygon",
33
+ "layer_modified_dt": "2014-05-27T18:09:35Z",
34
+ "solr_bbox": "-79.762152 40.496105 -71.85615 45.01258",
35
+ "solr_ne_pt": "45.01258,-71.85615",
36
+ "solr_sw_pt": "40.496105,-79.762152",
37
+ "solr_geom": "ENVELOPE(-79.762152, -71.85615, 45.01258, 40.496105)",
38
+ "solr_year_i": 1990,
39
+ "solr_issued_dt": "2000-01-01T00:00:00Z",
40
+ "solr_wms_url": "http://hgl.harvard.edu:8080/geoserver/wms",
41
+ "solr_wfs_url": "http://hgl.harvard.edu:8080/geoserver/wfs"
42
+ }
@@ -0,0 +1,46 @@
1
+ {
2
+ "uuid": "urn:hul.harvard.edu:HARVARD.SDE.ESRIMIZIP",
3
+ "dc_description_s": "Michigan ZIP Code Areas represents five-digit ZIP Code areas used by the U.S. Postal Service to deliver mail more effectively. The first digit of a five-digit ZIP Code divides the country into 10 large groups of states numbered from 0 in the Northeast to 9 in the far West. Within these areas, each state is divided into an average of 10 smaller geographical areas, identified by the 2nd and 3rd digits. These digits, in conjunction with the first digit, represent a sectional center facility or a mail processing facility area. The 4th and 5th digits identify a post office, station, branch or local delivery area.",
4
+ "dc_format_s": "Shapefile",
5
+ "dc_identifier_s": "urn:hul.harvard.edu:HARVARD.SDE.ESRIMIZIP",
6
+ "dc_language_s": "English",
7
+ "dc_publisher_s": "Environmental Systems Research Institute, Inc. (ESRI)",
8
+ "dc_rights_s": "Restricted",
9
+ "dc_subject_sm": [
10
+ "location",
11
+ "boundaries",
12
+ "polygon",
13
+ "zip",
14
+ "codes",
15
+ "areas",
16
+ "five-digit",
17
+ "post",
18
+ "offices",
19
+ "population"
20
+ ],
21
+ "dc_title_s": "Michigan ZIP Code Areas",
22
+ "dc_type_s": "Dataset",
23
+ "dct_references_s": "{\"http://www.w3.org/1999/xhtml\":\"http://example.com/#doc['uuid']/metadata.html\",\"http://www.opengis.net/def/serviceType/ogc/wms\":\"http://hgl.harvard.edu:8080/geoserver/wms\"}",
24
+ "dct_spatial_sm": [
25
+ "United States Michigan"
26
+ ],
27
+ "dct_temporal_sm": [
28
+ "1999"
29
+ ],
30
+ "dct_issued_s": "2000",
31
+ "dct_provenance_s": "Harvard",
32
+ "georss_box_s": "41.69609 -90.418136 48.190509 -82.418635",
33
+ "georss_polygon_s": "48.190509 -90.418136 48.190509 -82.418635 41.69609 -82.418635 41.69609 -90.418136 48.190509 -90.418136",
34
+ "layer_slug_s": "harvard-esrimizip",
35
+ "layer_id_s": "sde:SDE.ESRIMIZIP",
36
+ "layer_geom_type_s": "Polygon",
37
+ "layer_modified_dt": "2014-05-27T18:09:35Z",
38
+ "solr_bbox": "-90.418136 41.69609 -82.418635 48.190509",
39
+ "solr_ne_pt": "48.190509,-82.418635",
40
+ "solr_sw_pt": "41.69609,-90.418136",
41
+ "solr_geom": "ENVELOPE(-90.418136, -82.418635, 48.190509, 41.69609)",
42
+ "solr_year_i": 1999,
43
+ "solr_issued_dt": "2000-01-01T00:00:00Z",
44
+ "solr_wms_url": "http://hgl.harvard.edu:8080/geoserver/wms",
45
+ "solr_wfs_url": "http://hgl.harvard.edu:8080/geoserver/wfs"
46
+ }
@@ -0,0 +1,86 @@
1
+ require 'spec_helper'
2
+
3
+ describe Geoblacklight::References do
4
+ let(:typical_ogp_shapefile) {
5
+ Geoblacklight::References.new(
6
+ SolrDocument.new(
7
+ dc_format_s: 'Shapefile',
8
+ dct_references_s: {
9
+ 'http://www.opengis.net/def/serviceType/ogc/wms' => 'http://hgl.harvard.edu:8080/geoserver/wms',
10
+ 'http://www.opengis.net/def/serviceType/ogc/wfs' => 'http://hgl.harvard.edu:8080/geoserver/wfs'
11
+ }.to_json
12
+ )
13
+ )
14
+ }
15
+ let(:typical_ogp_geotiff) {
16
+ Geoblacklight::References.new(
17
+ SolrDocument.new(
18
+ dc_format_s: 'GeoTIFF',
19
+ dct_references_s: {
20
+ 'http://www.opengis.net/def/serviceType/ogc/wms' => 'http://hgl.harvard.edu:8080/geoserver/wms',
21
+ 'http://www.opengis.net/def/serviceType/ogc/wfs' => 'http://hgl.harvard.edu:8080/geoserver/wfs'
22
+ }.to_json
23
+ )
24
+ )
25
+ }
26
+ let(:complex_shapefile) {
27
+ Geoblacklight::References.new(
28
+ SolrDocument.new(
29
+ dc_format_s: 'Shapefile',
30
+ dct_references_s: {
31
+ 'http://schema.org/downloadUrl' => 'http://example.com/urn:hul.harvard.edu:HARVARD.SDE2.TG10USAIANNH/data.zip',
32
+ 'http://www.isotc211.org/schemas/2005/gmd/' => 'http://example.com/urn:hul.harvard.edu:HARVARD.SDE2.TG10USAIANNH/iso19139.xml',
33
+ 'http://www.loc.gov/mods/v3' => 'http://example.com/urn:hul.harvard.edu:HARVARD.SDE2.TG10USAIANNH/mods.xml',
34
+ 'http://schema.org/url' => 'http://example.com/urn:hul.harvard.edu:HARVARD.SDE2.TG10USAIANNH/homepage',
35
+ 'http://www.opengis.net/def/serviceType/ogc/wms' => 'http://hgl.harvard.edu:8080/geoserver/wms',
36
+ 'http://www.opengis.net/def/serviceType/ogc/wfs' => 'http://hgl.harvard.edu:8080/geoserver/wfs'
37
+ }.to_json
38
+ )
39
+ )
40
+ }
41
+ describe 'format' do
42
+ it 'should return format' do
43
+ expect(complex_shapefile.format).to eq 'Shapefile'
44
+ end
45
+ end
46
+ describe 'refs' do
47
+ it 'should be enumberable references' do
48
+ complex_shapefile.refs.each do |reference|
49
+ expect(reference).to be_an Geoblacklight::Reference
50
+ end
51
+ end
52
+ end
53
+ describe 'direct_download' do
54
+ it 'should return the direct download link' do
55
+ download = complex_shapefile.download
56
+ expect(download).to be_an Geoblacklight::Reference
57
+ expect(download.endpoint).to eq('http://example.com/urn:hul.harvard.edu:HARVARD.SDE2.TG10USAIANNH/data.zip')
58
+ end
59
+ it 'should not return if download not available' do
60
+ expect(typical_ogp_shapefile.download).to be_nil
61
+ end
62
+ end
63
+ describe 'preferred_download' do
64
+ it 'should return the direct download if available' do
65
+ expect(complex_shapefile.preferred_download[:file_download][:download]).to eq 'http://example.com/urn:hul.harvard.edu:HARVARD.SDE2.TG10USAIANNH/data.zip'
66
+ end
67
+ it 'should return nil if there is no direct download' do
68
+ expect(typical_ogp_shapefile.preferred_download).to be_nil
69
+ end
70
+ it 'should return nil if there is no direct download' do
71
+ expect(typical_ogp_geotiff.preferred_download).to be_nil
72
+ end
73
+ end
74
+ describe 'download_types' do
75
+ it 'should return available downloads by format' do
76
+ types = complex_shapefile.download_types
77
+ expect(types.first[1]).to eq wfs: 'http://hgl.harvard.edu:8080/geoserver/wfs'
78
+ expect(types.count).to eq 2
79
+ end
80
+ it 'should only return available downloads if no direct is present' do
81
+ types = typical_ogp_shapefile.download_types
82
+ expect(types.first[1]).to eq wfs: "http://hgl.harvard.edu:8080/geoserver/wfs"
83
+ expect(types.count).to eq 2
84
+ end
85
+ end
86
+ end
@@ -12,7 +12,7 @@ describe Geoblacklight::SolrDocument do
12
12
  end
13
13
  end
14
14
  describe 'a restricted document' do
15
- describe 'should only be available if from same institution' do
15
+ it 'should only be available if from same institution' do
16
16
  allow(document).to receive('same_institution?').and_return(true)
17
17
  allow(document).to receive('public?').and_return(false)
18
18
  expect(document.available?).to be_truthy
@@ -42,7 +42,7 @@ describe Geoblacklight::SolrDocument do
42
42
  end
43
43
  it 'should match case inconsistencies' do
44
44
  allow(Settings).to receive('Institution').and_return('StAnFord')
45
- expect(document.same_institution).to be_truthy
45
+ expect(document.same_institution?).to be_truthy
46
46
  end
47
47
  end
48
48
  describe 'within a different institution' do
@@ -53,4 +53,37 @@ describe Geoblacklight::SolrDocument do
53
53
  end
54
54
  end
55
55
  end
56
+ describe 'references' do
57
+ let(:document_attributes) { {} }
58
+ it 'should generate a new references object' do
59
+ expect(document.references).to be_an Geoblacklight::References
60
+ end
61
+ end
62
+ describe 'download_types' do
63
+ let(:document_attributes) { {} }
64
+ it 'should call download_types' do
65
+ expect_any_instance_of(Geoblacklight::References).to receive(:download_types)
66
+ document.download_types
67
+ end
68
+ end
69
+ describe 'direct_download' do
70
+ let(:document_attributes) { {} }
71
+ describe 'with a direct download' do
72
+ let(:document_attributes) {
73
+ {
74
+ dct_references_s: {
75
+ 'http://schema.org/downloadUrl' => 'http://example.com/urn:hul.harvard.edu:HARVARD.SDE2.TG10USAIANNH/data.zip'
76
+ }.to_json
77
+ }
78
+ }
79
+ it 'should return a direct download hash' do
80
+ expect_any_instance_of(Geoblacklight::Reference).to receive(:to_hash)
81
+ document.direct_download
82
+ end
83
+ end
84
+ it 'should return nil if no direct download' do
85
+ expect_any_instance_of(Geoblacklight::Reference).to_not receive(:to_hash)
86
+ expect(document.direct_download).to be_nil
87
+ end
88
+ end
56
89
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: geoblacklight
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Darren Hardy
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-11-19 00:00:00.000000000 Z
12
+ date: 2014-11-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: blacklight
@@ -276,6 +276,7 @@ files:
276
276
  - app/assets/stylesheets/geoblacklight/modules/icons.css.scss
277
277
  - app/assets/stylesheets/geoblacklight/modules/item.css.scss
278
278
  - app/assets/stylesheets/geoblacklight/modules/layer_opacity.css.scss
279
+ - app/assets/stylesheets/geoblacklight/modules/mixins.css.scss
279
280
  - app/assets/stylesheets/geoblacklight/modules/results.css.scss
280
281
  - app/controllers/download_controller.rb
281
282
  - app/controllers/wms_controller.rb
@@ -302,11 +303,14 @@ files:
302
303
  - lib/generators/geoblacklight/templates/settings.yml
303
304
  - lib/geoblacklight.rb
304
305
  - lib/geoblacklight/config.rb
306
+ - lib/geoblacklight/constants.rb
305
307
  - lib/geoblacklight/controller_override.rb
306
308
  - lib/geoblacklight/download.rb
307
309
  - lib/geoblacklight/download/kmz_download.rb
308
310
  - lib/geoblacklight/download/shapefile_download.rb
309
311
  - lib/geoblacklight/engine.rb
312
+ - lib/geoblacklight/reference.rb
313
+ - lib/geoblacklight/references.rb
310
314
  - lib/geoblacklight/solr_document.rb
311
315
  - lib/geoblacklight/version.rb
312
316
  - lib/geoblacklight/view_helper_override.rb
@@ -315,16 +319,28 @@ files:
315
319
  - lib/tasks/geoblacklight.rake
316
320
  - spec/controllers/download_controller_spec.rb
317
321
  - spec/factories/user.rb
322
+ - spec/features/dct_references_generate.rb
323
+ - spec/features/dct_references_spec.rb
318
324
  - spec/features/download_layer_spec.rb
319
325
  - spec/features/home_page_spec.rb
320
326
  - spec/features/layer_inspection_spec.rb
321
327
  - spec/features/layer_preview_spec.rb
328
+ - spec/features/search_bar_spec.rb
322
329
  - spec/features/split_view.html.erb_spec.rb
330
+ - spec/fixtures/test-dct-references1.json
331
+ - spec/fixtures/test-dct-references2.json
332
+ - spec/fixtures/test-dct-references3.json
333
+ - spec/fixtures/test-dct-references4.json
334
+ - spec/fixtures/test-dct-references5.json
335
+ - spec/fixtures/test-dct-references6.json
336
+ - spec/fixtures/test-dct-references7.json
337
+ - spec/fixtures/test-dct-references8.json
323
338
  - spec/lib/geoblacklight/controller_override_spec.rb
324
339
  - spec/lib/geoblacklight/download/kmz_download_spec.rb
325
340
  - spec/lib/geoblacklight/download/shapefile_download_spec.rb
326
341
  - spec/lib/geoblacklight/download_spec.rb
327
- - spec/lib/geoblacklight/solr_document.rb
342
+ - spec/lib/geoblacklight/references_spec.rb
343
+ - spec/lib/geoblacklight/solr_document_spec.rb
328
344
  - spec/lib/geoblacklight/view_helper_override_spec.rb
329
345
  - spec/lib/geoblacklight/wms_layer/feature_info_response_spec.rb
330
346
  - spec/lib/geoblacklight/wms_layer_spec.rb
@@ -363,16 +379,28 @@ summary: A discovery platform for geospatial holdings
363
379
  test_files:
364
380
  - spec/controllers/download_controller_spec.rb
365
381
  - spec/factories/user.rb
382
+ - spec/features/dct_references_generate.rb
383
+ - spec/features/dct_references_spec.rb
366
384
  - spec/features/download_layer_spec.rb
367
385
  - spec/features/home_page_spec.rb
368
386
  - spec/features/layer_inspection_spec.rb
369
387
  - spec/features/layer_preview_spec.rb
388
+ - spec/features/search_bar_spec.rb
370
389
  - spec/features/split_view.html.erb_spec.rb
390
+ - spec/fixtures/test-dct-references1.json
391
+ - spec/fixtures/test-dct-references2.json
392
+ - spec/fixtures/test-dct-references3.json
393
+ - spec/fixtures/test-dct-references4.json
394
+ - spec/fixtures/test-dct-references5.json
395
+ - spec/fixtures/test-dct-references6.json
396
+ - spec/fixtures/test-dct-references7.json
397
+ - spec/fixtures/test-dct-references8.json
371
398
  - spec/lib/geoblacklight/controller_override_spec.rb
372
399
  - spec/lib/geoblacklight/download/kmz_download_spec.rb
373
400
  - spec/lib/geoblacklight/download/shapefile_download_spec.rb
374
401
  - spec/lib/geoblacklight/download_spec.rb
375
- - spec/lib/geoblacklight/solr_document.rb
402
+ - spec/lib/geoblacklight/references_spec.rb
403
+ - spec/lib/geoblacklight/solr_document_spec.rb
376
404
  - spec/lib/geoblacklight/view_helper_override_spec.rb
377
405
  - spec/lib/geoblacklight/wms_layer/feature_info_response_spec.rb
378
406
  - spec/lib/geoblacklight/wms_layer_spec.rb