hakoy 0.0.3 → 0.0.4
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/lib/hakoy/version.rb +1 -1
- data/lib/hakoy.rb +3 -14
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e927f2f407fa31512d3db7a44f32ad8077d965dd
|
4
|
+
data.tar.gz: e9aba5c6ead90290ae341ccc5742053e038b7a0f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f74bc3f20e55b4baa4bacf964658056dfd5fcf6737f284721debe98cdf171bf746815ef3a2827fdc041b9e92de3bf1286115ae827debacd8afacd09fd6834714
|
7
|
+
data.tar.gz: d4c960548a81b20d75197b8f40e142ea22ae130150fd86d47ef4a4d5c48fc7bf30958fa1993e041f57b1c7979880576c924da01aa1e5474bfe3415b8628aad9b
|
data/lib/hakoy/version.rb
CHANGED
data/lib/hakoy.rb
CHANGED
@@ -18,7 +18,6 @@ module Hakoy
|
|
18
18
|
class Proxy
|
19
19
|
DEFAULT_OUTPUT_FORMAT = 'csv'
|
20
20
|
DEFAULT_UID_KEY = 'uid'
|
21
|
-
REQUIED_KEYS = %w(customer product timestamp price quantity order_id)
|
22
21
|
|
23
22
|
def initialize(conf)
|
24
23
|
@timestamp_key = conf.fetch(:timestamp_key)
|
@@ -28,11 +27,8 @@ module Hakoy
|
|
28
27
|
@file_iterator = conf.fetch(:file_iterator) { FileIterator }
|
29
28
|
@append_strategy = conf.fetch(:append_strategy) { AppendStrategy.new }
|
30
29
|
@required_keys_mapping = conf.fetch(:required_keys_mapping)
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
@timestamp_path = TimestampPath.new
|
35
|
-
@row_normalizer = RowNormalizer.new(
|
30
|
+
@timestamp_path = TimestampPath.new
|
31
|
+
@row_normalizer = RowNormalizer.new(
|
36
32
|
required_keys: @required_keys_mapping.values, uid_key: @uid_key
|
37
33
|
)
|
38
34
|
end
|
@@ -44,13 +40,6 @@ module Hakoy
|
|
44
40
|
|
45
41
|
private
|
46
42
|
|
47
|
-
def assert_required_keys_present!(mapping)
|
48
|
-
mapping.keys.each do |key|
|
49
|
-
raise "Missing one of #{REQUIED_KEYS}" \
|
50
|
-
unless REQUIED_KEYS.include? key.to_s
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
43
|
def store_row(row_hash)
|
55
44
|
file_path = build_file_path(row_hash)
|
56
45
|
normalized_row_hash = normalize_row_hash(row_hash)
|
@@ -74,7 +63,7 @@ module Hakoy
|
|
74
63
|
|
75
64
|
def finalize_store!
|
76
65
|
@append_strategy.finalize! \
|
77
|
-
uid_key:
|
66
|
+
uid_key: DEFAULT_UID_KEY,
|
78
67
|
keys_mapping: @required_keys_mapping
|
79
68
|
end
|
80
69
|
end
|