etl-integrations 0.1.81
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.rspec +3 -0
- data/.rubocop.yml +34 -0
- data/.ruby-version +1 -0
- data/.vscode/settings.json +5 -0
- data/CHANGELOG.md +38 -0
- data/CODE_OF_CONDUCT.md +84 -0
- data/LICENSE.txt +21 -0
- data/README.md +105 -0
- data/Rakefile +12 -0
- data/lib/multiwoven/integrations/config.rb +13 -0
- data/lib/multiwoven/integrations/core/base_connector.rb +70 -0
- data/lib/multiwoven/integrations/core/constants.rb +46 -0
- data/lib/multiwoven/integrations/core/destination_connector.rb +14 -0
- data/lib/multiwoven/integrations/core/fullrefresher.rb +19 -0
- data/lib/multiwoven/integrations/core/http_client.rb +34 -0
- data/lib/multiwoven/integrations/core/query_builder.rb +27 -0
- data/lib/multiwoven/integrations/core/rate_limiter.rb +19 -0
- data/lib/multiwoven/integrations/core/source_connector.rb +38 -0
- data/lib/multiwoven/integrations/core/utils.rb +104 -0
- data/lib/multiwoven/integrations/destination/airtable/client.rb +153 -0
- data/lib/multiwoven/integrations/destination/airtable/config/catalog.json +6 -0
- data/lib/multiwoven/integrations/destination/airtable/config/meta.json +15 -0
- data/lib/multiwoven/integrations/destination/airtable/config/spec.json +22 -0
- data/lib/multiwoven/integrations/destination/airtable/icon.svg +6 -0
- data/lib/multiwoven/integrations/destination/airtable/schema_helper.rb +141 -0
- data/lib/multiwoven/integrations/destination/facebook_custom_audience/client.rb +124 -0
- data/lib/multiwoven/integrations/destination/facebook_custom_audience/config/catalog.json +42 -0
- data/lib/multiwoven/integrations/destination/facebook_custom_audience/config/meta.json +15 -0
- data/lib/multiwoven/integrations/destination/facebook_custom_audience/config/spec.json +27 -0
- data/lib/multiwoven/integrations/destination/facebook_custom_audience/icon.svg +23 -0
- data/lib/multiwoven/integrations/destination/google_sheets/client.rb +231 -0
- data/lib/multiwoven/integrations/destination/google_sheets/config/catalog.json +6 -0
- data/lib/multiwoven/integrations/destination/google_sheets/config/meta.json +15 -0
- data/lib/multiwoven/integrations/destination/google_sheets/config/spec.json +74 -0
- data/lib/multiwoven/integrations/destination/google_sheets/icon.svg +1 -0
- data/lib/multiwoven/integrations/destination/hubspot/client.rb +107 -0
- data/lib/multiwoven/integrations/destination/hubspot/config/catalog.json +351 -0
- data/lib/multiwoven/integrations/destination/hubspot/config/meta.json +15 -0
- data/lib/multiwoven/integrations/destination/hubspot/config/spec.json +17 -0
- data/lib/multiwoven/integrations/destination/hubspot/icon.svg +5 -0
- data/lib/multiwoven/integrations/destination/klaviyo/client.rb +116 -0
- data/lib/multiwoven/integrations/destination/klaviyo/config/catalog.json +103 -0
- data/lib/multiwoven/integrations/destination/klaviyo/config/meta.json +15 -0
- data/lib/multiwoven/integrations/destination/klaviyo/config/spec.json +22 -0
- data/lib/multiwoven/integrations/destination/klaviyo/icon.svg +6 -0
- data/lib/multiwoven/integrations/destination/postgresql/client.rb +123 -0
- data/lib/multiwoven/integrations/destination/postgresql/config/meta.json +15 -0
- data/lib/multiwoven/integrations/destination/postgresql/config/spec.json +68 -0
- data/lib/multiwoven/integrations/destination/postgresql/icon.svg +20 -0
- data/lib/multiwoven/integrations/destination/salesforce_consumer_goods_cloud/client.rb +114 -0
- data/lib/multiwoven/integrations/destination/salesforce_consumer_goods_cloud/config/catalog.json +6 -0
- data/lib/multiwoven/integrations/destination/salesforce_consumer_goods_cloud/config/meta.json +16 -0
- data/lib/multiwoven/integrations/destination/salesforce_consumer_goods_cloud/config/spec.json +49 -0
- data/lib/multiwoven/integrations/destination/salesforce_consumer_goods_cloud/icon.svg +16 -0
- data/lib/multiwoven/integrations/destination/salesforce_consumer_goods_cloud/schema_helper.rb +132 -0
- data/lib/multiwoven/integrations/destination/salesforce_crm/client.rb +117 -0
- data/lib/multiwoven/integrations/destination/salesforce_crm/config/catalog.json +320 -0
- data/lib/multiwoven/integrations/destination/salesforce_crm/config/meta.json +15 -0
- data/lib/multiwoven/integrations/destination/salesforce_crm/config/spec.json +43 -0
- data/lib/multiwoven/integrations/destination/salesforce_crm/icon.svg +16 -0
- data/lib/multiwoven/integrations/destination/sftp/client.rb +133 -0
- data/lib/multiwoven/integrations/destination/sftp/config/catalog.json +16 -0
- data/lib/multiwoven/integrations/destination/sftp/config/meta.json +16 -0
- data/lib/multiwoven/integrations/destination/sftp/config/spec.json +50 -0
- data/lib/multiwoven/integrations/destination/sftp/icon.svg +1 -0
- data/lib/multiwoven/integrations/destination/slack/client.rb +114 -0
- data/lib/multiwoven/integrations/destination/slack/config/catalog.json +22 -0
- data/lib/multiwoven/integrations/destination/slack/config/meta.json +15 -0
- data/lib/multiwoven/integrations/destination/slack/config/spec.json +22 -0
- data/lib/multiwoven/integrations/destination/slack/icon.svg +26 -0
- data/lib/multiwoven/integrations/destination/stripe/client.rb +82 -0
- data/lib/multiwoven/integrations/destination/stripe/config/catalog.json +128 -0
- data/lib/multiwoven/integrations/destination/stripe/config/meta.json +15 -0
- data/lib/multiwoven/integrations/destination/stripe/config/spec.json +17 -0
- data/lib/multiwoven/integrations/destination/stripe/icon.svg +10 -0
- data/lib/multiwoven/integrations/destination/tally/client.rb +151 -0
- data/lib/multiwoven/integrations/destination/tally/config/catalog.json +62 -0
- data/lib/multiwoven/integrations/destination/tally/config/meta.json +15 -0
- data/lib/multiwoven/integrations/destination/tally/config/spec.json +45 -0
- data/lib/multiwoven/integrations/destination/tally/icon.svg +7 -0
- data/lib/multiwoven/integrations/protocol/protocol.json +189 -0
- data/lib/multiwoven/integrations/protocol/protocol.rb +216 -0
- data/lib/multiwoven/integrations/rollout.rb +32 -0
- data/lib/multiwoven/integrations/service.rb +79 -0
- data/lib/multiwoven/integrations/source/bigquery/client.rb +98 -0
- data/lib/multiwoven/integrations/source/bigquery/config/meta.json +15 -0
- data/lib/multiwoven/integrations/source/bigquery/config/spec.json +82 -0
- data/lib/multiwoven/integrations/source/bigquery/icon.svg +1 -0
- data/lib/multiwoven/integrations/source/databricks/client.rb +98 -0
- data/lib/multiwoven/integrations/source/databricks/config/meta.json +16 -0
- data/lib/multiwoven/integrations/source/databricks/config/spec.json +56 -0
- data/lib/multiwoven/integrations/source/databricks/icon.svg +19 -0
- data/lib/multiwoven/integrations/source/postgresql/client.rb +109 -0
- data/lib/multiwoven/integrations/source/postgresql/config/meta.json +15 -0
- data/lib/multiwoven/integrations/source/postgresql/config/spec.json +69 -0
- data/lib/multiwoven/integrations/source/postgresql/icon.svg +20 -0
- data/lib/multiwoven/integrations/source/redshift/client.rb +109 -0
- data/lib/multiwoven/integrations/source/redshift/config/meta.json +15 -0
- data/lib/multiwoven/integrations/source/redshift/config/spec.json +71 -0
- data/lib/multiwoven/integrations/source/redshift/icon.svg +15 -0
- data/lib/multiwoven/integrations/source/salesforce_consumer_goods_cloud/client.rb +123 -0
- data/lib/multiwoven/integrations/source/salesforce_consumer_goods_cloud/config/catalog.json +6 -0
- data/lib/multiwoven/integrations/source/salesforce_consumer_goods_cloud/config/meta.json +17 -0
- data/lib/multiwoven/integrations/source/salesforce_consumer_goods_cloud/config/spec.json +50 -0
- data/lib/multiwoven/integrations/source/salesforce_consumer_goods_cloud/icon.svg +16 -0
- data/lib/multiwoven/integrations/source/salesforce_consumer_goods_cloud/schema_helper.rb +130 -0
- data/lib/multiwoven/integrations/source/snowflake/client.rb +92 -0
- data/lib/multiwoven/integrations/source/snowflake/config/meta.json +15 -0
- data/lib/multiwoven/integrations/source/snowflake/config/spec.json +82 -0
- data/lib/multiwoven/integrations/source/snowflake/icon.svg +10 -0
- data/lib/multiwoven/integrations/source/zoho_books/client.rb +155 -0
- data/lib/multiwoven/integrations/source/zoho_books/config/meta.json +16 -0
- data/lib/multiwoven/integrations/source/zoho_books/config/spec.json +43 -0
- data/lib/multiwoven/integrations/source/zoho_books/icon.svg +16 -0
- data/lib/multiwoven/integrations.rb +71 -0
- data/multiwoven-integrations-0.1.68.gem +0 -0
- data/sig/multiwoven/integrations.rbs +6 -0
- metadata +515 -0
@@ -0,0 +1,117 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "stringio"
|
4
|
+
|
5
|
+
module Multiwoven
|
6
|
+
module Integrations
|
7
|
+
module Destination
|
8
|
+
module SalesforceCrm
|
9
|
+
include Multiwoven::Integrations::Core
|
10
|
+
|
11
|
+
API_VERSION = "59.0"
|
12
|
+
|
13
|
+
class Client < DestinationConnector
|
14
|
+
prepend Multiwoven::Integrations::Core::RateLimiter
|
15
|
+
def check_connection(connection_config)
|
16
|
+
connection_config = connection_config.with_indifferent_access
|
17
|
+
initialize_client(connection_config)
|
18
|
+
authenticate_client
|
19
|
+
success_status
|
20
|
+
rescue StandardError => e
|
21
|
+
failure_status(e)
|
22
|
+
end
|
23
|
+
|
24
|
+
def discover(_connection_config = nil)
|
25
|
+
catalog = build_catalog(load_catalog)
|
26
|
+
catalog.to_multiwoven_message
|
27
|
+
rescue StandardError => e
|
28
|
+
handle_exception("SALESFORCE:CRM:DISCOVER:EXCEPTION", "error", e)
|
29
|
+
end
|
30
|
+
|
31
|
+
def write(sync_config, records, action = "create")
|
32
|
+
@action = sync_config.stream.action || action
|
33
|
+
initialize_client(sync_config.destination.connection_specification)
|
34
|
+
process_records(records, sync_config.stream)
|
35
|
+
rescue StandardError => e
|
36
|
+
handle_exception("SALESFORCE:CRM:WRITE:EXCEPTION", "error", e)
|
37
|
+
end
|
38
|
+
|
39
|
+
private
|
40
|
+
|
41
|
+
def initialize_client(config)
|
42
|
+
config = config.with_indifferent_access
|
43
|
+
@client = Restforce.new(oauth_token: config[:access_token],
|
44
|
+
refresh_token: config[:refresh_token],
|
45
|
+
instance_url: config[:instance_url],
|
46
|
+
client_id: config[:client_id],
|
47
|
+
client_secret: config[:client_secret],
|
48
|
+
authentication_callback: proc { |x| log_debug(x.to_s) },
|
49
|
+
api_version: API_VERSION)
|
50
|
+
end
|
51
|
+
|
52
|
+
def process_records(records, stream)
|
53
|
+
write_success = 0
|
54
|
+
write_failure = 0
|
55
|
+
properties = stream.json_schema[:properties]
|
56
|
+
records.each do |record_object|
|
57
|
+
record = extract_data(record_object, properties)
|
58
|
+
process_record(stream, record)
|
59
|
+
write_success += 1
|
60
|
+
rescue StandardError => e
|
61
|
+
handle_exception("SALESFORCE:CRM:WRITE:EXCEPTION", "error", e)
|
62
|
+
write_failure += 1
|
63
|
+
end
|
64
|
+
tracking_message(write_success, write_failure)
|
65
|
+
end
|
66
|
+
|
67
|
+
def process_record(stream, record)
|
68
|
+
send_data_to_salesforce(stream.name, record)
|
69
|
+
end
|
70
|
+
|
71
|
+
def send_data_to_salesforce(stream_name, record = {})
|
72
|
+
method_name = "#{@action}!"
|
73
|
+
args = build_args(@action, stream_name, record)
|
74
|
+
@client.send(method_name, *args)
|
75
|
+
end
|
76
|
+
|
77
|
+
def build_args(action, stream_name, record)
|
78
|
+
case action
|
79
|
+
when :upsert
|
80
|
+
[stream_name, record[:external_key], record]
|
81
|
+
when :destroy
|
82
|
+
[stream_name, record[:id]]
|
83
|
+
else
|
84
|
+
[stream_name, record]
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
def authenticate_client
|
89
|
+
@client.authenticate!
|
90
|
+
end
|
91
|
+
|
92
|
+
def success_status
|
93
|
+
ConnectionStatus.new(status: ConnectionStatusType["succeeded"]).to_multiwoven_message
|
94
|
+
end
|
95
|
+
|
96
|
+
def failure_status(error)
|
97
|
+
ConnectionStatus.new(status: ConnectionStatusType["failed"], message: error.message).to_multiwoven_message
|
98
|
+
end
|
99
|
+
|
100
|
+
def load_catalog
|
101
|
+
read_json(CATALOG_SPEC_PATH)
|
102
|
+
end
|
103
|
+
|
104
|
+
def tracking_message(success, failure)
|
105
|
+
Multiwoven::Integrations::Protocol::TrackingMessage.new(
|
106
|
+
success: success, failed: failure
|
107
|
+
).to_multiwoven_message
|
108
|
+
end
|
109
|
+
|
110
|
+
def log_debug(message)
|
111
|
+
Multiwoven::Integrations::Service.logger.debug(message)
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
@@ -0,0 +1,320 @@
|
|
1
|
+
{
|
2
|
+
"request_rate_limit": 100000,
|
3
|
+
"request_rate_limit_unit": "day",
|
4
|
+
"request_rate_concurrency": 10,
|
5
|
+
"streams": [
|
6
|
+
{
|
7
|
+
"name": "Account",
|
8
|
+
"action": "create",
|
9
|
+
"json_schema": {
|
10
|
+
"type": "object",
|
11
|
+
"additionalProperties": true,
|
12
|
+
"properties": {
|
13
|
+
"Id": {
|
14
|
+
"type": "string"
|
15
|
+
},
|
16
|
+
"IsDeleted": {
|
17
|
+
"type": "boolean"
|
18
|
+
},
|
19
|
+
"MasterRecordId": {
|
20
|
+
"type": ["string", "null"]
|
21
|
+
},
|
22
|
+
"Name": {
|
23
|
+
"type": "string"
|
24
|
+
},
|
25
|
+
"Type": {
|
26
|
+
"type": ["string", "null"],
|
27
|
+
"enum": [
|
28
|
+
"Prospect",
|
29
|
+
"Customer - Direct",
|
30
|
+
"Customer - Channel",
|
31
|
+
"Channel Partner / Reseller",
|
32
|
+
"Installation Partner",
|
33
|
+
"Technology Partner",
|
34
|
+
"Other"
|
35
|
+
]
|
36
|
+
},
|
37
|
+
"ParentId": {
|
38
|
+
"type": ["string", "null"]
|
39
|
+
},
|
40
|
+
"BillingStreet": {
|
41
|
+
"type": ["string", "null"]
|
42
|
+
},
|
43
|
+
"BillingCity": {
|
44
|
+
"type": ["string", "null"]
|
45
|
+
},
|
46
|
+
"BillingState": {
|
47
|
+
"type": ["string", "null"]
|
48
|
+
},
|
49
|
+
"BillingPostalCode": {
|
50
|
+
"type": ["string", "null"]
|
51
|
+
},
|
52
|
+
"BillingCountry": {
|
53
|
+
"type": ["string", "null"]
|
54
|
+
},
|
55
|
+
"BillingLatitude": {
|
56
|
+
"type": ["number", "null"]
|
57
|
+
},
|
58
|
+
"BillingLongitude": {
|
59
|
+
"type": ["number", "null"]
|
60
|
+
},
|
61
|
+
"BillingGeocodeAccuracy": {
|
62
|
+
"type": ["string", "null"],
|
63
|
+
"enum": [
|
64
|
+
"Address",
|
65
|
+
"NearAddress",
|
66
|
+
"Block",
|
67
|
+
"Street",
|
68
|
+
"ExtendedZip",
|
69
|
+
"Zip",
|
70
|
+
"Neighborhood",
|
71
|
+
"City",
|
72
|
+
"County",
|
73
|
+
"State",
|
74
|
+
"Unknown"
|
75
|
+
]
|
76
|
+
},
|
77
|
+
"BillingAddress": {
|
78
|
+
"type": ["string", "null"],
|
79
|
+
"enum": [
|
80
|
+
"Address",
|
81
|
+
"NearAddress",
|
82
|
+
"Block",
|
83
|
+
"Street",
|
84
|
+
"ExtendedZip",
|
85
|
+
"Zip",
|
86
|
+
"Neighborhood",
|
87
|
+
"City",
|
88
|
+
"County",
|
89
|
+
"State",
|
90
|
+
"Unknown"
|
91
|
+
]
|
92
|
+
},
|
93
|
+
"ShippingStreet": {
|
94
|
+
"type": ["string", "null"]
|
95
|
+
},
|
96
|
+
"ShippingCity": {
|
97
|
+
"type": ["string", "null"]
|
98
|
+
},
|
99
|
+
"ShippingState": {
|
100
|
+
"type": ["string", "null"]
|
101
|
+
},
|
102
|
+
"ShippingPostalCode": {
|
103
|
+
"type": ["string", "null"]
|
104
|
+
},
|
105
|
+
"ShippingCountry": {
|
106
|
+
"type": ["string", "null"]
|
107
|
+
},
|
108
|
+
"ShippingLatitude": {
|
109
|
+
"type": ["number", "null"]
|
110
|
+
},
|
111
|
+
"ShippingLongitude": {
|
112
|
+
"type": ["number", "null"]
|
113
|
+
},
|
114
|
+
"ShippingGeocodeAccuracy": {
|
115
|
+
"type": ["string", "null"]
|
116
|
+
},
|
117
|
+
"ShippingAddress": {
|
118
|
+
"type": ["string", "null"]
|
119
|
+
},
|
120
|
+
"Phone": {
|
121
|
+
"type": ["string", "null"]
|
122
|
+
},
|
123
|
+
"Fax": {
|
124
|
+
"type": ["string", "null"]
|
125
|
+
},
|
126
|
+
"AccountNumber": {
|
127
|
+
"type": ["string", "null"]
|
128
|
+
},
|
129
|
+
"Website": {
|
130
|
+
"type": ["string", "null"],
|
131
|
+
"format": "uri"
|
132
|
+
},
|
133
|
+
"PhotoUrl": {
|
134
|
+
"type": ["string", "null"],
|
135
|
+
"format": "uri"
|
136
|
+
},
|
137
|
+
"Sic": {
|
138
|
+
"type": ["string", "null"]
|
139
|
+
},
|
140
|
+
"Industry": {
|
141
|
+
"type": ["string", "null"],
|
142
|
+
"enum": [
|
143
|
+
"Agriculture",
|
144
|
+
"Apparel",
|
145
|
+
"Banking",
|
146
|
+
"Biotechnology",
|
147
|
+
"Chemicals",
|
148
|
+
"Communications",
|
149
|
+
"Construction",
|
150
|
+
"Consulting",
|
151
|
+
"Education",
|
152
|
+
"Electronics",
|
153
|
+
"Energy",
|
154
|
+
"Engineering",
|
155
|
+
"Entertainment",
|
156
|
+
"Environmental",
|
157
|
+
"Finance",
|
158
|
+
"Food & Beverage",
|
159
|
+
"Government",
|
160
|
+
"Healthcare",
|
161
|
+
"Hospitality",
|
162
|
+
"Insurance",
|
163
|
+
"Machinery",
|
164
|
+
"Manufacturing",
|
165
|
+
"Media",
|
166
|
+
"Not For Profit",
|
167
|
+
"Recreation",
|
168
|
+
"Retail",
|
169
|
+
"Shipping",
|
170
|
+
"Technology",
|
171
|
+
"Telecommunications",
|
172
|
+
"Transportation",
|
173
|
+
"Utilities",
|
174
|
+
"Other"
|
175
|
+
]
|
176
|
+
},
|
177
|
+
"AnnualRevenue": {
|
178
|
+
"type": ["number", "null"]
|
179
|
+
},
|
180
|
+
"NumberOfEmployees": {
|
181
|
+
"type": ["integer", "null"]
|
182
|
+
},
|
183
|
+
"Ownership": {
|
184
|
+
"type": ["string", "null"],
|
185
|
+
"enum": ["Public", "Private", "Subsidiary", "Other"]
|
186
|
+
},
|
187
|
+
"TickerSymbol": {
|
188
|
+
"type": ["string", "null"]
|
189
|
+
},
|
190
|
+
"Description": {
|
191
|
+
"type": ["string", "null"]
|
192
|
+
},
|
193
|
+
"Rating": {
|
194
|
+
"type": ["string", "null"],
|
195
|
+
"enum": ["Hot", "Warm", "Cold"]
|
196
|
+
},
|
197
|
+
"Site": {
|
198
|
+
"type": ["string", "null"]
|
199
|
+
},
|
200
|
+
"OwnerId": {
|
201
|
+
"type": "string"
|
202
|
+
},
|
203
|
+
"CreatedDate": {
|
204
|
+
"type": "string",
|
205
|
+
"format": "date-time"
|
206
|
+
},
|
207
|
+
"CreatedById": {
|
208
|
+
"type": "string"
|
209
|
+
},
|
210
|
+
"LastModifiedDate": {
|
211
|
+
"type": "string",
|
212
|
+
"format": "date-time"
|
213
|
+
},
|
214
|
+
"LastModifiedById": {
|
215
|
+
"type": "string"
|
216
|
+
},
|
217
|
+
"SystemModstamp": {
|
218
|
+
"type": "string",
|
219
|
+
"format": "date-time"
|
220
|
+
},
|
221
|
+
"LastActivityDate": {
|
222
|
+
"type": ["string", "null"],
|
223
|
+
"format": "date"
|
224
|
+
},
|
225
|
+
"LastViewedDate": {
|
226
|
+
"type": ["string", "null"],
|
227
|
+
"format": "date-time"
|
228
|
+
},
|
229
|
+
"LastReferencedDate": {
|
230
|
+
"type": ["string", "null"],
|
231
|
+
"format": "date-time"
|
232
|
+
},
|
233
|
+
"Jigsaw": {
|
234
|
+
"type": ["string", "null"]
|
235
|
+
},
|
236
|
+
"JigsawCompanyId": {
|
237
|
+
"type": ["string", "null"]
|
238
|
+
},
|
239
|
+
"CleanStatus": {
|
240
|
+
"type": ["string", "null"],
|
241
|
+
"enum": [
|
242
|
+
"In Sync",
|
243
|
+
"Different",
|
244
|
+
"Reviewed",
|
245
|
+
"Not Found",
|
246
|
+
"Inactive",
|
247
|
+
"Not Compared",
|
248
|
+
"Select Match",
|
249
|
+
"Skipped"
|
250
|
+
]
|
251
|
+
},
|
252
|
+
"AccountSource": {
|
253
|
+
"type": ["string", "null"],
|
254
|
+
"enum": [
|
255
|
+
"Web",
|
256
|
+
"Phone Inquiry",
|
257
|
+
"Partner Referral",
|
258
|
+
"Purchased List",
|
259
|
+
"Other"
|
260
|
+
]
|
261
|
+
},
|
262
|
+
"DunsNumber": {
|
263
|
+
"type": ["string", "null"]
|
264
|
+
},
|
265
|
+
"Tradestyle": {
|
266
|
+
"type": ["string", "null"]
|
267
|
+
},
|
268
|
+
"NaicsCode": {
|
269
|
+
"type": ["string", "null"]
|
270
|
+
},
|
271
|
+
"NaicsDesc": {
|
272
|
+
"type": ["string", "null"]
|
273
|
+
},
|
274
|
+
"YearStarted": {
|
275
|
+
"type": ["string", "null"]
|
276
|
+
},
|
277
|
+
"SicDesc": {
|
278
|
+
"type": ["string", "null"]
|
279
|
+
},
|
280
|
+
"DandbCompanyId": {
|
281
|
+
"type": ["string", "null"]
|
282
|
+
},
|
283
|
+
"OperatingHoursId": {
|
284
|
+
"type": ["string", "null"]
|
285
|
+
},
|
286
|
+
"CustomerPriority__c": {
|
287
|
+
"type": ["string", "null"],
|
288
|
+
"enum": ["High", "Low", "Medium"]
|
289
|
+
},
|
290
|
+
"SLA__c": {
|
291
|
+
"type": ["string", "null"],
|
292
|
+
"enum": ["Gold", "Silver", "Platinum", "Bronze"]
|
293
|
+
},
|
294
|
+
"Active__c": {
|
295
|
+
"type": ["string", "null"],
|
296
|
+
"enum": ["Yes", "No"]
|
297
|
+
},
|
298
|
+
"NumberofLocations__c": {
|
299
|
+
"type": ["number", "null"]
|
300
|
+
},
|
301
|
+
"UpsellOpportunity__c": {
|
302
|
+
"type": ["string", "null"],
|
303
|
+
"enum": ["Yes", "No", "Maybe"]
|
304
|
+
},
|
305
|
+
"SLASerialNumber__c": {
|
306
|
+
"type": ["string", "null"]
|
307
|
+
},
|
308
|
+
"SLAExpirationDate__c": {
|
309
|
+
"type": ["string", "null"],
|
310
|
+
"format": "date"
|
311
|
+
}
|
312
|
+
}
|
313
|
+
},
|
314
|
+
"supported_sync_modes": ["incremental"],
|
315
|
+
"source_defined_cursor": true,
|
316
|
+
"default_cursor_field": ["updated"],
|
317
|
+
"source_defined_primary_key": [["Id"]]
|
318
|
+
}
|
319
|
+
]
|
320
|
+
}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
{
|
2
|
+
"data": {
|
3
|
+
"name": "SalesforceCrm",
|
4
|
+
"title": "Salesforce CRM",
|
5
|
+
"connector_type": "destination",
|
6
|
+
"category": "CRM",
|
7
|
+
"documentation_url": "https://docs.mutliwoven.com",
|
8
|
+
"github_issue_label": "destination-salesforce-crm",
|
9
|
+
"icon": "icon.svg",
|
10
|
+
"license": "MIT",
|
11
|
+
"release_stage": "alpha",
|
12
|
+
"support_level": "community",
|
13
|
+
"tags": ["language:ruby", "multiwoven"]
|
14
|
+
}
|
15
|
+
}
|
@@ -0,0 +1,43 @@
|
|
1
|
+
{
|
2
|
+
"documentation_url": "https://docs.multiwoven.com/integrations/destination/salesforce_crm",
|
3
|
+
"stream_type": "static",
|
4
|
+
"connection_specification": {
|
5
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
6
|
+
"title": "Salesforce CRM",
|
7
|
+
"type": "object",
|
8
|
+
"required": [
|
9
|
+
"access_token",
|
10
|
+
"refresh_token",
|
11
|
+
"instance_url",
|
12
|
+
"client_id",
|
13
|
+
"client_secret"
|
14
|
+
],
|
15
|
+
"properties": {
|
16
|
+
"access_token": {
|
17
|
+
"type": "string",
|
18
|
+
"title": "Access Token",
|
19
|
+
"order": 0
|
20
|
+
},
|
21
|
+
"refresh_token": {
|
22
|
+
"type": "string",
|
23
|
+
"title": "Refresh Token",
|
24
|
+
"order": 1
|
25
|
+
},
|
26
|
+
"instance_url": {
|
27
|
+
"type": "string",
|
28
|
+
"title": "Instance URL",
|
29
|
+
"order": 2
|
30
|
+
},
|
31
|
+
"client_id": {
|
32
|
+
"type": "string",
|
33
|
+
"title": "Client ID",
|
34
|
+
"order": 3
|
35
|
+
},
|
36
|
+
"client_secret": {
|
37
|
+
"type": "string",
|
38
|
+
"title": "Client Secret",
|
39
|
+
"order": 4
|
40
|
+
}
|
41
|
+
}
|
42
|
+
}
|
43
|
+
}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<svg width="1021" height="716" viewBox="0 0 1021 716" fill="none" xmlns="http://www.w3.org/2000/svg">
|
2
|
+
<mask id="mask0_1_78" style="mask-type:luminance" maskUnits="userSpaceOnUse" x="0" y="0" width="1021" height="716">
|
3
|
+
<path d="M0.225052 0.875458H1020.86V715.2H0.225052V0.875458Z" fill="white" />
|
4
|
+
</mask>
|
5
|
+
<g mask="url(#mask0_1_78)">
|
6
|
+
<path fill-rule="evenodd" clip-rule="evenodd"
|
7
|
+
d="M424.821 78.8082C457.743 44.5099 503.583 23.2272 554.277 23.2272C621.662 23.2272 680.461 60.8038 711.763 116.595C739.77 104.08 770.107 97.6302 800.783 97.6678C922.328 97.6678 1020.86 197.063 1020.86 319.681C1020.86 442.298 922.328 541.698 800.783 541.698C785.941 541.698 771.447 540.205 757.426 537.376C729.861 586.547 677.31 619.777 617.011 619.777C592.621 619.81 568.546 614.269 546.625 603.576C518.68 669.326 453.549 715.425 377.665 715.425C298.622 715.425 231.255 665.418 205.415 595.283C193.898 597.713 182.159 598.935 170.389 598.929C76.2824 598.929 0 521.848 0 426.766C0 363.038 34.2684 307.4 85.2021 277.637C74.4107 252.788 68.8576 225.981 68.8893 198.89C68.8893 89.5321 157.662 0.875458 267.166 0.875458C331.457 0.875458 388.595 31.4379 424.821 78.8082Z"
|
8
|
+
fill="#00A1E0" />
|
9
|
+
</g>
|
10
|
+
<path fill-rule="evenodd" clip-rule="evenodd"
|
11
|
+
d="M147.861 371.425C147.22 373.098 148.09 373.446 148.296 373.743C150.213 375.131 152.16 376.136 154.125 377.265C164.534 382.775 174.373 384.392 184.65 384.392C205.591 384.392 218.6 373.259 218.6 355.33V354.977C218.6 338.398 203.915 332.374 190.153 328.027L188.356 327.445C177.977 324.077 169.02 321.162 169.02 314.324V313.976C169.02 308.12 174.256 303.818 182.37 303.818C191.39 303.818 202.081 306.815 208.975 310.622C208.975 310.622 211.008 311.935 211.747 309.973C212.148 308.912 215.633 299.527 216.004 298.511C216.402 297.412 215.704 296.583 214.987 296.155C207.114 291.358 196.24 288.094 184.984 288.094L182.895 288.102C163.727 288.102 150.344 299.692 150.344 316.279V316.635C150.344 334.114 165.108 339.797 178.937 343.747L181.158 344.437C191.229 347.528 199.928 350.198 199.928 357.284V357.636C199.928 364.125 194.275 368.945 185.171 368.945C181.642 368.945 170.374 368.885 158.199 361.185C156.725 360.326 155.884 359.707 154.748 359.013C154.148 358.649 152.647 357.993 151.995 359.958L147.861 371.425ZM454.423 371.425C453.782 373.098 454.652 373.446 454.866 373.743C456.775 375.131 458.726 376.136 460.687 377.265C471.1 382.775 480.939 384.392 491.212 384.392C512.154 384.392 525.166 373.259 525.166 355.33V354.977C525.166 338.398 510.485 332.374 496.719 328.027L494.922 327.445C484.543 324.077 475.582 321.162 475.582 314.324V313.976C475.582 308.12 480.822 303.818 488.939 303.818C497.957 303.818 508.643 306.815 515.537 310.622C515.537 310.622 517.57 311.935 518.313 309.973C518.71 308.912 522.199 299.527 522.566 298.511C522.968 297.412 522.266 296.583 521.554 296.155C513.677 291.358 502.806 288.094 491.55 288.094L489.457 288.102C470.294 288.102 456.91 299.692 456.91 316.279V316.635C456.91 334.114 471.67 339.797 485.504 343.747L487.72 344.437C497.795 347.528 506.494 350.198 506.494 357.284V357.636C506.494 364.125 500.837 368.945 491.741 368.945C488.204 368.945 476.936 368.885 464.765 361.185C463.291 360.326 462.428 359.733 461.31 359.013C460.931 358.773 459.165 358.083 458.561 359.958L454.423 371.425ZM663.706 336.301C663.706 346.429 661.815 354.426 658.102 360.063C654.411 365.652 648.841 368.371 641.073 368.371C633.305 368.371 627.764 365.656 624.134 360.071C620.469 354.429 618.608 346.429 618.608 336.301C618.608 326.181 620.469 318.21 624.134 312.629C627.764 307.096 633.305 304.411 641.073 304.411C648.841 304.411 654.411 307.1 658.102 312.633C661.823 318.21 663.706 326.181 663.706 336.301ZM681.192 317.52C679.471 311.71 676.796 306.598 673.237 302.333C669.67 298.057 665.157 294.617 659.809 292.127C654.467 289.632 648.166 288.368 641.073 288.368C633.98 288.368 627.674 289.632 622.329 292.127C616.988 294.617 612.472 298.057 608.905 302.34C605.349 306.613 602.667 311.718 600.953 317.52C599.246 323.285 598.38 329.606 598.38 336.301C598.38 343 599.246 349.324 600.953 355.082C602.667 360.881 605.341 365.99 608.909 370.269C612.476 374.553 617.003 377.963 622.337 380.393C627.686 382.824 633.987 384.062 641.073 384.062C648.162 384.062 654.456 382.824 659.801 380.393C665.142 377.963 669.662 374.553 673.237 370.269C676.796 366.005 679.471 360.888 681.192 355.082C682.895 349.313 683.762 342.993 683.762 336.301C683.762 329.613 682.895 323.289 681.192 317.52ZM824.729 365.66C824.155 363.96 822.497 364.602 822.497 364.602C819.958 365.573 817.257 366.473 814.369 366.924C811.458 367.381 808.236 367.61 804.789 367.61C796.338 367.61 789.605 365.093 784.8 360.119C779.973 355.142 777.261 347.1 777.291 336.222C777.317 326.335 779.71 318.886 784.001 313.207C788.255 307.565 794.751 304.67 803.39 304.67C810.603 304.67 816.105 305.506 821.871 307.314C821.871 307.314 823.24 307.91 823.896 306.106C825.43 301.856 826.563 298.833 828.198 294.163C828.663 292.832 827.523 292.269 827.107 292.108C824.841 291.223 819.489 289.771 815.449 289.16C811.672 288.582 807.257 288.282 802.332 288.282C794.992 288.282 788.446 289.538 782.85 292.029C777.265 294.516 772.527 297.952 768.773 302.224C765.018 306.504 762.16 311.616 760.269 317.415C758.375 323.184 757.419 329.516 757.419 336.23C757.419 350.727 761.331 362.441 769.046 371.023C776.788 379.635 788.401 384.009 803.559 384.009C812.512 384.009 821.698 382.197 828.315 379.594C828.315 379.594 829.575 378.987 829.027 377.516L824.729 365.66ZM855.314 326.59C856.15 320.96 857.692 316.282 860.096 312.629C863.723 307.096 869.245 304.047 877.013 304.047C884.785 304.047 889.905 307.1 893.596 312.633C896.034 316.29 897.099 321.162 897.515 326.597L855.314 326.59ZM914.162 314.223C912.673 308.619 909.004 302.959 906.593 300.371C902.785 296.268 899.057 293.394 895.355 291.808C889.997 289.531 884.234 288.361 878.412 288.368C871.026 288.368 864.316 289.617 858.873 292.168C853.423 294.726 848.843 298.222 845.254 302.565C841.657 306.905 838.96 312.07 837.238 317.929C835.513 323.754 834.642 330.105 834.642 336.811C834.642 343.63 835.546 349.988 837.324 355.705C839.121 361.47 842.006 366.53 845.899 370.742C849.789 374.969 854.796 378.285 860.779 380.596C866.732 382.902 873.963 384.099 882.257 384.073C899.353 384.017 908.344 380.206 912.058 378.154C912.714 377.786 913.333 377.152 912.56 375.326L908.689 364.493C908.097 362.876 906.461 363.461 906.461 363.461C902.219 365.044 896.214 367.869 882.17 367.839C872.996 367.824 866.199 365.112 861.927 360.877C857.557 356.545 855.411 350.183 855.047 341.196L914.207 341.241C914.207 341.241 915.767 341.226 915.929 339.703C915.992 339.073 917.958 327.55 914.162 314.223ZM381.427 326.59C382.263 320.96 383.809 316.282 386.209 312.629C389.84 307.096 395.354 304.047 403.13 304.047C410.902 304.047 416.022 307.1 419.712 312.633C422.147 316.29 423.212 321.162 423.628 326.597L381.427 326.59ZM440.275 314.223C438.79 308.619 435.117 302.959 432.709 300.371C428.902 296.268 425.178 293.394 421.472 291.808C416.113 289.532 410.35 288.362 404.529 288.368C397.143 288.368 390.433 289.617 384.99 292.168C379.54 294.726 374.96 298.222 371.363 302.565C367.774 306.905 365.077 312.07 363.347 317.929C361.626 323.754 360.759 330.105 360.759 336.811C360.759 343.63 361.656 349.988 363.445 355.705C365.238 361.47 368.126 366.53 372.012 370.742C375.906 374.969 380.909 378.285 386.892 380.596C392.848 382.902 400.073 384.099 408.373 384.073C425.466 384.017 434.461 380.206 438.174 378.154C438.827 377.786 439.45 377.152 438.673 375.326L434.806 364.493C434.21 362.876 432.574 363.461 432.574 363.461C428.336 365.044 422.331 367.869 408.283 367.839C399.112 367.824 392.312 365.112 388.04 360.877C383.674 356.545 381.524 350.183 381.161 341.196L440.324 341.241C440.324 341.241 441.884 341.226 442.045 339.703C442.109 339.073 444.075 327.55 440.275 314.223ZM253.532 365.337C251.21 363.484 250.887 363.03 250.119 361.826C248.945 360.014 248.344 357.434 248.344 354.129C248.344 348.934 250.07 345.191 253.626 342.678C253.588 342.685 258.727 338.244 270.786 338.402C276.166 338.497 281.533 338.955 286.851 339.771V366.665H286.859C286.859 366.665 279.338 368.281 270.872 368.792C258.839 369.515 253.494 365.326 253.532 365.337ZM277.076 323.754C274.676 323.578 271.566 323.492 267.838 323.492C262.77 323.492 257.868 324.122 253.266 325.36C248.644 326.605 244.488 328.533 240.914 331.087C237.341 333.639 234.404 336.979 232.328 340.847C230.231 344.752 229.162 349.339 229.162 354.482C229.162 359.729 230.074 364.275 231.874 367.989C233.636 371.671 236.287 374.855 239.59 377.254C242.879 379.647 246.938 381.402 251.645 382.475C256.293 383.536 261.559 384.073 267.313 384.073C273.389 384.073 279.432 383.563 285.287 382.576C290.275 381.717 295.243 380.751 300.19 379.68C302.163 379.227 304.338 378.63 304.338 378.63C305.801 378.259 305.688 376.695 305.688 376.695L305.655 322.584C305.655 310.716 302.489 301.924 296.251 296.463C290.043 291.028 280.902 288.282 269.076 288.282C264.635 288.282 257.5 288.882 253.217 289.741C253.217 289.741 240.299 292.247 234.98 296.414C234.98 296.414 233.81 297.134 234.447 298.766L238.637 310.018C239.158 311.478 240.58 310.979 240.58 310.979C240.58 310.979 241.026 310.802 241.551 310.491C252.932 304.302 267.332 304.486 267.332 304.486C273.723 304.486 278.648 305.78 281.956 308.312C285.186 310.791 286.825 314.523 286.825 322.411V324.913C281.75 324.178 277.076 323.754 277.076 323.754ZM754.324 293.271C754.409 293.073 754.454 292.86 754.455 292.644C754.457 292.429 754.414 292.216 754.332 292.017C754.249 291.818 754.126 291.638 753.972 291.487C753.818 291.337 753.636 291.219 753.435 291.14C752.426 290.757 747.396 289.696 743.518 289.456C736.08 288.991 731.957 290.244 728.259 291.909C724.591 293.563 720.528 296.238 718.263 299.287L718.255 292.07C718.255 291.08 717.554 290.281 716.556 290.281H701.387C700.405 290.281 699.692 291.08 699.692 292.07V380.337C699.693 380.813 699.883 381.269 700.219 381.606C700.556 381.943 701.013 382.133 701.489 382.134H717.036C717.512 382.133 717.968 381.943 718.304 381.606C718.64 381.269 718.829 380.813 718.829 380.337V336.245C718.829 330.322 719.482 324.422 720.783 320.712C722.066 317.04 723.81 314.114 725.971 312.01C728.018 309.979 730.524 308.471 733.278 307.614C735.858 306.874 738.53 306.497 741.215 306.496C744.309 306.496 747.715 307.292 747.715 307.292C748.855 307.419 749.489 306.721 749.876 305.694C750.892 302.989 753.773 294.884 754.324 293.271Z"
|
12
|
+
fill="#FFFFFE" />
|
13
|
+
<path fill-rule="evenodd" clip-rule="evenodd"
|
14
|
+
d="M608.402 252.367C606.483 251.787 604.53 251.323 602.555 250.979C599.897 250.536 597.206 250.327 594.513 250.356C583.811 250.356 575.375 253.38 569.453 259.351C563.571 265.278 559.569 274.306 557.562 286.185L556.838 290.195H543.406C543.406 290.195 541.767 290.127 541.422 291.917L539.217 304.22C539.063 305.397 539.569 306.132 541.145 306.125H554.22L540.953 380.179C539.914 386.143 538.725 391.049 537.409 394.767C536.111 398.435 534.843 401.184 533.283 403.18C531.771 405.112 530.338 406.533 527.866 407.362C525.826 408.049 523.478 408.364 520.905 408.364C519.472 408.364 517.566 408.124 516.16 407.842C514.753 407.565 514.022 407.25 512.968 406.807C512.968 406.807 511.434 406.222 510.83 407.76C510.338 409.016 506.854 418.6 506.441 419.785C506.021 420.956 506.61 421.878 507.353 422.145C509.093 422.767 510.387 423.165 512.758 423.724C516.051 424.5 518.827 424.549 521.426 424.549C526.872 424.549 531.835 423.784 535.95 422.298C540.091 420.802 543.695 418.195 546.884 414.665C550.331 410.858 552.499 406.871 554.573 401.432C556.625 396.042 558.373 389.35 559.772 381.552L573.102 306.125H592.592C592.592 306.125 594.235 306.185 594.576 304.403L596.782 292.1C596.936 290.923 596.433 290.187 594.85 290.195H575.934C576.028 289.767 576.887 283.113 579.059 276.849C579.985 274.175 581.73 272.018 583.207 270.536C584.587 269.125 586.287 268.068 588.162 267.453C590.218 266.817 592.361 266.509 594.513 266.538C596.294 266.538 598.042 266.752 599.374 267.029C601.208 267.419 601.921 267.626 602.401 267.768C604.329 268.357 604.588 267.787 604.966 266.853L609.49 254.43C609.955 253.095 608.822 252.532 608.402 252.367ZM344.06 380.337C344.06 381.327 343.355 382.134 342.365 382.134H326.675C325.681 382.134 324.976 381.327 324.976 380.337V254.051C324.976 253.065 325.681 252.266 326.675 252.266H342.365C343.355 252.266 344.06 253.065 344.06 254.051V380.337Z"
|
15
|
+
fill="#FFFFFE" />
|
16
|
+
</svg>
|
@@ -0,0 +1,133 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Multiwoven::Integrations::Destination
|
4
|
+
module Sftp
|
5
|
+
include Multiwoven::Integrations::Core
|
6
|
+
class Client < DestinationConnector # rubocop:disable Metrics/ClassLength
|
7
|
+
prepend Multiwoven::Integrations::Core::Fullrefresher
|
8
|
+
prepend Multiwoven::Integrations::Core::RateLimiter
|
9
|
+
|
10
|
+
def check_connection(connection_config)
|
11
|
+
connection_config = connection_config.with_indifferent_access
|
12
|
+
with_sftp_client(connection_config) do |sftp|
|
13
|
+
stream = SecureRandom.uuid
|
14
|
+
test_path = "#{connection_config[:destination_path]}/#{stream}"
|
15
|
+
test_file_operations(sftp, test_path)
|
16
|
+
return success_status
|
17
|
+
end
|
18
|
+
rescue StandardError => e
|
19
|
+
handle_exception("SFTP:CHECK_CONNECTION:EXCEPTION", "error", e)
|
20
|
+
failure_status(e)
|
21
|
+
end
|
22
|
+
|
23
|
+
def discover(_connection_config = nil)
|
24
|
+
catalog_json = read_json(CATALOG_SPEC_PATH)
|
25
|
+
|
26
|
+
catalog = build_catalog(catalog_json)
|
27
|
+
|
28
|
+
catalog.to_multiwoven_message
|
29
|
+
rescue StandardError => e
|
30
|
+
handle_exception(
|
31
|
+
"SFTP:DISCOVER:EXCEPTION",
|
32
|
+
"error",
|
33
|
+
e
|
34
|
+
)
|
35
|
+
end
|
36
|
+
|
37
|
+
def write(sync_config, records, _action = "insert")
|
38
|
+
connection_config = sync_config.destination.connection_specification.with_indifferent_access
|
39
|
+
file_path = generate_file_path(sync_config)
|
40
|
+
local_file_name = generate_local_file_name(sync_config)
|
41
|
+
csv_content = generate_csv_content(records)
|
42
|
+
write_success = 0
|
43
|
+
write_failure = 0
|
44
|
+
|
45
|
+
Tempfile.create([local_file_name, ".csv"]) do |tempfile|
|
46
|
+
tempfile.write(csv_content)
|
47
|
+
tempfile.close
|
48
|
+
with_sftp_client(connection_config) do |sftp|
|
49
|
+
sftp.upload!(tempfile.path, file_path)
|
50
|
+
write_success += records.size
|
51
|
+
rescue StandardError => e
|
52
|
+
handle_exception("SFTP:RECORD:WRITE:EXCEPTION", "error", e)
|
53
|
+
write_failure += records.size
|
54
|
+
end
|
55
|
+
end
|
56
|
+
tracking_message(write_success, write_failure)
|
57
|
+
rescue StandardError => e
|
58
|
+
handle_exception(
|
59
|
+
"SFTP:WRITE:EXCEPTION",
|
60
|
+
"error",
|
61
|
+
e
|
62
|
+
)
|
63
|
+
end
|
64
|
+
|
65
|
+
def clear_all_records(sync_config)
|
66
|
+
connection_specification = sync_config.destination.connection_specification.with_indifferent_access
|
67
|
+
with_sftp_client(connection_specification) do |sftp|
|
68
|
+
files = sftp.dir.glob(connection_specification[:destination_path], "*")
|
69
|
+
files.each do |file|
|
70
|
+
sftp.remove!(File.join(connection_specification[:destination_path], file.name))
|
71
|
+
end
|
72
|
+
return control_message("Successfully cleared data.", "succeeded") if sftp.dir.entries(connection_specification[:destination_path]).size <= 2
|
73
|
+
|
74
|
+
return control_message("Failed to clear data.", "failed")
|
75
|
+
end
|
76
|
+
rescue StandardError => e
|
77
|
+
control_message(e.message, "failed")
|
78
|
+
end
|
79
|
+
|
80
|
+
private
|
81
|
+
|
82
|
+
def generate_file_path(sync_config)
|
83
|
+
connection_specification = sync_config.destination.connection_specification.with_indifferent_access
|
84
|
+
timestamp = Time.now.strftime("%Y%m%d-%H%M%S")
|
85
|
+
file_name = "#{connection_specification[:file_name]}_#{timestamp}.csv"
|
86
|
+
File.join(connection_specification[:destination_path], file_name)
|
87
|
+
end
|
88
|
+
|
89
|
+
def generate_local_file_name(sync_config)
|
90
|
+
connection_specification = sync_config.destination.connection_specification.with_indifferent_access
|
91
|
+
timestamp = Time.now.strftime("%Y%m%d-%H%M%S")
|
92
|
+
"#{connection_specification[:file_name]}_#{timestamp}"
|
93
|
+
end
|
94
|
+
|
95
|
+
def generate_csv_content(records)
|
96
|
+
CSV.generate do |csv|
|
97
|
+
headers = records.first.keys
|
98
|
+
csv << headers
|
99
|
+
records.each { |record| csv << record.values_at(*headers) }
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
def tracking_message(success, failure)
|
104
|
+
Multiwoven::Integrations::Protocol::TrackingMessage.new(
|
105
|
+
success: success, failed: failure
|
106
|
+
).to_multiwoven_message
|
107
|
+
end
|
108
|
+
|
109
|
+
def with_sftp_client(connection_config, &block)
|
110
|
+
Net::SFTP.start(
|
111
|
+
connection_config[:host],
|
112
|
+
connection_config[:username],
|
113
|
+
password: connection_config[:password],
|
114
|
+
port: connection_config.fetch(:port, 22), &block
|
115
|
+
)
|
116
|
+
end
|
117
|
+
|
118
|
+
def test_file_operations(sftp, test_path)
|
119
|
+
sftp.file.open(test_path, "w") { |file| file.puts("connection_check") }
|
120
|
+
sftp.remove!(test_path)
|
121
|
+
end
|
122
|
+
|
123
|
+
def control_message(message, status)
|
124
|
+
ControlMessage.new(
|
125
|
+
type: "full_refresh",
|
126
|
+
emitted_at: Time.now.to_i,
|
127
|
+
status: ConnectionStatusType[status],
|
128
|
+
meta: { detail: message }
|
129
|
+
).to_multiwoven_message
|
130
|
+
end
|
131
|
+
end
|
132
|
+
end
|
133
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
{
|
2
|
+
"request_rate_limit": 600,
|
3
|
+
"request_rate_limit_unit": "minute",
|
4
|
+
"request_rate_concurrency": 10,
|
5
|
+
"schema_mode": "schemaless",
|
6
|
+
"streams": [
|
7
|
+
{
|
8
|
+
"name": "sftp",
|
9
|
+
"batch_support": true,
|
10
|
+
"batch_size": 100000,
|
11
|
+
"action": "create",
|
12
|
+
"json_schema": {},
|
13
|
+
"supported_sync_modes": ["full_refresh","incremental"]
|
14
|
+
}
|
15
|
+
]
|
16
|
+
}
|