multiwoven-integrations 0.8.3 → 0.8.5

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
  SHA256:
3
- metadata.gz: 5328da16858cd290955a6b993a1ee19285490298eeab3573b8ad55b3dacf7258
4
- data.tar.gz: ef061954be00b3a90b5927f33e2633b05267968036123e743d5e3438ab4b18fd
3
+ metadata.gz: 045c92b3521693d13d19cf6646e6fad4527333170b7fcaf3c2c482166286aec6
4
+ data.tar.gz: 4fde17b8f55efce0d34f4ddbdbca03677b898cfa5ab65648e7b57e0a7c189f5f
5
5
  SHA512:
6
- metadata.gz: 5a74373e13a6a7f25385e675f8bad255383bfb937f60cb5f78b11512f4bcce749fa15da8f3c63530feeb0edfb5594a6270e857bc0d8975396de09a69f2ee9463
7
- data.tar.gz: a3262d0ab25b5c7bc3d69f2499068c7fee1a7116c3fe07b23db26177b00e2572e3b721383ed70d2ab9118bf3c144af1b89cb6ce2b2c37f9081a0a18df12e7db5
6
+ metadata.gz: 8164ba08bf4b32d78409eebf2af7f10709061f711578a84a66e7a60e86ff18f4216e9b89dad38aa070f185c4a644ba1ee377f0a26ca0927bc74c641613ac63c3
7
+ data.tar.gz: 13753610f3b8f26e7f5ad72cddc193f016fb1e7a172df5d18d1310e862224dd75b95e66bfb7ee0553e1155763669c7b8ef7141c90ef84f6afc4e423b9d2d3aef
@@ -55,13 +55,15 @@ module Multiwoven
55
55
  end
56
56
 
57
57
  def process_records(records, stream)
58
+ log_message_array = []
58
59
  write_success = 0
59
60
  write_failure = 0
60
61
  properties = stream.json_schema.with_indifferent_access[:properties]
61
62
  records.each do |record_object|
62
63
  record = extract_data(record_object, properties)
63
- send_data_to_hubspot(stream.name, record)
64
+ request, response = *send_data_to_hubspot(stream.name, record)
64
65
  write_success += 1
66
+ log_message_array << log_request_response("info", request, response)
65
67
  rescue StandardError => e
66
68
  handle_exception(e, {
67
69
  context: "HUBSPOT:CRM:WRITE:EXCEPTION",
@@ -70,15 +72,17 @@ module Multiwoven
70
72
  sync_run_id: @sync_config.sync_run_id
71
73
  })
72
74
  write_failure += 1
75
+ log_message_array << log_request_response("error", request, e.message)
73
76
  end
74
- tracking_message(write_success, write_failure)
77
+ tracking_message(write_success, write_failure, log_message_array)
75
78
  end
76
79
 
77
80
  def send_data_to_hubspot(stream_name, record = {})
78
81
  args = build_args(@action, stream_name, record)
79
82
  hubspot_stream = @client.crm.send(stream_name)
80
83
  hubspot_data = { simple_public_object_input_for_create: args }
81
- hubspot_stream.basic_api.send(@action, hubspot_data)
84
+ response = hubspot_stream.basic_api.send(@action, hubspot_data)
85
+ [args, response]
82
86
  end
83
87
 
84
88
  def build_args(action, stream_name, record)
@@ -108,12 +112,6 @@ module Multiwoven
108
112
  read_json(CATALOG_SPEC_PATH)
109
113
  end
110
114
 
111
- def tracking_message(success, failure)
112
- Multiwoven::Integrations::Protocol::TrackingMessage.new(
113
- success: success, failed: failure
114
- ).to_multiwoven_message
115
- end
116
-
117
115
  def log_debug(message)
118
116
  Multiwoven::Integrations::Service.logger.debug(message)
119
117
  end
@@ -52,14 +52,17 @@ module Multiwoven
52
52
  end
53
53
 
54
54
  def process_records(records, stream)
55
+ log_message_array = []
55
56
  write_success = 0
56
57
  write_failure = 0
57
58
  properties = stream.json_schema[:properties]
58
59
  records.each do |record_object|
59
60
  record = extract_data(record_object, properties)
60
- klass = @client.const_get(stream.name)
61
- klass.send(@action, record)
61
+ args = [stream.name, "Id", record]
62
+ klass = @client.const_get(stream.name)
63
+ response = klass.send(@action, record)
62
64
  write_success += 1
65
+ log_message_array << log_request_response("info", args, response)
63
66
  rescue StandardError => e
64
67
  handle_exception(e, {
65
68
  context: "STRIPE:CRM:WRITE:EXCEPTION",
@@ -68,8 +71,9 @@ module Multiwoven
68
71
  sync_run_id: @sync_config.sync_run_id
69
72
  })
70
73
  write_failure += 1
74
+ log_message_array << log_request_response("error", args, e.message)
71
75
  end
72
- tracking_message(write_success, write_failure)
76
+ tracking_message(write_success, write_failure, log_message_array)
73
77
  end
74
78
 
75
79
  def authenticate_client
@@ -80,12 +84,6 @@ module Multiwoven
80
84
  read_json(CATALOG_SPEC_PATH)
81
85
  end
82
86
 
83
- def tracking_message(success, failure)
84
- Multiwoven::Integrations::Protocol::TrackingMessage.new(
85
- success: success, failed: failure
86
- ).to_multiwoven_message
87
- end
88
-
89
87
  def log_debug(message)
90
88
  Multiwoven::Integrations::Service.logger.debug(message)
91
89
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Multiwoven
4
4
  module Integrations
5
- VERSION = "0.8.3"
5
+ VERSION = "0.8.5"
6
6
 
7
7
  ENABLED_SOURCES = %w[
8
8
  Snowflake
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: multiwoven-integrations
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.3
4
+ version: 0.8.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Subin T P
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-08-13 00:00:00.000000000 Z
11
+ date: 2024-08-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport