embulk-output-mailchimp 0.2.2 → 0.2.3

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: ea0a71c94e6f220bb45b2855bffe4d8ff5308ef6
4
- data.tar.gz: e96f19beb9c5f62e3579950a96d0276a1c8feaa4
3
+ metadata.gz: c5e90ff1e0d73bd9d852c2bb0cc53e954a8cf1ea
4
+ data.tar.gz: 27cf142a0398730ef50bf36e0076802984133148
5
5
  SHA512:
6
- metadata.gz: c328edb0012bfbe1ed253725d2e4e26fe3dfa407dc118dc1365e65dad943b122483aa6fe4c5a1cdaecc161c28ffb3fc07c979af8c51c4543df81ff88f88e5ca0
7
- data.tar.gz: 7e87b226cd606fbf99c2770277ebb77e43a0b44d9140bf993ac1301086e94ce686dd12b408e4985979e7e52c36842f74fcd8263b41085a1fe1a94937f5696479
6
+ metadata.gz: d0582347cfa8550e37f5323a651b8d2f68760eb84dd27ba6bc1b08cce6dfd81aa205198d01b0e18749b027161162b477d06290e64281c8ec6bcd9f736c528de2
7
+ data.tar.gz: 0b01f3c6a644537afde7b95da97b2f8c7dd966ab54738cab16f5c32cc85c0377bd9d8cd37459adb73dbdfa4c35433d732b847fb72c2f5db5ea087b088738d54f
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.2.3 - 2016-03-24
2
+
3
+ - Retry when Mailchimp server return Internal Server Error [#11](https://github.com/treasure-data/embulk-output-mailchimp/pull/11)
4
+
1
5
  ## 0.2.2 - 2016-01-21
2
6
 
3
7
  - Changed the threshold of batch size for uploading emails as a request [#9](https://github.com/treasure-data/embulk-output-mailchimp/pull/9)
@@ -1,7 +1,7 @@
1
1
 
2
2
  Gem::Specification.new do |spec|
3
3
  spec.name = "embulk-output-mailchimp"
4
- spec.version = "0.2.2"
4
+ spec.version = "0.2.3"
5
5
  spec.authors = ["uu59", "takkanm"]
6
6
  spec.summary = "Mailchimp output plugin for Embulk"
7
7
  spec.description = "Dumps records to Mailchimp."
@@ -21,8 +21,6 @@ module Embulk
21
21
  rescue ::Mailchimp::UserUnderMaintenanceError, ::Mailchimp::TooManyConnectionsError => e
22
22
  Embulk.logger.warn e.message
23
23
  raise e
24
- rescue ::Mailchimp::Error => e
25
- raise Embulk::DataError.new(e.message)
26
24
  end
27
25
  end
28
26
 
@@ -65,6 +65,47 @@ module Embulk
65
65
  end
66
66
  end
67
67
 
68
+ class TestFinish < self
69
+ setup do
70
+ stub(::Mailchimp::API).new(apikey) { }
71
+
72
+ @plugin = Mailchimp.new(
73
+ {
74
+ apikey: apikey,
75
+ list_id: list_id,
76
+ email_column: 'email',
77
+ retry_limit: retry_limit,
78
+ retry_initial_wait_sec: 0,
79
+ },
80
+ create_schema([
81
+ {name: 'email', type: :string},
82
+ ]),
83
+ 1
84
+ )
85
+ end
86
+
87
+ def retry_limit
88
+ 3
89
+ end
90
+
91
+ def test_retry_on_mailchimp_error
92
+ client = @plugin.instance_variable_get(:@client)
93
+ stub(client).batch_subscribe_list(list_id, anything, anything, anything, anything) {
94
+ # https://bitbucket.org/mailchimp/mailchimp-api-ruby/src/37dbe82057b96e135881c9379c0a3d5f8f32bf1f/lib/mailchimp.rb?at=master&fileviewer=file-view-default#mailchimp.rb-164
95
+ raise ::Mailchimp::Error, "We received an unexpected error: <!doctype html>"
96
+ }
97
+ stub(Embulk.logger).info(anything)
98
+ mock(Embulk.logger).warn(anything).at_least(retry_limit)
99
+
100
+ @plugin.add([
101
+ ["foo@example.com"]
102
+ ])
103
+ assert_raise(PerfectRetry::TooManyRetry) do
104
+ @plugin.finish
105
+ end
106
+ end
107
+ end
108
+
68
109
  class TestAdd < self
69
110
  setup do
70
111
  stub(::Mailchimp::API).new(apikey) { }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: embulk-output-mailchimp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - uu59
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-01-21 00:00:00.000000000 Z
12
+ date: 2016-03-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  requirement: !ruby/object:Gem::Requirement