embulk-parser-flexml 0.1.1 → 0.2.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: 7adaffddc6300c0dab74df9372121d310acbdaeb
4
- data.tar.gz: 5ef5446c5dfc8746dbdebb12941819305a6f8820
3
+ metadata.gz: b76e551255f6f521fd1f4523bc51b996b55f9e27
4
+ data.tar.gz: 0e90b31b02642200bc23010cd87486968c752492
5
5
  SHA512:
6
- metadata.gz: 4e89dbac3ec544f4cfee5bd51fbaccc997751977e204c9bdbca2493153c4e4c928ab42c10e11fa4a5e009c8550fdf160284ec7999cfa55221e439d99c1b79171
7
- data.tar.gz: 3bb2d3ed00c8ef58505f212fcf6613a02836e4fe74f2f578c54f9d42ed809ab99b137cfdd3f856896f74349cbb35230e33753005b902cfdc2cc5a2badf702330
6
+ metadata.gz: 93dd096b3c715506298bf007c9b68177182071d49da644d1519811a82af2e1649ff263ea3d5da0da7914b802f79ee0184a1565f86926fa7a5735966521002479
7
+ data.tar.gz: 2e37018a51524203ff8d9011627e9133b55b8fcd3c6fc24bff415ad844ee9bf1922042e5a01a288a67af5fae801fb4b12baec83a5515a6b947847a98610d8d44
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.1.1"
6
+ spec.version = "0.2.0"
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}
@@ -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"] || "+0900"
17
+ "timezone" => s["timezone"]
18
18
  })
19
19
  end
20
20
  memo
@@ -74,6 +74,8 @@ module Embulk
74
74
  when "timestamp"
75
75
  unless v.empty?
76
76
  dest = Time.strptime(v, config["format"])
77
+ return dest.utc if config["timezone"].empty?
78
+
77
79
  utc_offset = dest.utc_offset
78
80
  zone_offset = Time.zone_offset(config["timezone"])
79
81
  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.1.1
4
+ version: 0.2.0
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-08 00:00:00.000000000 Z
11
+ date: 2021-12-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement