multiwoven-integrations 0.1.16 → 0.1.18

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: 8147299a4a24f6576a659a42f3d0118c59741067aca03a1f0db5928a39c8ac8a
4
- data.tar.gz: a0718173edda3ee3714b80989ee84be961af64e6409e77f2448fef56ff5cd4ec
3
+ metadata.gz: 33bd471327290a3ea7196e558ad47a4a41c5295f7535ca7e01ba5e3c920edf8f
4
+ data.tar.gz: 1b4c17cd7dcc6b7ea0e1a5208e71fba57d2c790863fee0fda5fcd24220bddf4f
5
5
  SHA512:
6
- metadata.gz: 37e0699004b4020723fa701d495bdac674cf5d2792537b487f475a05b7b97344f5191e5bf4b1d73b8c36dc23c7530f0b9693c5353c4b500b37a31dabfdedef1a
7
- data.tar.gz: d962d30f061839dddc305ffd88a67e75eebcd63dd6a9964d785cae6a2c606bde7ec99a4aee7d2267d3962cda50d2ae1f6e838c7bad0c9c1db7edf0669120133d
6
+ metadata.gz: 68017d5b0a0548fb3944248838fe5938377e477d2ce32c34421b32f92eba9bc487564d99583dad8f7f61aa0bba358f35570a2a6b20e3045c42da009b9dd46d87
7
+ data.tar.gz: da0889bd2c8865111319eab6d7ec3923edf34fb91b38bb885395e7aa2006080cddd17a73b924ab88154f5d38bc749fb00a2d53760c1c1d2a1ff032d48288f6e8
@@ -1,33 +1,6 @@
1
- <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 581 172" style="enable-background:new 0 0 581 172;" xml:space="preserve">
1
+ <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 67.8 45.4" style="enable-background:new 0 0 67.8 45.4;" xml:space="preserve">
2
2
  <g>
3
- <path d="M329.9,34.4c3.1,0,6.1-1.2,8.3-3.3c2.2-2.1,3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3c8.5,3.3,8,10.6-1.8,22L28.8,94V0L0,6.2v2.4
13
- c4.9,0,9.8,4.8,9.8,13.3v92.8C9.8,125,5,129,0,129.7v2.3h38.2v-2.3c-6.3-0.9-9.4-5.7-9.4-14.9V97.7l8.2-9l19.8,32.4
14
- c4.7,7.8,9.1,10.9,16,10.9h66.4v-1.8C139.3,130.2,137.4,130.1,135.2,129.7L135.2,129.7z M214.4,118.8V80
15
- c-0.4-25.3-11.1-36.9-35.6-36.9c-7.8-0.1-15.4,2.5-21.6,7.3c-6.5,4.9-9.6,10.4-9.6,16.8c0,6.2,3.5,10.9,9.2,10.9
16
- c6.1,0,10.5-3.5,10.5-8.3c0-3.6-2.4-8.7-2.4-12.1c0-6.2,4.7-11.6,12.9-11.6c10.5,0,18,7.8,18,25.1v10.4l-8.7,2.1
17
- c-4.5,0.9-8.4,1.8-11.3,2.6c-3,0.9-6.8,2.1-11.3,3.8c-9.1,3.5-13.9,6.8-18.1,13c-2.1,3-3.1,6.6-3.1,10.2c0,14.4,10.1,21,24.2,21
18
- c11.2,0,23-5.9,28.4-17c0.1,3.5,0.9,6.9,2.5,10.1c5.9,11.9,25.5,4.9,25.5,4.9V130C215.1,131.3,214.4,121.2,214.4,118.8L214.4,118.8
19
- z M195.8,106.8c0,5.7-2.1,10.4-6.3,13.7c-4,3.3-8.2,5-12.6,5c-8.5,0-14.1-5.5-14.1-15.8c0-4.8,2.7-9.3,4.9-11.9
20
- c1.8-1.8,3.8-3.3,6.1-4.3c3-1.6,4.4-2.4,6.5-3.3l8-2.9c4-1.6,6.4-2.4,7.5-2.9L195.8,106.8L195.8,106.8z M581,45.4h-67.8V0H581
21
- l-14.2,22.7L581,45.4L581,45.4z M443.1,120.9c-8.4-8.6-13.1-20.2-12.9-32.3c-0.1-5.9,1-11.8,3.2-17.3c2.2-5.5,5.5-10.5,9.7-14.8
22
- c8.6-9,19-13.5,31.3-13.5c12,0,22.5,4.5,31.1,13.5c4.2,4.2,7.6,9.2,9.8,14.7c2.3,5.5,3.4,11.4,3.3,17.4c0.1,6-1,11.9-3.3,17.4
23
- c-2.3,5.5-5.6,10.6-9.8,14.8c-8.6,8.8-19,13.4-31.1,13.4C462.2,134.3,451.7,129.8,443.1,120.9L443.1,120.9z M490.1,58
24
- c-3.4-6.7-8-10.6-13.3-11.7c-10.8-2.2-20.3,8.9-23.9,26.4c-1.5,7.9-1.9,15.9-1.1,23.8c0.8,8,3,15.7,6.6,22.9
25
- c3.5,6.7,8,10.6,13.3,11.7c10.8,2.2,20.6-9.3,24.2-27C498.9,89.3,497.4,71.3,490.1,58L490.1,58L490.1,58z">
26
- </path>
27
- <path d="M340,114.8V45.4h-61.4v2.1c8.2,1.2,12.1,7.4,8.4,17.3c-19.2,51.8-18,49.5-19.2,53.6c-1.2-4-4-13.8-8.5-26.1
28
- c-4.5-12.3-7.5-20.4-8.7-24.1c-4.7-14.4-3.1-19.7,4.5-20.6v-2.3h-39.8v2.3c5.9,1.2,11.2,8,15.5,20.1l6.1,15.8
29
- c6.7,17,14.6,40.5,17.2,48.5h13.2c4.3-12.3,21.3-61.5,23.6-66.5c2.5-5.7,5.3-10,8.4-13c1.5-1.6,3.3-2.9,5.4-3.7
30
- c2-0.8,4.2-1.3,6.4-1.2c0,0,9.6,0,9.6,9.2v58.1c0,9.7-4.7,14.2-9.6,14.9v2.3h38v-2.3C344.2,129,340,124.5,340,114.8L340,114.8z">
3
+ <path d="M67.8,45.4H0V0h67.8L53.6,22.7L67.8,45.4L67.8,45.4z">
31
4
  </path>
32
5
  </g>
33
6
  </svg>
@@ -10,6 +10,7 @@ module Multiwoven
10
10
  def connector_spec
11
11
  @connector_spec ||= begin
12
12
  spec_json = keys_to_symbols(read_json(CONNECTOR_SPEC_PATH)).to_json
13
+ # returns Protocol::ConnectorSpecification
13
14
  ConnectorSpecification.from_json(spec_json)
14
15
  end
15
16
  end
@@ -19,17 +20,20 @@ module Multiwoven
19
20
  icon_name = client_meta_data[:data][:icon]
20
21
  icon_url = "https://raw.githubusercontent.com/Multiwoven/multiwoven-integrations/#{MAIN_BRANCH_SHA}/assets/images/connectors/#{icon_name}"
21
22
  client_meta_data[:data][:icon] = icon_url
22
-
23
+ # returns hash
23
24
  @meta_data ||= client_meta_data
24
25
  end
25
26
 
27
+ # Connection config is a hash
26
28
  def check_connection(_connection_config)
27
29
  raise "Not implemented"
28
30
  # returns Protocol.ConnectionStatus
29
31
  end
30
32
 
33
+ # Connection config is a hash
31
34
  def discover(_connection_config)
32
35
  raise "Not implemented"
36
+ # returns Protocol::Catalog
33
37
  end
34
38
 
35
39
  private
@@ -3,9 +3,11 @@
3
3
  module Multiwoven
4
4
  module Integrations::Core
5
5
  class DestinationConnector < BaseConnector
6
+ # records is transformed json payload send it to the destination
7
+ # SyncConfig is the Protocol::SyncConfig object
6
8
  def write(_sync_config, _records, _action = "insert")
7
9
  raise "Not implemented"
8
- # return list of record message
10
+ # return Protocol::TrackingMessage
9
11
  end
10
12
  end
11
13
  end
@@ -3,10 +3,12 @@
3
3
  module Multiwoven
4
4
  module Integrations::Core
5
5
  class SourceConnector < BaseConnector
6
+ # accepts Protocol::SyncConfig
6
7
  def read(_sync_config)
7
8
  raise "Not implemented"
8
9
  # setup sync configs
9
10
  # call query(connection, query)
11
+ # Returns list of RecordMessage
10
12
  end
11
13
 
12
14
  private
@@ -65,7 +65,7 @@ module Multiwoven
65
65
  end
66
66
 
67
67
  def extract_data(record_object, properties)
68
- data_attributes = record_object.with_indifferent_access[:data][:attributes]
68
+ data_attributes = record_object.with_indifferent_access
69
69
  data_attributes.select { |key, _| properties.key?(key.to_sym) }
70
70
  end
71
71
 
@@ -27,7 +27,6 @@ module Multiwoven::Integrations::Destination
27
27
 
28
28
  streams = catalog_json["streams"].map do |stream|
29
29
  Multiwoven::Integrations::Protocol::Stream.new(
30
- audience_id: stream["audience_id"],
31
30
  url: stream["url"],
32
31
  name: stream["name"],
33
32
  json_schema: stream["json_schema"],
@@ -50,21 +49,13 @@ module Multiwoven::Integrations::Destination
50
49
  end
51
50
 
52
51
  def write(sync_config, records, _action = "insert")
53
- url = sync_config.stream.url
54
52
  connection_config = sync_config.destination.connection_specification.with_indifferent_access
55
- connection_config = connection_config.with_indifferent_access
56
53
  access_token = connection_config[:access_token]
57
-
54
+ url = generate_url(sync_config, connection_config)
58
55
  write_success = 0
59
56
  write_failure = 0
60
57
  records.each do |record|
61
- schema, data = extract_schema_and_data(record.with_indifferent_access[:data])
62
- payload = {
63
- "payload" => {
64
- "schema" => schema,
65
- "data" => [data]
66
- }
67
- }
58
+ payload = create_payload(record.with_indifferent_access, sync_config.stream.json_schema.with_indifferent_access)
68
59
  response = Multiwoven::Integrations::Core::HttpClient.request(
69
60
  url,
70
61
  sync_config.stream.request_method,
@@ -96,8 +87,34 @@ module Multiwoven::Integrations::Destination
96
87
  )
97
88
  end
98
89
 
99
- def extract_schema_and_data(data)
100
- [data.keys, data.values]
90
+ private
91
+
92
+ def generate_url(sync_config, connection_config)
93
+ sync_config.stream.url.gsub("{audience_id}", connection_config[:audience_id])
94
+ end
95
+
96
+ def create_payload(record_data, json_schema)
97
+ schema, data = extract_schema_and_data(record_data, json_schema)
98
+ {
99
+ "payload" => {
100
+ "schema" => schema,
101
+ "data" => [data]
102
+ }
103
+ }
104
+ end
105
+
106
+ def extract_schema_and_data(data, json_schema)
107
+ schema_properties = json_schema[:properties]
108
+ schema = data.keys.map(&:upcase)
109
+ encrypted_data_array = []
110
+
111
+ data.each do |key, value|
112
+ schema_key = key.upcase
113
+ encrypted_value = schema_properties[schema_key] && schema_properties[schema_key]["x-hashRequired"] ? Digest::SHA256.hexdigest(value.to_s) : value
114
+ encrypted_data_array << encrypted_value
115
+ end
116
+
117
+ [schema, encrypted_data_array]
101
118
  end
102
119
 
103
120
  def auth_headers(access_token)
@@ -4,29 +4,28 @@
4
4
  "name": "audience",
5
5
  "action": "create",
6
6
  "method": "POST",
7
- "audience_id": "audience_id",
8
7
  "url": "https://graph.facebook.com/v18.0/{audience_id}/users",
9
8
  "json_schema": {
10
9
  "type": "object",
11
10
  "additionalProperties": true,
12
11
  "properties": {
13
- "CT": { "type": ["string", "null"], "default": null },
14
- "COUNTRY": { "type": ["string", "null"], "default": null },
15
- "DOBD": { "type": ["string", "null"], "default": null },
16
- "DOBM": { "type": ["string", "null"], "default": null },
17
- "DOBY": { "type": ["string", "null"], "default": null },
18
- "EMAIL": { "type": ["string", "null"], "default": null },
19
- "EXTERN_ID": { "type": ["string", "null"], "default": null },
20
- "FI": { "type": ["string", "null"], "default": null },
21
- "FN": { "type": ["string", "null"], "default": null },
22
- "GEN": { "type": ["string", "null"], "default": null },
23
- "LN": { "type": ["string", "null"], "default": null },
24
- "LOOKALIKE_VALUE": { "type": ["number", "null"], "default": null },
25
- "MADID": { "type": ["string", "null"], "default": null },
26
- "PAGEUID": { "type": ["string", "null"], "default": null },
27
- "PHONE": { "type": ["string", "null"], "default": null },
28
- "ST": { "type": ["string", "null"], "default": null },
29
- "ZIP": { "type": ["string", "null"], "default": null }
12
+ "EMAIL": { "type": ["string", "null"], "default": null, "title": "Email", "x-hashRequired": true },
13
+ "PHONE": { "type": ["string", "null"], "default": null, "title": "Phone", "x-hashRequired": true },
14
+ "GEN": { "type": ["string", "null"], "default": null, "title": "Gender", "x-hashRequired": true },
15
+ "FI": { "type": ["string", "null"], "default": null, "title": "First Initial", "x-hashRequired": true },
16
+ "FN": { "type": ["string", "null"], "default": null, "title": "First Name", "x-hashRequired": true },
17
+ "DOBD": { "type": ["string", "null"], "default": null, "title": "Date of Birth (Day)", "x-hashRequired": true },
18
+ "DOBM": { "type": ["string", "null"], "default": null, "title": "Date of Birth (Month)", "x-hashRequired": true },
19
+ "DOBY": { "type": ["string", "null"], "default": null, "title": "Date of Birth (Year)", "x-hashRequired": true },
20
+ "LN": { "type": ["string", "null"], "default": null, "title": "Last Name", "x-hashRequired": true },
21
+ "CT": { "type": ["string", "null"], "default": null, "title": "City", "x-hashRequired": true },
22
+ "ST": { "type": ["string", "null"], "default": null, "title": "State", "x-hashRequired": true },
23
+ "ZIP": { "type": ["string", "null"], "default": null, "title": "Zip Code", "x-hashRequired": true },
24
+ "COUNTRY": { "type": ["string", "null"], "default": null, "title": "Country", "x-hashRequired": true },
25
+ "EXTERN_ID": { "type": ["string", "null"], "default": null, "title": "External ID", "x-hashRequired": false},
26
+ "LOOKALIKE_VALUE": { "type": ["number", "null"], "default": null, "title": "Lookalike Value", "x-hashRequired": false },
27
+ "MADID": { "type": ["string", "null"], "default": null, "title": "Mobile ID", "x-hashRequired": false },
28
+ "PAGEUID": { "type": ["string", "null"], "default": null, "title": "Page-Scoped ID", "x-hashRequired": false }
30
29
  }
31
30
  },
32
31
  "supported_sync_modes": ["full_refresh", "incremental"],
@@ -35,4 +34,4 @@
35
34
  "source_defined_primary_key": [["email"]]
36
35
  }
37
36
  ]
38
- }
37
+ }
@@ -5,7 +5,7 @@
5
5
  "$schema": "http://json-schema.org/draft-07/schema#",
6
6
  "title": "Facebook Custom Audiences",
7
7
  "type": "object",
8
- "required": ["access_token", "ad_account_id"],
8
+ "required": ["access_token", "ad_account_id", "audience_id"],
9
9
  "properties": {
10
10
  "access_token": {
11
11
  "type": "string",
@@ -16,6 +16,11 @@
16
16
  "type": "string",
17
17
  "title": "Ad Account Id",
18
18
  "order": 1
19
+ },
20
+ "audience_id": {
21
+ "type": "string",
22
+ "title": "Audience Id",
23
+ "order": 2
19
24
  }
20
25
  }
21
26
  }
@@ -72,7 +72,7 @@ module Multiwoven
72
72
  def build_args(stream_name, record)
73
73
  case stream_name
74
74
  when "chat_postMessage"
75
- { channel: channel_id, text: slack_code_block(record[:data][:attributes]) }
75
+ { channel: channel_id, text: slack_code_block(record) }
76
76
  else
77
77
  raise "Stream name not found: #{stream_name}"
78
78
  end
@@ -9,63 +9,12 @@
9
9
  "properties": {
10
10
  "text": {
11
11
  "type": ["string", "null"]
12
- },
13
- "attachments": {
14
- "type": ["string", "null"]
15
- },
16
- "blocks": {
17
- "type": ["array", "null"],
18
- "items": {
19
- "type": "string"
20
- }
21
- },
22
- "as_user": {
23
- "type": ["boolean", "null"]
24
- },
25
- "icon_emoji": {
26
- "type": ["string", "null"]
27
- },
28
- "icon_url": {
29
- "type": ["string", "null"]
30
- },
31
- "link_names": {
32
- "type": ["boolean", "null"]
33
- },
34
- "metadata": {
35
- "type": ["string", "null"]
36
- },
37
- "mrkdwn": {
38
- "type": ["boolean", "null"]
39
- },
40
- "parse": {
41
- "type": ["string", "null"]
42
- },
43
- "reply_broadcast": {
44
- "type": ["boolean", "null"]
45
- },
46
- "thread_ts": {
47
- "type": ["string", "null"]
48
- },
49
- "unfurl_links": {
50
- "type": ["boolean", "null"]
51
- },
52
- "unfurl_media": {
53
- "type": ["boolean", "null"]
54
- },
55
- "username": {
56
- "type": ["string", "null"]
57
12
  }
58
13
  },
59
- "oneOf": [
60
- { "required": ["text"] },
61
- { "required": ["attachments"] },
62
- { "required": ["blocks"] }
63
- ]
14
+ "oneOf": [{ "required": ["text"] }]
64
15
  },
65
16
  "supported_sync_modes": ["full_refresh", "incremental"],
66
- "source_defined_cursor": true,
67
- "default_cursor_field": ["updated"],
68
- "source_defined_primary_key": [["Id"]]
17
+ "source_defined_cursor": true
69
18
  }
70
19
  ]
71
20
  }
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Multiwoven
4
4
  module Integrations
5
- VERSION = "0.1.16"
5
+ VERSION = "0.1.18"
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.1.16
4
+ version: 0.1.18
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-02-05 00:00:00.000000000 Z
11
+ date: 2024-02-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport