embulk-parser-flexml 0.1.1 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -0
- data/embulk-parser-flexml.gemspec +1 -1
- data/lib/embulk/parser/flexml.rb +11 -5
- 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: 2c38653cf5150955c6f0bb9955fc3c2abd43229b
|
4
|
+
data.tar.gz: 78febb4d3da68e4c378fa4f0c2dfc2e0e332315b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 67e3a09cffe108cc20722dd2007380f830d706fc3affc9fcf49fb50d67dadc07e2c68d2c8ba4f5adc7f0e12dd05b484b635a7a495cc96e073fab6eb16ab6e8ef
|
7
|
+
data.tar.gz: 3f98920cf3f2afd4ff67cbf8643bb9a65ec2c8ed6aa62bac8be74bfce5dbb9b6b163c1a13bc954335c45713b13a681a7dd50b207cddcc6c4452246a15d31d9a8
|
data/README.md
CHANGED
@@ -17,6 +17,9 @@ Flexible xml parser for embulk. read data using xpath and from attributes
|
|
17
17
|
- **type**: type of the attribute (string, required)
|
18
18
|
- **attribute**: if specified, value of this attribute will be the output, otherwise child will be the output (string, optional)
|
19
19
|
- **xpath**: child element to select (string, required)
|
20
|
+
- **format**: timestamp format to parse (string, required)
|
21
|
+
- **timezone**: timestamp will be parsed in this timezone (string, optional)
|
22
|
+
|
20
23
|
|
21
24
|
## Example
|
22
25
|
|
@@ -3,7 +3,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |spec|
|
5
5
|
spec.name = "embulk-parser-flexml"
|
6
|
-
spec.version = "0.
|
6
|
+
spec.version = "0.2.3"
|
7
7
|
spec.authors = ["Surya Asriadie"]
|
8
8
|
spec.email = ["surya.asriadie@gmail.com"]
|
9
9
|
spec.summary = %q{Flexible Embulk parser plugin for XML}
|
data/lib/embulk/parser/flexml.rb
CHANGED
@@ -14,7 +14,7 @@ module Embulk
|
|
14
14
|
if s["type"] == "timestamp"
|
15
15
|
memo[s["name"]].merge!({
|
16
16
|
"format" => s["format"],
|
17
|
-
"timezone" => s["timezone"]
|
17
|
+
"timezone" => s["timezone"]
|
18
18
|
})
|
19
19
|
end
|
20
20
|
memo
|
@@ -42,12 +42,16 @@ module Embulk
|
|
42
42
|
e
|
43
43
|
end
|
44
44
|
|
45
|
-
|
46
|
-
|
45
|
+
unless row.nil?
|
46
|
+
val = if c.has_key?("attribute")
|
47
|
+
row.attributes[c["attribute"]]
|
48
|
+
else
|
49
|
+
row.text
|
50
|
+
end
|
51
|
+
convert(val, c)
|
47
52
|
else
|
48
|
-
|
53
|
+
nil
|
49
54
|
end
|
50
|
-
convert(val, c)
|
51
55
|
end
|
52
56
|
|
53
57
|
@page_builder.add(values)
|
@@ -74,6 +78,8 @@ module Embulk
|
|
74
78
|
when "timestamp"
|
75
79
|
unless v.empty?
|
76
80
|
dest = Time.strptime(v, config["format"])
|
81
|
+
return dest.utc if config["timezone"].nil?
|
82
|
+
|
77
83
|
utc_offset = dest.utc_offset
|
78
84
|
zone_offset = Time.zone_offset(config["timezone"])
|
79
85
|
dest.localtime(zone_offset) + utc_offset - zone_offset
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: embulk-parser-flexml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Surya Asriadie
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-12-
|
11
|
+
date: 2021-12-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|