embulk-plugin-input-sfdc-event-log-files 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 184f6efcc9eea847d8a7e3cf727e29f7cc6aa78a
4
- data.tar.gz: 656f73d9bca6192070839d6ec55aee04f64e2b97
3
+ metadata.gz: c1de6f77dda618e88001e7dcde3c6df71dff8ca7
4
+ data.tar.gz: 97f3cd3e1595157a0a919c45282c302f71d8e558
5
5
  SHA512:
6
- metadata.gz: 06174c525e488afbb73f27f589f1df4798d21c3f84a088a4b4e80b84d204c614cd7e1aa501411f450e732c2333e628f359fdd4e88edc53e16281f845405c6448
7
- data.tar.gz: 8ec5eb00b1a775626d793f63b8dc07bbbe024d00f3cabb2b8fa19bc30bc64c7ff0733574caeedc0be652b54fe7970df1bc44723c4c25f616086173e7a6605d1e
6
+ metadata.gz: fdf820206419e15dcddb801737d6b77aa9dc45c732842d3c1b1782c2fee8416dcdda805f81658b7a6bfaf46a05b03dfe84012c74cbfbe01c30be3dee66443111
7
+ data.tar.gz: 12c78ada690b806fbff2353589b955f4082774cd6ce461b37a22899a75beb29a555acceb443f1f1ab13e5d889b86206e82d841bbe30afcc94000625912dd0bf0
@@ -42,8 +42,7 @@ module Embulk
42
42
  end
43
43
 
44
44
  def run(task, schema, index, page_builder)
45
- # This input plugin does not use schema
46
- new(task, index, page_builder).run
45
+ new(task, schema, index, page_builder).run
47
46
  end
48
47
 
49
48
  private
@@ -88,7 +87,8 @@ module Embulk
88
87
  end
89
88
  end
90
89
 
91
- def initialize(task, index, page_builder)
90
+ def initialize(task, schema, index, page_builder)
91
+ @schema = schema
92
92
  @page_builder = page_builder
93
93
  @records = task['records']
94
94
  @last_log_date = Time.parse(task['last_log_date'])
@@ -96,13 +96,15 @@ module Embulk
96
96
  end
97
97
 
98
98
  def run
99
+ columns = @schema.map { |c| c.name }
100
+ @page_builder.finish
99
101
  @records.each do |record|
100
102
  event_type = record['EventType']
101
103
  @last_log_date = [@last_log_date, Time.parse(record['LogDate']).to_i].max
102
104
  log_file = record['LogFile']
103
105
  CSV.parse(@client.get_content(log_file), headers: true) do |row|
104
- row['time'] = Time.parse(row['TIMESTAMP']).to_i
105
- @page_builder.add(row)
106
+ row['TIMESTAMP'] = Time.parse(row['TIMESTAMP']).to_i
107
+ @page_builder.add(row.to_hash.values_at(*columns))
106
108
  end
107
109
  end
108
110
  @page_builder.finish unless @records.empty?
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: embulk-plugin-input-sfdc-event-log-files
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hiroshi Nakamura