geoblacklight 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1e3dff76debb6018b35c109add225964984a5da3
4
- data.tar.gz: f1c3cfbe2308c37e0d897ab4e88a8dbff3e62529
3
+ metadata.gz: 767308fdd3b12467270a409a98f4732062c57878
4
+ data.tar.gz: b822a8bc6294c81601963a4db3e7fbeef4434b09
5
5
  SHA512:
6
- metadata.gz: 3cb8faabed2e1d3fe1cd68a134b05c9bc668a9c668b35f32ec6fd35e88b996b222da199e036577cbba82440e2f300450eedec9db3b0431a4114abc68db8df3e3
7
- data.tar.gz: 03c7c599e496f974b4d6d7587211dab9c67481c30ec836b1b66bf135c40545bd7e23ca39ac71cbfff5c1a02c9796a0ca7cc14fd4099871aa0202fee0268d0031
6
+ metadata.gz: a1cc828205ad3c72548ad044d20522e306e01461552beea0b02fdd9313717b03fe724fc933ee808d6fe906bbe44c89f0b83967e697679911379d9b2e77d54b13
7
+ data.tar.gz: 27812b3d5d30157ab0c9e2a0e273d5dd5abe111503325edadae9fbc19a5a4d5706a473ad317e4501d5234969b490c3dad00691694177fc8a4745bd880db5aedb
@@ -42,7 +42,9 @@ module Geoblacklight
42
42
  def downloads_by_format
43
43
  case format
44
44
  when 'Shapefile'
45
- { shapefile: wfs.to_hash, kmz: wms.to_hash, geojson: wfs.to_hash }
45
+ if wfs && wms
46
+ { shapefile: wfs.to_hash, kmz: wms.to_hash, geojson: wfs.to_hash } if wms.present? && wfs.present?
47
+ end
46
48
  when 'GeoTIFF'
47
49
  { geotiff: wms.to_hash } if wms.present?
48
50
  end
@@ -3,6 +3,8 @@ module Geoblacklight
3
3
  module SolrDocument
4
4
  extend Blacklight::Solr::Document
5
5
 
6
+ delegate :download_types, to: :references
7
+
6
8
  def available?
7
9
  public? || same_institution?
8
10
  end
@@ -1,3 +1,3 @@
1
1
  module Geoblacklight
2
- VERSION = '0.2.1'
2
+ VERSION = '0.2.2'
3
3
  end
@@ -12,6 +12,14 @@ describe Geoblacklight::References do
12
12
  )
13
13
  )
14
14
  }
15
+ let(:no_service_shapefile) {
16
+ Geoblacklight::References.new(
17
+ SolrDocument.new(
18
+ dc_format_s: 'Shapefile',
19
+ dct_references_s: {}.to_json
20
+ )
21
+ )
22
+ }
15
23
  let(:typical_ogp_geotiff) {
16
24
  Geoblacklight::References.new(
17
25
  SolrDocument.new(
@@ -95,4 +103,19 @@ describe Geoblacklight::References do
95
103
  expect(types.count).to eq 3
96
104
  end
97
105
  end
106
+ describe 'downloads_by_format' do
107
+ it 'returns shapefile' do
108
+ expect(typical_ogp_shapefile.downloads_by_format.count).to eq 3
109
+ end
110
+ it 'returns geotiff' do
111
+ expect(typical_ogp_geotiff.downloads_by_format.count).to eq 1
112
+ expect(typical_ogp_geotiff.downloads_by_format[:geotiff][:wms]).to eq 'http://hgl.harvard.edu:8080/geoserver/wms'
113
+ end
114
+ it 'does not return shapefile if wms and wfs are not present' do
115
+ expect(no_service_shapefile.downloads_by_format).to be_nil
116
+ end
117
+ it 'does not return GeoTIFF if wms is not present' do
118
+ expect(direct_download_only.downloads_by_format).to be_nil
119
+ end
120
+ end
98
121
  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.2.1
4
+ version: 0.2.2
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-12-03 00:00:00.000000000 Z
12
+ date: 2014-12-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: blacklight