embulk-input-marketo 0.2.0 → 0.2.1

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: bcfd15d051ac950ef7529b31662348b01f6c5389
4
- data.tar.gz: 1161b4da7811e5a0dd29454d5bd44b2ee6be8e73
3
+ metadata.gz: 3f71b3f65dab9d932934f09d2c5e9b47f9702613
4
+ data.tar.gz: d951b2cd6e46bedbbdf2f7ea4c25803c3f470d20
5
5
  SHA512:
6
- metadata.gz: 263729220d75599942c77113e4fed6f481453ed2b079fae30b26f63b12eb2e8ca96a667294ec378594241ae24d7e77a319ae9c5f9c6bb579c40fac58e90d6d4b
7
- data.tar.gz: 5f8ee7bc9eaa36e1d08ced80eed97bb5bfd0e581250204a41369bfbe19eb240ad4c05ec6b2a2236bc4ea347f05daa3c1c690d4a0c51c20ff27c7b39f3fe5add6
6
+ metadata.gz: dd33daed69356a087369dee73c6381dea6e61488227f5aaff52f705168241a97011bb77ed5c6b35ede7dbb3352dfcb03e7c206612f9b9b75dfb5d6ca81727c40
7
+ data.tar.gz: 02c17f9f3d72b8586a9479bed842b24fa2f2205a82b5a05b535ed291df84bf3b385a0e2d9638da3a924061e97b72db9533a47dd304466b9ebff65ac805772af7
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 0.2.1 - 2015-09-01
2
+
3
+ * [fixed] activity_log: Avoid to cast values unexpectedly [#29](https://github.com/treasure-data/embulk-input-marketo/pull/29)
4
+ * [maintenance] Add a minor comment [#28](https://github.com/treasure-data/embulk-input-marketo/pull/28) [Requested by @muga. Thanks!!]
5
+ * [maintenance] Fix minor issues [#27](https://github.com/treasure-data/embulk-input-marketo/pull/27) [[Reviewed by @muga.](https://github.com/treasure-data/embulk-input-marketo/pull/25#issuecomment-135570967) Thanks!!]
6
+
1
7
  ## 0.2.0 - 2015-08-27
2
8
 
3
9
  This version breaks backword compatibility of marketo/lead. Please check README.md to modify your config.
data/README.md CHANGED
@@ -36,7 +36,7 @@ Below parameters are shown in "Admin" > "Web Services" page in Marketo.
36
36
 
37
37
  ### market/lead
38
38
 
39
- **NOTE: If you use feature of scheduled execution (resume) with marketo/read, you should not specify until\_at because this plugin can't place new to_datetime (can't know the date to run with new config.**
39
+ **NOTE: If you use feature of scheduled execution (resume) with marketo/lead, you should not specify `to_datetime` because this plugin can't place next to_datetime (can't know the date to run with new config).**
40
40
 
41
41
  - **endpoint** SOAP endpoint URL for your account (string, required)
42
42
  - **wsdl** SOAP endpoint URL for your account (string, default: endpoint + "?WSDL")
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "embulk-input-marketo"
3
- spec.version = "0.2.0"
3
+ spec.version = "0.2.1"
4
4
  spec.authors = ["uu59", "yoshihara"]
5
5
  spec.summary = "Marketo input plugin for Embulk"
6
6
  spec.description = "Loads records from Marketo."
@@ -36,7 +36,15 @@ module Embulk
36
36
  last_updated_at = @soap.each(@last_updated_at, batch_size: batch_size) do |activity_log|
37
37
  values = @columns.map do |column|
38
38
  name = column["name"].to_s
39
- activity_log[name]
39
+ value = activity_log[name]
40
+ next unless value
41
+
42
+ case column["type"]
43
+ when "timestamp"
44
+ Time.parse(value)
45
+ else
46
+ value
47
+ end
40
48
  end
41
49
 
42
50
  page_builder.add(values)
@@ -6,8 +6,6 @@ module Embulk
6
6
  class Lead < Base
7
7
  include Timeslice
8
8
 
9
- PREVIEW_COUNT = 15
10
-
11
9
  Plugin.register_input("marketo/lead", self)
12
10
 
13
11
  def self.target
@@ -51,6 +51,7 @@ module Embulk
51
51
  columns << Column.new(nil, name, type, column["format"])
52
52
  end
53
53
 
54
+ # TODO tasks should be executed concurrently.
54
55
  resume(task, columns, 1, &control)
55
56
  end
56
57
  end
@@ -64,13 +64,13 @@ module Embulk
64
64
  return {remaining_count: 0, offset: nil, last_updated_at: nil}
65
65
  end
66
66
 
67
- activities = activities_list[:lead_change_record].sort { |activity| activity[:activity_date_time] }
67
+ activities = activities_list[:lead_change_record].sort_by { |activity| Time.parse(activity[:activity_date_time]) }
68
68
 
69
69
  activities.each do |activity|
70
70
  record = {
71
71
  "id" => activity[:id],
72
72
  # embulk can't treat DateTime
73
- "activity_date_time" => activity[:activity_date_time].to_time,
73
+ "activity_date_time" => Time.parse(activity[:activity_date_time]),
74
74
  "activity_type" => activity[:activity_type],
75
75
  "mktg_asset_name" => activity[:mktg_asset_name],
76
76
  "mkt_person_id" => activity[:mkt_person_id],
@@ -32,16 +32,16 @@ module Embulk
32
32
  soap_header: headers,
33
33
  endpoint: endpoint,
34
34
  open_timeout: 90,
35
- read_timeout: 300,
35
+ read_timeout: 90,
36
36
  raise_errors: true,
37
37
  namespace_identifier: :ns1,
38
- env_namespace: 'SOAP-ENV'
38
+ env_namespace: 'SOAP-ENV',
39
39
  )
40
40
  end
41
41
 
42
- def savon_call(*args)
42
+ def savon_call(operation, locals={})
43
43
  catch_unretryable_error do
44
- savon.call(*args)
44
+ savon.call(operation, locals.merge(advanced_typecasting: false))
45
45
  end
46
46
  end
47
47
 
@@ -31,7 +31,7 @@ module ActivityLogFixtures
31
31
  remaining_count: "1",
32
32
  new_start_position: {
33
33
  latest_created_at: true,
34
- oldest_created_at: DateTime.parse("2015-07-14T00:13:13+00:00"),
34
+ oldest_created_at: "2015-07-14T00:13:13+00:00",
35
35
  activity_created_at: true,
36
36
  offset: offset,
37
37
  },
@@ -39,7 +39,7 @@ module ActivityLogFixtures
39
39
  lead_change_record: [
40
40
  {
41
41
  id: "1",
42
- activity_date_time: DateTime.parse("2015-07-14T00:00:09+00:00"),
42
+ activity_date_time: "2015-07-14T00:00:09+00:00",
43
43
  activity_type: "at1",
44
44
  mktg_asset_name: "score1",
45
45
  activity_attributes: {
@@ -60,7 +60,7 @@ module ActivityLogFixtures
60
60
  },
61
61
  {
62
62
  id: "2",
63
- activity_date_time: DateTime.parse("2015-07-14T00:00:10+00:00"),
63
+ activity_date_time: "2015-07-14T00:00:10+00:00",
64
64
  activity_type: "at2",
65
65
  mktg_asset_name: "score2",
66
66
  activity_attributes: {
@@ -98,7 +98,7 @@ module ActivityLogFixtures
98
98
  lead_change_record: [
99
99
  {
100
100
  id: "3",
101
- activity_date_time: DateTime.parse("2015-07-14T00:00:11+00:00"),
101
+ activity_date_time: "2015-07-14T00:00:11+00:00",
102
102
  activity_type: "at3",
103
103
  mktg_asset_name: "score3",
104
104
  activity_attributes: {
@@ -126,7 +126,7 @@ module ActivityLogFixtures
126
126
  records = (1..15).map do |i|
127
127
  {
128
128
  id: i,
129
- activity_date_time: DateTime.parse("2015-07-14T00:00:11+00:00"),
129
+ activity_date_time: "2015-07-14T00:00:11+00:00",
130
130
  activity_type: "at#{i}",
131
131
  mktg_asset_name: "score#{i}",
132
132
  activity_attributes: {
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: embulk-input-marketo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
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: 2015-08-27 00:00:00.000000000 Z
12
+ date: 2015-09-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  requirement: !ruby/object:Gem::Requirement