multiwoven-integrations 0.1.35 → 0.1.36

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: 154bbe9f4e36d95f4cd7fdb8094077e2ff724a3eef95ec76264950747d619fe2
4
- data.tar.gz: b3da4210a997a0143b637a32d4d4b0dc6ba741742e5a1f73a3a465c8187479de
3
+ metadata.gz: 818c8606d1ef1b50bd14765b3ed85f687ef5e16cdd975324bfbf28ed2b371070
4
+ data.tar.gz: 0bd41ef2fe575ff51d5ea5878522509de3aa6ae0b3592074c15ce3de5be97c51
5
5
  SHA512:
6
- metadata.gz: '052295ce22be1a08561f2d907bb1974c465302f2ec12cd6ae50afa976354bc13eb9ac0d178cd1b9eca86945cb18c4cb316ef05a44e6deac14ccc49f03fb57029'
7
- data.tar.gz: 35e541a5b3ea70f9761ff0c54b527a6334fcc91d5321018d4ce926163f8611eb4a4db714a2b36ad01c8e869854544ec63142bef2e2e99bd7cc0d3d2e022ebe2d
6
+ metadata.gz: dfaa4c53e72fbf3fc64d2d746bf4fd632c19be834af900a93eb88060fc1a84156b1849b645768ca41ebd3037f205a7b4f79430738eddb7f607b526fb9424c08b
7
+ data.tar.gz: dd7dc877f6ad86082975cb9dbdc714bc5e9dc623196178e6c9c11b601deab967fa107d1d218d5dc03e43b6b6c580403d45bc470fd364a109a8a1cb6e8a793520
@@ -1,124 +1,103 @@
1
1
  {
2
- "request_rate_limit": 600,
3
- "request_rate_limit_unit": "minute",
4
- "request_rate_concurrency": 10,
5
- "streams": [
6
- {
7
- "name": "profile",
8
- "action": "create",
9
- "url": "https://a.klaviyo.com/api/profiles",
10
- "method": "POST",
11
- "json_schema": {
12
- "$schema": "http://json-schema.org/draft-07/schema#",
13
- "type": "object",
14
- "properties": {
15
- "data": {
16
- "type": "object",
17
- "properties": {
18
- "type": {
19
- "type": "string",
20
- "enum": [
21
- "profile"
22
- ]
23
- },
24
- "attributes": {
25
- "type": "object",
26
- "properties": {
27
- "email": {
28
- "type": "string",
29
- "format": "email"
30
- },
31
- "phone_number": {
32
- "type": "string"
33
- },
34
- "external_id": {
35
- "type": "string",
36
- "format": "uuid"
37
- },
38
- "first_name": {
39
- "type": "string"
40
- },
41
- "last_name": {
42
- "type": "string"
43
- },
44
- "organization": {
45
- "type": "string"
46
- },
47
- "title": {
48
- "type": "string"
49
- },
50
- "image": {
51
- "type": "string",
52
- "format": "uri"
53
- },
54
- "location": {
55
- "type": "object",
56
- "properties": {
57
- "address1": {
58
- "type": "string"
59
- },
60
- "address2": {
61
- "type": "string"
62
- },
63
- "city": {
64
- "type": "string"
65
- },
66
- "country": {
67
- "type": "string"
68
- },
69
- "region": {
70
- "type": "string"
71
- },
72
- "zip": {
73
- "type": "string"
74
- },
75
- "timezone": {
76
- "type": "string"
77
- },
78
- "ip": {
79
- "type": "string",
80
- "format": "ipv4"
81
- }
82
- }
83
-
84
- },
2
+ "request_rate_limit": 600,
3
+ "request_rate_limit_unit": "minute",
4
+ "request_rate_concurrency": 10,
5
+ "streams": [
6
+ {
7
+ "name": "profile",
8
+ "action": "create",
9
+ "url": "https://a.klaviyo.com/api/profiles",
10
+ "method": "POST",
11
+ "json_schema": {
12
+ "$schema": "http://json-schema.org/draft-07/schema#",
13
+ "type": "object",
14
+ "properties": {
15
+ "data": {
16
+ "type": "object",
17
+ "properties": {
18
+ "type": {
19
+ "type": "string",
20
+ "enum": ["profile"]
21
+ },
22
+ "attributes": {
23
+ "type": "object",
24
+ "properties": {
25
+ "email": {
26
+ "type": "string",
27
+ "format": "email"
28
+ },
29
+ "phone_number": {
30
+ "type": "string"
31
+ },
32
+ "external_id": {
33
+ "type": "string",
34
+ "format": "uuid"
35
+ },
36
+ "first_name": {
37
+ "type": "string"
38
+ },
39
+ "last_name": {
40
+ "type": "string"
41
+ },
42
+ "organization": {
43
+ "type": "string"
44
+ },
45
+ "title": {
46
+ "type": "string"
47
+ },
48
+ "image": {
49
+ "type": "string",
50
+ "format": "uri"
51
+ },
52
+ "location": {
53
+ "type": "object",
85
54
  "properties": {
86
- "type": "object",
87
- "additionalProperties": {
55
+ "address1": {
56
+ "type": "string"
57
+ },
58
+ "address2": {
59
+ "type": "string"
60
+ },
61
+ "city": {
62
+ "type": "string"
63
+ },
64
+ "country": {
65
+ "type": "string"
66
+ },
67
+ "region": {
88
68
  "type": "string"
69
+ },
70
+ "zip": {
71
+ "type": "string"
72
+ },
73
+ "timezone": {
74
+ "type": "string"
75
+ },
76
+ "ip": {
77
+ "type": "string",
78
+ "format": "ipv4"
89
79
  }
90
80
  }
91
81
  },
92
- "required": [
93
- "email",
94
- "phone_number"
95
- ]
96
- }
97
- },
98
- "required": [
99
- "type",
100
- "attributes"
101
- ]
102
- }
103
- },
104
- "required": [
105
- "data"
106
- ]
82
+ "properties": {
83
+ "type": "object",
84
+ "additionalProperties": {
85
+ "type": "string"
86
+ }
87
+ }
88
+ },
89
+ "required": ["email", "phone_number"]
90
+ }
91
+ },
92
+ "required": ["type", "attributes"]
93
+ }
107
94
  },
108
- "supported_sync_modes": [
109
- "incremental"
110
- ],
111
- "source_defined_cursor": true,
112
- "default_cursor_field": [
113
- "updated"
114
- ],
115
- "source_defined_primary_key": [
116
- [
117
- "id",
118
- "email"
119
- ]
120
- ]
121
-
122
- }
123
- ]
124
- }
95
+ "required": ["data"]
96
+ },
97
+ "supported_sync_modes": ["incremental"],
98
+ "source_defined_cursor": true,
99
+ "default_cursor_field": ["updated"],
100
+ "source_defined_primary_key": [["id", "email"]]
101
+ }
102
+ ]
103
+ }
@@ -0,0 +1,81 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Multiwoven
4
+ module Integrations
5
+ module Destination
6
+ module Stripe
7
+ include Multiwoven::Integrations::Core
8
+
9
+ API_VERSION = "59.0"
10
+
11
+ class Client < DestinationConnector
12
+ def check_connection(connection_config)
13
+ connection_config = connection_config.with_indifferent_access
14
+ initialize_client(connection_config)
15
+ authenticate_client
16
+ success_status
17
+ rescue StandardError => e
18
+ failure_status(e)
19
+ end
20
+
21
+ def discover(_connection_config = nil)
22
+ catalog = build_catalog(load_catalog)
23
+ catalog.to_multiwoven_message
24
+ rescue StandardError => e
25
+ handle_exception("STRIPE:CRM:DISCOVER:EXCEPTION", "error", e)
26
+ end
27
+
28
+ def write(sync_config, records, action = "create")
29
+ @action = sync_config.stream.action || action
30
+ initialize_client(sync_config.destination.connection_specification)
31
+ process_records(records, sync_config.stream)
32
+ rescue StandardError => e
33
+ handle_exception("STRIPE:CRM:WRITE:EXCEPTION", "error", e)
34
+ end
35
+
36
+ private
37
+
38
+ def initialize_client(config)
39
+ config = config.with_indifferent_access
40
+ ::Stripe.api_key = config[:api_key]
41
+ @client = ::Stripe
42
+ end
43
+
44
+ def process_records(records, stream)
45
+ write_success = 0
46
+ write_failure = 0
47
+ properties = stream.json_schema[:properties]
48
+ records.each do |record_object|
49
+ record = extract_data(record_object, properties)
50
+ klass = @client.const_get(stream.name)
51
+ klass.send(@action, record)
52
+ write_success += 1
53
+ rescue StandardError => e
54
+ handle_exception("STRIPE:CRM:WRITE:EXCEPTION", "error", e)
55
+ write_failure += 1
56
+ end
57
+ tracking_message(write_success, write_failure)
58
+ end
59
+
60
+ def authenticate_client
61
+ @client::Customer.list
62
+ end
63
+
64
+ def load_catalog
65
+ read_json(CATALOG_SPEC_PATH)
66
+ end
67
+
68
+ def tracking_message(success, failure)
69
+ Multiwoven::Integrations::Protocol::TrackingMessage.new(
70
+ success: success, failed: failure
71
+ ).to_multiwoven_message
72
+ end
73
+
74
+ def log_debug(message)
75
+ Multiwoven::Integrations::Service.logger.debug(message)
76
+ end
77
+ end
78
+ end
79
+ end
80
+ end
81
+ end
@@ -0,0 +1,128 @@
1
+ {
2
+ "request_rate_limit": 100000,
3
+ "request_rate_limit_unit": "day",
4
+ "request_rate_concurrency": 10,
5
+ "streams": [
6
+ {
7
+ "name": "Customer",
8
+ "action": "create",
9
+ "json_schema": {
10
+ "type": "object",
11
+ "additionalProperties": true,
12
+ "properties": {
13
+ "email": {
14
+ "type": "string"
15
+ },
16
+ "description": {
17
+ "type": "string"
18
+ },
19
+ "name": {
20
+ "type": "string"
21
+ },
22
+ "payment_method": {
23
+ "type": "string"
24
+ },
25
+ "metadata": {
26
+ "type": "object"
27
+ },
28
+ "phone": {
29
+ "type": "string"
30
+ },
31
+ "address": {
32
+ "type": "object",
33
+ "additionalProperties": true,
34
+ "properties": {
35
+ "city": {
36
+ "type": "string"
37
+ },
38
+ "country": {
39
+ "type": "string"
40
+ },
41
+ "line1": {
42
+ "type": "string"
43
+ },
44
+ "line2": {
45
+ "type": "string"
46
+ },
47
+ "postal_code": {
48
+ "type": "string"
49
+ },
50
+ "state": {
51
+ "type": "string"
52
+ }
53
+ }
54
+ },
55
+ "shipping": {
56
+ "type": "object",
57
+ "additionalProperties": true,
58
+ "properties": {
59
+ "address": {
60
+ "type": "object",
61
+ "additionalProperties": true,
62
+ "properties": {
63
+ "city": {
64
+ "type": "string"
65
+ },
66
+ "country": {
67
+ "type": "string"
68
+ },
69
+ "line1": {
70
+ "type": "string"
71
+ },
72
+ "line2": {
73
+ "type": "string"
74
+ },
75
+ "postal_code": {
76
+ "type": "string"
77
+ },
78
+ "state": {
79
+ "type": "string"
80
+ }
81
+ }
82
+ },
83
+ "name": {
84
+ "type": "string"
85
+ },
86
+ "phone": {
87
+ "type": "string"
88
+ }
89
+ }
90
+ }
91
+ }
92
+ },
93
+ "supported_sync_modes": ["incremental"],
94
+ "source_defined_cursor": true,
95
+ "default_cursor_field": ["updated"],
96
+ "source_defined_primary_key": [["Id"]]
97
+ },
98
+ {
99
+ "name": "Product",
100
+ "action": "create",
101
+ "json_schema": {
102
+ "type": "object",
103
+ "additionalProperties": true,
104
+ "required": ["name"],
105
+ "properties": {
106
+ "name": {
107
+ "type": "string"
108
+ },
109
+ "description": {
110
+ "type": "string"
111
+ },
112
+ "active": {
113
+ "type": "boolean"
114
+ },
115
+ "id": {
116
+ "type": "string"
117
+ },
118
+ "metadata": {
119
+ "type": "object"
120
+ }
121
+ }
122
+ },
123
+ "supported_sync_modes": ["incremental"],
124
+ "source_defined_cursor": true,
125
+ "default_cursor_field": ["updated"]
126
+ }
127
+ ]
128
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "data": {
3
+ "name": "Stripe",
4
+ "title": "Stripe",
5
+ "connector_type": "destination",
6
+ "category": "Payments",
7
+ "documentation_url": "https://docs.mutliwoven.com",
8
+ "github_issue_label": "destination-stripe",
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,17 @@
1
+ {
2
+ "documentation_url": "https://docs.multiwoven.com/integrations/destination/payments/stripe",
3
+ "stream_type": "static",
4
+ "connection_specification": {
5
+ "$schema": "http://json-schema.org/draft-07/schema#",
6
+ "title": "Stripe",
7
+ "type": "object",
8
+ "required": ["api_key"],
9
+ "properties": {
10
+ "api_key": {
11
+ "type": "string",
12
+ "title": "API Key",
13
+ "order": 0
14
+ }
15
+ }
16
+ }
17
+ }
@@ -0,0 +1,10 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28.87 28.87" id="stripe">
2
+ <g data-name="Layer 2">
3
+ <g data-name="Layer 1">
4
+ <rect width="28.87" height="28.87" fill="#6772e5" rx="6.48" ry="6.48"></rect>
5
+ <path fill="#fff" fill-rule="evenodd"
6
+ d="M13.3 11.2c0-.69.57-1 1.49-1a9.84 9.84 0 0 1 4.37 1.13V7.24a11.6 11.6 0 0 0-4.36-.8c-3.56 0-5.94 1.86-5.94 5 0 4.86 6.68 4.07 6.68 6.17 0 .81-.71 1.07-1.68 1.07A11.06 11.06 0 0 1 9 17.25v4.19a12.19 12.19 0 0 0 4.8 1c3.65 0 6.17-1.8 6.17-5 .03-5.21-6.67-4.27-6.67-6.24z">
7
+ </path>
8
+ </g>
9
+ </g>
10
+ </svg>
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Multiwoven
4
4
  module Integrations
5
- VERSION = "0.1.35"
5
+ VERSION = "0.1.36"
6
6
 
7
7
  ENABLED_SOURCES = %w[
8
8
  Snowflake
@@ -20,6 +20,7 @@ module Multiwoven
20
20
  Hubspot
21
21
  GoogleSheets
22
22
  Airtable
23
+ Stripe
23
24
  ].freeze
24
25
  end
25
26
  end
@@ -18,6 +18,7 @@ require "ruby-limiter"
18
18
  require "hubspot-api-client"
19
19
  require "google/apis/sheets_v4"
20
20
  require "stringio"
21
+ require "stripe"
21
22
 
22
23
  # Service
23
24
  require_relative "integrations/config"
@@ -49,6 +50,7 @@ require_relative "integrations/destination/slack/client"
49
50
  require_relative "integrations/destination/hubspot/client"
50
51
  require_relative "integrations/destination/google_sheets/client"
51
52
  require_relative "integrations/destination/airtable/client"
53
+ require_relative "integrations/destination/stripe/client"
52
54
 
53
55
  module Multiwoven
54
56
  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.35
4
+ version: 0.1.36
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-03-12 00:00:00.000000000 Z
11
+ date: 2024-03-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -366,6 +366,11 @@ files:
366
366
  - lib/multiwoven/integrations/destination/slack/config/meta.json
367
367
  - lib/multiwoven/integrations/destination/slack/config/spec.json
368
368
  - lib/multiwoven/integrations/destination/slack/icon.svg
369
+ - lib/multiwoven/integrations/destination/stripe/client.rb
370
+ - lib/multiwoven/integrations/destination/stripe/config/catalog.json
371
+ - lib/multiwoven/integrations/destination/stripe/config/meta.json
372
+ - lib/multiwoven/integrations/destination/stripe/config/spec.json
373
+ - lib/multiwoven/integrations/destination/stripe/icon.svg
369
374
  - lib/multiwoven/integrations/protocol/protocol.json
370
375
  - lib/multiwoven/integrations/protocol/protocol.rb
371
376
  - lib/multiwoven/integrations/rollout.rb