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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f051ced414012b5cd2c63d8a83bd34ea7f47efef
4
- data.tar.gz: 31e00c0c123684966bc71f5f6ecc572df34ecdd6
3
+ metadata.gz: 79b5ffdc5015e8fc7da2cd2d2bfb9dad661d163c
4
+ data.tar.gz: d69b7723e05022bea9e900f663d4f042ba9580bc
5
5
  SHA512:
6
- metadata.gz: 11580f6872db2bd4051a05a45a50a978287bd0b8cb39462405066aeebbcb4ac5be68a2a52926124d066f0915726cba22def420f6a8e253b32f2bc19bfdd5dd83
7
- data.tar.gz: 7e2e8c1c01b1339e0d3912e6ed60b04ab1d3cada58e9226cf85cd6cc4e38a1915ce4c1906162d95a219ae251994689f85af9fa1f80e9b3f1053fddd132c99dab
6
+ metadata.gz: e39ade07fba7493a711fcf0e98e83046633dc22243a9d0edffe41f5ad47e5ac87c1789a31cf9c3cd523f3996e5f750111f5e97604fc5850f627f6bfb8515ef60
7
+ data.tar.gz: b36a0ec0915381b92311da7325783845399b4e0bd064a2e630590bddf6974066b0b384049e429177742b8a6eab7b287782a1c86b426bc163aa498e6b0bfb209d
data/.gitignore CHANGED
@@ -7,3 +7,4 @@
7
7
  /pkg/
8
8
  /spec/reports/
9
9
  /tmp/
10
+ *.gem
@@ -10,7 +10,7 @@ module Pure
10
10
 
11
11
  collection = Puree::Collection.new resource: type
12
12
 
13
- collection_count = collection.find(limit: 1000000000, full: false).count
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 results, output_file, type.to_s
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.to_json)
129
+ f.write(JSON.pretty_generate(results))
88
130
  end
89
131
 
90
132
  end
@@ -1,5 +1,5 @@
1
1
  module Pure
2
2
  module Extractor
3
- VERSION = "0.4.0"
3
+ VERSION = "0.5.0"
4
4
  end
5
5
  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.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-20 00:00:00.000000000 Z
12
+ date: 2016-09-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: clamp