embulk-input-google_analytics 0.1.19 → 0.1.21

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: 98cf1ab1dabc69c3b8ee6a48e7054f9ed7a13bfc
4
- data.tar.gz: b214635c4b353bde69fc9358aa937c82765b6fe7
3
+ metadata.gz: 9c31715b2885f74b4c7e5de1945fe89992e90f4a
4
+ data.tar.gz: de5826031ef4faef63a8a34464d6901ff3db1f2e
5
5
  SHA512:
6
- metadata.gz: e24333e7618c3c729a78ae1a9d0fdb1cac380fef1f9b08bd31fb0a7fdc1b1b0ba25d31a2e399b8c33eed283a3d39007d1da2569dffa6f7c02143dafe55337c6a
7
- data.tar.gz: bcee119969919b4352761643d18a0c650dd5b5d017abedf1f75a1f980a2e282174d983ea5622dda77b7c7cbc05d0e35db794a0b70f4b5fbed4c2b847c4be0e1c
6
+ metadata.gz: 5f4c2643bd6bb00009cafb2e8cc3d6d1326a45ca41079172067148455574e670a050ed10cbed413f4c6ca542f543e21edc97a9d50fe14e943888f29f95eb78ef
7
+ data.tar.gz: 6f09530aad995baf95f5812d55be0a51ea8e499830622a5969f4cb69fdd85388bceeb0dabde8dcb64bdf2554429df3bcccfcc02cb3a7a2cff3ec6d48b28d9cc7
@@ -0,0 +1,37 @@
1
+ version: 2
2
+ jobs:
3
+ build:
4
+ parallelism: 1
5
+ environment:
6
+ JRUBY_OPTS: "-Xcli.debug=true --debug"
7
+ docker:
8
+ - image: circleci/jruby:9.1.17.0
9
+ working_directory: ~/workspace
10
+ steps:
11
+ - checkout
12
+ - restore_cache:
13
+ keys:
14
+ - deps-{{ .Environment.CIRCLE_JOB }}-{{ checksum "embulk-input-google_analytics.gemspec" }}
15
+ - run:
16
+ name: Install bundle
17
+ command: |
18
+ ruby -v
19
+ gem install bundler
20
+ - run:
21
+ name: Install dependencies
22
+ command: |
23
+ bundle -v
24
+ bundle config https://treasuredata.jfrog.io $TD_ARTIFACTORY_USERNAME:$TD_ARTIFACTORY_PASSWORD
25
+ bundle install --path=vendor/bundle
26
+ - save_cache:
27
+ paths:
28
+ - vendor/bundle
29
+ key: deps-{{ .Environment.CIRCLE_JOB }}-{{ checksum "embulk-input-google_analytics.gemspec" }}
30
+ - run:
31
+ name: Build
32
+ command: |
33
+ bundle exec rake build
34
+ - run:
35
+ name: Execute tests
36
+ command: |
37
+ bundle exec rake
@@ -1,5 +1,8 @@
1
+ ## 0.1.21 - 2019-04-01
2
+ * Fix **(ArgumentError) no time information in ""** when last_record_time is null [#42](https://github.com/treasure-data/embulk-input-google_analytics/pull/42)
3
+
1
4
  ## 0.1.19 - 2018-10-03
2
- * Make it easy to understand error message of Google Analytics connector (https://github.com/treasure-data/embulk-input-google_analytics/pull/39)
5
+ * Make it easy to understand error message of Google Analytics connector
3
6
 
4
7
  ## 0.1.18 - 2018-05-23
5
8
  * Suport User Account Authentication [#33](https://github.com/treasure-data/embulk-input-google_analytics/pull/33)
@@ -1,7 +1,7 @@
1
1
 
2
2
  Gem::Specification.new do |spec|
3
3
  spec.name = "embulk-input-google_analytics"
4
- spec.version = "0.1.19"
4
+ spec.version = "0.1.21"
5
5
  spec.authors = ["uu59"]
6
6
  spec.summary = "Google Analytics input plugin for Embulk"
7
7
  spec.description = "Loads records from Google Analytics."
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
22
22
  spec.add_development_dependency 'embulk', ['>= 0.8.9']
23
23
  spec.add_development_dependency 'bundler', ['>= 1.10.6']
24
24
  spec.add_development_dependency 'rake', ['>= 10.0']
25
- spec.add_development_dependency 'test-unit'
25
+ spec.add_development_dependency 'test-unit', ['< 3.2']
26
26
  spec.add_development_dependency 'test-unit-rr'
27
27
  spec.add_development_dependency 'simplecov'
28
28
  spec.add_development_dependency "codeclimate-test-reporter"
@@ -134,8 +134,7 @@ module Embulk
134
134
  client = Client.new(task, preview?)
135
135
  columns = self.class.columns_from_task(task) + ["view_id"]
136
136
 
137
- last_record_time = task['incremental'] && task["last_record_time"] ? Time.parse(task["last_record_time"]) : nil
138
-
137
+ last_record_time = Time.parse(task["last_record_time"]) if task['incremental'] && !task["last_record_time"].blank?
139
138
  latest_time_series = nil
140
139
  skip_counter, total_counter = 0, 0
141
140
  client.each_report_row do |row|
@@ -215,11 +214,13 @@ module Embulk
215
214
  # no records fetched, don't modify config_diff
216
215
  task_report = {
217
216
  start_date: task["start_date"],
218
- end_date: task["end_date"],
219
- last_record_time: task["last_record_time"],
217
+ end_date: task["end_date"]
220
218
  }
219
+ # write last_record_time only when last_record_time is not nil and not empty
220
+ unless task["last_record_time"].blank?
221
+ task_report[:last_record_time] = task["last_record_time"]
222
+ end
221
223
  end
222
-
223
224
  task_report
224
225
  end
225
226
  end
@@ -380,13 +380,22 @@ module Embulk
380
380
  end
381
381
 
382
382
  sub_test_case "no records fetched" do
383
- test "config_diff won't modify" do
384
- plugin = Plugin.new(config, nil, nil, @page_builder)
383
+ data do
384
+ [
385
+ ["last_record_time is nil", [nil, nil]],
386
+ ["last_record_time is empty", ["", nil]],
387
+ ["last_record_time is blank", [" ", nil]],
388
+ ["last_record_time is valid", ["2019-01-01", "2019-01-01"]]
389
+ ]
390
+ end
391
+ test "test calculate_next_times" do |(in_last_record_time, expected_last_record_time)|
392
+ config["last_record_time"] = in_last_record_time
385
393
  expected = {
386
394
  start_date: task["start_date"],
387
- end_date: task["end_date"],
388
- last_record_time: task["last_record_time"],
395
+ end_date: task["end_date"]
389
396
  }
397
+ expected[:last_record_time] = expected_last_record_time unless expected_last_record_time.blank?
398
+ plugin = Plugin.new(config, nil, nil, @page_builder)
390
399
  assert_equal expected, plugin.calculate_next_times(DEFAULT_TIMEZONE, nil)
391
400
  end
392
401
  end
@@ -452,6 +461,7 @@ module Embulk
452
461
  setup do
453
462
  conf = valid_config["in"]
454
463
  conf["time_series"] = "ga:date"
464
+ conf["last_record_time"] = "2019-01-01"
455
465
  @config = embulk_config(conf)
456
466
  end
457
467
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: embulk-input-google_analytics
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.19
4
+ version: 0.1.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - uu59
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-03 00:00:00.000000000 Z
11
+ date: 2019-04-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -125,17 +125,17 @@ dependencies:
125
125
  - !ruby/object:Gem::Dependency
126
126
  requirement: !ruby/object:Gem::Requirement
127
127
  requirements:
128
- - - ">="
128
+ - - "<"
129
129
  - !ruby/object:Gem::Version
130
- version: '0'
130
+ version: '3.2'
131
131
  name: test-unit
132
132
  prerelease: false
133
133
  type: :development
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - ">="
136
+ - - "<"
137
137
  - !ruby/object:Gem::Version
138
- version: '0'
138
+ version: '3.2'
139
139
  - !ruby/object:Gem::Dependency
140
140
  requirement: !ruby/object:Gem::Requirement
141
141
  requirements:
@@ -213,6 +213,7 @@ executables: []
213
213
  extensions: []
214
214
  extra_rdoc_files: []
215
215
  files:
216
+ - ".circleci/config.yml"
216
217
  - ".gitignore"
217
218
  - ".ruby-version"
218
219
  - CHANGELOG.md
@@ -220,7 +221,6 @@ files:
220
221
  - LICENSE.txt
221
222
  - README.md
222
223
  - Rakefile
223
- - circle.yml
224
224
  - embulk-input-google_analytics.gemspec
225
225
  - lib/embulk/input/google_analytics.rb
226
226
  - lib/embulk/input/google_analytics/client.rb
data/circle.yml DELETED
@@ -1,26 +0,0 @@
1
- machine:
2
- java:
3
- version: oraclejdk8
4
- ruby:
5
- version: jruby-9.1.5.0
6
- environment:
7
- JRUBY_OPTS: "-Xcli.debug=true --debug"
8
-
9
- dependencies:
10
- pre:
11
- - ruby -v
12
- - bundle -v
13
- - grep bundler <<< "$(gem list)" || gem i bundler --no-document
14
- - bundle -v
15
-
16
- test:
17
- override:
18
- - bundle exec rake cov
19
- notify:
20
- webhooks:
21
- - url: http://td-beda.herokuapp.com/circleci_callback
22
-
23
- general:
24
- artifacts:
25
- - "coverage"
26
-