pure-extractor 0.4.0 → 0.5.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.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/lib/pure/extractor.rb +45 -3
- data/lib/pure/extractor/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 79b5ffdc5015e8fc7da2cd2d2bfb9dad661d163c
|
4
|
+
data.tar.gz: d69b7723e05022bea9e900f663d4f042ba9580bc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e39ade07fba7493a711fcf0e98e83046633dc22243a9d0edffe41f5ad47e5ac87c1789a31cf9c3cd523f3996e5f750111f5e97604fc5850f627f6bfb8515ef60
|
7
|
+
data.tar.gz: b36a0ec0915381b92311da7325783845399b4e0bd064a2e630590bddf6974066b0b384049e429177742b8a6eab7b287782a1c86b426bc163aa498e6b0bfb209d
|
data/.gitignore
CHANGED
data/lib/pure/extractor.rb
CHANGED
@@ -10,7 +10,7 @@ module Pure
|
|
10
10
|
|
11
11
|
collection = Puree::Collection.new resource: type
|
12
12
|
|
13
|
-
collection_count = collection.
|
13
|
+
collection_count = collection.count
|
14
14
|
|
15
15
|
puts collection_count
|
16
16
|
|
@@ -38,10 +38,52 @@ module Pure
|
|
38
38
|
offset += limit
|
39
39
|
|
40
40
|
end
|
41
|
+
|
42
|
+
formatted_results = format_results_for_type type, results
|
41
43
|
|
42
|
-
write_results_to_file
|
44
|
+
write_results_to_file formatted_results, output_file, type.to_s
|
43
45
|
|
44
46
|
end
|
47
|
+
|
48
|
+
def self.format_results_for_type type, results
|
49
|
+
|
50
|
+
formatted_results = []
|
51
|
+
|
52
|
+
case type
|
53
|
+
|
54
|
+
when :organisation
|
55
|
+
|
56
|
+
results.each do |result|
|
57
|
+
|
58
|
+
formatted_result = {
|
59
|
+
system: {
|
60
|
+
uuid: result["uuid"],
|
61
|
+
modified_at: result["modified"]
|
62
|
+
},
|
63
|
+
details: {
|
64
|
+
name: result["name"],
|
65
|
+
description: null,
|
66
|
+
url: result["url"][0],
|
67
|
+
isni: null,
|
68
|
+
type: result["type"]
|
69
|
+
},
|
70
|
+
parent: {
|
71
|
+
uuid: result["parent"]["uuid"]
|
72
|
+
}
|
73
|
+
}
|
74
|
+
|
75
|
+
formatted_results.push formatted_result
|
76
|
+
|
77
|
+
end
|
78
|
+
|
79
|
+
else
|
80
|
+
formatted_results = results
|
81
|
+
|
82
|
+
end
|
83
|
+
|
84
|
+
formatted_results
|
85
|
+
|
86
|
+
end
|
45
87
|
|
46
88
|
def self.delete_keys_for_type type, item
|
47
89
|
|
@@ -84,7 +126,7 @@ module Pure
|
|
84
126
|
puts "Writing #{collection_name} to #{file}"
|
85
127
|
|
86
128
|
File.open(file, "w") do |f|
|
87
|
-
f.write(results
|
129
|
+
f.write(JSON.pretty_generate(results))
|
88
130
|
end
|
89
131
|
|
90
132
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pure-extractor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stephen Robinson
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-09-
|
12
|
+
date: 2016-09-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: clamp
|