data_kitten 1.3.3 → 1.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/data_kitten/publishing_formats/ckan.rb +17 -4
- data/lib/data_kitten/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MjZjYjdjNTA1YmZmZjRlZWU1YjUxOTJkNWRjNjMzOTExYTY1NzAwMQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
Zjg5ZWFmNjA1M2EzMjhlNDJiYTVhMjEwZjQwMDk4NjdjZjI3NGNhMQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YjI2ZWFlYjhlNjEzZWI4YWUyNDhjZDdkM2Y4YWY1MzNiMGM1Nzk3NmUxZjNi
|
10
|
+
MDIyMmZiYTJiZmExMjVjMTIxYTJkMDA2OWRiNWYxZmY3OGVkNGRjMDE1Yzc0
|
11
|
+
ZTUxMjYwM2UyZDI1MDU1MTAyMTk3MjVhYzRiNGU4NDZhNzIwNzE=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZmRjYjNiYWZhODE2YmNlNGMxMGQxN2I5ODExMThhNGNjYzRiNzAyOGU2ZmFj
|
14
|
+
Yjc0NDE0MTlkOGUzOGQ5MzM2M2U4ZWNmNDI2MmJiNTMwNzcyOTYwYTE0MzA4
|
15
|
+
ODU1NTY4MGRlNDFjMDcxMWNiYzA1YTFkYmQyNDI1ODVlMjc2NzA=
|
@@ -31,7 +31,7 @@ module DataKitten
|
|
31
31
|
if base.last == "dataset"
|
32
32
|
instance.identifier = package
|
33
33
|
# build a base URI ending with a /
|
34
|
-
base_uri = uri
|
34
|
+
base_uri = get_base(uri)
|
35
35
|
# If the package is a UUID - it's more than likely to be a CKAN ID
|
36
36
|
elsif package.match(/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/)
|
37
37
|
instance.identifier = package
|
@@ -54,6 +54,15 @@ module DataKitten
|
|
54
54
|
false
|
55
55
|
end
|
56
56
|
|
57
|
+
def self.get_base(uri)
|
58
|
+
*base, package = uri.path.split('/')
|
59
|
+
if base.last == "dataset"
|
60
|
+
uri.merge(base[0...-1].join('/') + '/')
|
61
|
+
else
|
62
|
+
uri.merge("/")
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
57
66
|
public
|
58
67
|
|
59
68
|
# The publishing format for the dataset.
|
@@ -75,7 +84,7 @@ module DataKitten
|
|
75
84
|
# @see Dataset#description
|
76
85
|
def description
|
77
86
|
metadata.lookup("notes") || metadata.lookup("description")
|
78
|
-
rescue
|
87
|
+
rescue
|
79
88
|
nil
|
80
89
|
end
|
81
90
|
|
@@ -234,6 +243,10 @@ module DataKitten
|
|
234
243
|
extract_spatial || extract_bbox
|
235
244
|
end
|
236
245
|
|
246
|
+
def base_uri
|
247
|
+
DataKitten::PublishingFormats::CKAN.get_base(self.uri)
|
248
|
+
end
|
249
|
+
|
237
250
|
private
|
238
251
|
|
239
252
|
def without_empty_values(h)
|
@@ -254,7 +267,7 @@ module DataKitten
|
|
254
267
|
rescue
|
255
268
|
nil
|
256
269
|
end
|
257
|
-
|
270
|
+
|
258
271
|
def extract_bbox
|
259
272
|
west = Float(metadata.lookup("extras", "bbox-west-long"))
|
260
273
|
east = Float(metadata.lookup("extras", "bbox-east-long"))
|
@@ -308,7 +321,7 @@ module DataKitten
|
|
308
321
|
@group = JSON.parse RestClient.get base_uri.merge(uri).to_s
|
309
322
|
break
|
310
323
|
rescue
|
311
|
-
# FakeWeb raises FakeWeb::NetConnectNotAllowedError, whereas
|
324
|
+
# FakeWeb raises FakeWeb::NetConnectNotAllowedError, whereas
|
312
325
|
# RestClient raises RestClient::ResourceNotFound in the "real world".
|
313
326
|
nil
|
314
327
|
end
|
data/lib/data_kitten/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: data_kitten
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Smith
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-10-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|