multiwoven-integrations 0.1.16 → 0.1.17

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: 2b5d95619c96cf27279deaccb0a69eb119fb5da9acfcc2fde885e8fac38cee42
4
+ data.tar.gz: 6091f680309d4300be69e94496bf3400274b7934f2c32d639cce7a49f487bf86
5
5
  SHA512:
6
- metadata.gz: 37e0699004b4020723fa701d495bdac674cf5d2792537b487f475a05b7b97344f5191e5bf4b1d73b8c36dc23c7530f0b9693c5353c4b500b37a31dabfdedef1a
7
- data.tar.gz: d962d30f061839dddc305ffd88a67e75eebcd63dd6a9964d785cae6a2c606bde7ec99a4aee7d2267d3962cda50d2ae1f6e838c7bad0c9c1db7edf0669120133d
6
+ metadata.gz: '095149b7a10dcd6f7ab18c201ecfb38515e73f863c675a3f85f7f73878aecfadab80cde348676e3ebeb03096ebf26faa57618f903a992eaa07825afd11a24119'
7
+ data.tar.gz: 5ffb66ff3a80658096f672693b9d927fa1a49cfcae85bdce9a5fc1524be48fb45e3f646e2c478a69e3447ba56017656c628976ad01dad486beab8a8043f0ee76
@@ -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.5-5.1,3.6-8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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>
@@ -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[:data][:attributes], 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
  }
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Multiwoven
4
4
  module Integrations
5
- VERSION = "0.1.16"
5
+ VERSION = "0.1.17"
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.17
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-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport