multiwoven-integrations 0.1.64 → 0.1.65

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
  SHA256:
3
- metadata.gz: a04192999a6c02ae4dd3cf752c22f602d9ed196e3a293f67c53727b89ec0ce3a
4
- data.tar.gz: 955cab0486157d96c00ba540de776dd9d32687366ddd260bfa4e9a81c95e017d
3
+ metadata.gz: 11fafa89e8f7adc1648906c3fa57fecb422d64a502d829e5fd437f7ed48169a2
4
+ data.tar.gz: fc3646918312c3293349d47598f1067f17a8614b0f6dc926c05f581642098d30
5
5
  SHA512:
6
- metadata.gz: 30a2e1bbd87278e54f40ce5c8d07630d4b4e4b3a1b7f077c5f1bfdf9e00d37dd402bbe3fbcfa477cf7fd331929a9f2e41d8506e7ac9388e3403ae73e2b474be3
7
- data.tar.gz: 77840062ae81f7efa968919d7377a0e324c6b7720ffe3f237996a55c850e8f7dc68f2a241086780ea4d22d66a2b3c3a5d57e3045aa6c921a909d6e2a36584acc
6
+ metadata.gz: e885c02a7fce0cd2032b2874a4ca0c0967f358e4a45ebf7b70d2c0211f75772e76432c9b8d9968d0bcd46d5d00c466d920043660ac3d9ce9db6f35722d9b4d23
7
+ data.tar.gz: af7ef1ee3ab3c78c2378a0635d35acaaed0a0cbaa36a146391844bb1ca1fd436a0494ea0a96178b57cb03ee3bcc6ca377a4698ee85b29de222a14473c9db5890
@@ -0,0 +1,95 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Multiwoven
4
+ module Integrations
5
+ module Destination
6
+ module Http
7
+ include Multiwoven::Integrations::Core
8
+ class Client < DestinationConnector
9
+ MAX_CHUNK_SIZE = 10
10
+ def check_connection(connection_config)
11
+ connection_config = connection_config.with_indifferent_access
12
+ destination_url = connection_config[:destination_url]
13
+ headers = connection_config[:headers]
14
+ request = Multiwoven::Integrations::Core::HttpClient.request(
15
+ destination_url,
16
+ HTTP_POST,
17
+ payload: {},
18
+ headers: headers
19
+ )
20
+ if success?(request)
21
+ success_status
22
+ else
23
+ failure_status(nil)
24
+ end
25
+ rescue StandardError => e
26
+ handle_exception("HTTP:CHECK_CONNECTION:EXCEPTION", "error", e)
27
+ failure_status(e)
28
+ end
29
+
30
+ def discover(_connection_config = nil)
31
+ catalog_json = read_json(CATALOG_SPEC_PATH)
32
+ catalog = build_catalog(catalog_json)
33
+ catalog.to_multiwoven_message
34
+ rescue StandardError => e
35
+ handle_exception(
36
+ "HTTP:DISCOVER:EXCEPTION",
37
+ "error",
38
+ e
39
+ )
40
+ end
41
+
42
+ def write(sync_config, records, _action = "create")
43
+ connection_config = sync_config.destination.connection_specification.with_indifferent_access
44
+ url = connection_config[:destination_url]
45
+ headers = connection_config[:headers]
46
+ write_success = 0
47
+ write_failure = 0
48
+ records.each_slice(MAX_CHUNK_SIZE) do |chunk|
49
+ payload = create_payload(chunk)
50
+ response = Multiwoven::Integrations::Core::HttpClient.request(
51
+ url,
52
+ sync_config.stream.request_method,
53
+ payload: payload,
54
+ headers: headers
55
+ )
56
+ if success?(response)
57
+ write_success += chunk.size
58
+ else
59
+ write_failure += chunk.size
60
+ end
61
+ rescue StandardError => e
62
+ handle_exception("HTTP:RECORD:WRITE:EXCEPTION", "error", e)
63
+ write_failure += chunk.size
64
+ end
65
+
66
+ tracker = Multiwoven::Integrations::Protocol::TrackingMessage.new(
67
+ success: write_success,
68
+ failed: write_failure
69
+ )
70
+ tracker.to_multiwoven_message
71
+ rescue StandardError => e
72
+ handle_exception("HTTP:WRITE:EXCEPTION", "error", e)
73
+ end
74
+
75
+ private
76
+
77
+ def create_payload(records)
78
+ {
79
+ "records" => records.map do |record|
80
+ {
81
+ "fields" => record
82
+ }
83
+ end
84
+ }
85
+ end
86
+
87
+ def extract_body(response)
88
+ response_body = response.body
89
+ JSON.parse(response_body) if response_body
90
+ end
91
+ end
92
+ end
93
+ end
94
+ end
95
+ 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": "http",
9
+ "batch_support": false,
10
+ "action": "create",
11
+ "method": "POST",
12
+ "json_schema": {},
13
+ "supported_sync_modes": ["incremental"]
14
+ }
15
+ ]
16
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "data": {
3
+ "name": "Http",
4
+ "title": "http",
5
+ "connector_type": "destination",
6
+ "category": "Http",
7
+ "documentation_url": "https://docs.multiwoven.com/destinations/http",
8
+ "github_issue_label": "destination-http",
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,24 @@
1
+ {
2
+ "documentation_url": "https://docs.multiwoven.com/integrations/destination/http",
3
+ "stream_type": "static",
4
+ "connection_specification": {
5
+ "$schema": "http://json-schema.org/draft-07/schema#",
6
+ "title": "Http",
7
+ "type": "object",
8
+ "required": ["destination_url"],
9
+ "properties": {
10
+ "destination_url": {
11
+ "type": "string",
12
+ "title": "Destination url",
13
+ "order": 0
14
+ },
15
+ "headers": {
16
+ "title": "Http Headers",
17
+ "order": 1,
18
+ "additionalProperties": {
19
+ "type": "string"
20
+ }
21
+ }
22
+ }
23
+ }
24
+ }
@@ -0,0 +1,9 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+
3
+ <svg width="800px" height="800px" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" fill="none">
4
+
5
+
6
+
7
+
8
+
9
+
@@ -1,5 +1,5 @@
1
1
  {
2
- "documentation_url": "https://docs.multiwoven.com/integrations/destination/klaviyo",
2
+ "documentation_url": "https://docs.multiwoven.com/destinations/file-storage/sftp",
3
3
  "stream_type": "static",
4
4
  "connection_specification": {
5
5
  "$schema": "http://json-schema.org/draft-07/schema#",
@@ -70,4 +70,4 @@
70
70
  }
71
71
  }
72
72
  }
73
- }
73
+ }
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Multiwoven
4
4
  module Integrations
5
- VERSION = "0.1.64"
5
+ VERSION = "0.1.65"
6
6
 
7
7
  ENABLED_SOURCES = %w[
8
8
  Snowflake
@@ -25,6 +25,7 @@ module Multiwoven
25
25
  SalesforceConsumerGoodsCloud
26
26
  Sftp
27
27
  Postgresql
28
+ Http
28
29
  ].freeze
29
30
  end
30
31
  end
@@ -61,6 +61,7 @@ require_relative "integrations/destination/stripe/client"
61
61
  require_relative "integrations/destination/salesforce_consumer_goods_cloud/client"
62
62
  require_relative "integrations/destination/sftp/client"
63
63
  require_relative "integrations/destination/postgresql/client"
64
+ require_relative "integrations/destination/http/client"
64
65
 
65
66
  module Multiwoven
66
67
  module Integrations
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.1.64
4
+ version: 0.1.65
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-05-03 00:00:00.000000000 Z
11
+ date: 2024-05-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -418,6 +418,11 @@ files:
418
418
  - lib/multiwoven/integrations/destination/google_sheets/config/meta.json
419
419
  - lib/multiwoven/integrations/destination/google_sheets/config/spec.json
420
420
  - lib/multiwoven/integrations/destination/google_sheets/icon.svg
421
+ - lib/multiwoven/integrations/destination/http/client.rb
422
+ - lib/multiwoven/integrations/destination/http/config/catalog.json
423
+ - lib/multiwoven/integrations/destination/http/config/meta.json
424
+ - lib/multiwoven/integrations/destination/http/config/spec.json
425
+ - lib/multiwoven/integrations/destination/http/icon.svg
421
426
  - lib/multiwoven/integrations/destination/hubspot/client.rb
422
427
  - lib/multiwoven/integrations/destination/hubspot/config/catalog.json
423
428
  - lib/multiwoven/integrations/destination/hubspot/config/meta.json