etl-integrations 0.1.81

Sign up to get free protection for your applications and to get access to all the features.
Files changed (119) hide show
  1. checksums.yaml +7 -0
  2. data/.rspec +3 -0
  3. data/.rubocop.yml +34 -0
  4. data/.ruby-version +1 -0
  5. data/.vscode/settings.json +5 -0
  6. data/CHANGELOG.md +38 -0
  7. data/CODE_OF_CONDUCT.md +84 -0
  8. data/LICENSE.txt +21 -0
  9. data/README.md +105 -0
  10. data/Rakefile +12 -0
  11. data/lib/multiwoven/integrations/config.rb +13 -0
  12. data/lib/multiwoven/integrations/core/base_connector.rb +70 -0
  13. data/lib/multiwoven/integrations/core/constants.rb +46 -0
  14. data/lib/multiwoven/integrations/core/destination_connector.rb +14 -0
  15. data/lib/multiwoven/integrations/core/fullrefresher.rb +19 -0
  16. data/lib/multiwoven/integrations/core/http_client.rb +34 -0
  17. data/lib/multiwoven/integrations/core/query_builder.rb +27 -0
  18. data/lib/multiwoven/integrations/core/rate_limiter.rb +19 -0
  19. data/lib/multiwoven/integrations/core/source_connector.rb +38 -0
  20. data/lib/multiwoven/integrations/core/utils.rb +104 -0
  21. data/lib/multiwoven/integrations/destination/airtable/client.rb +153 -0
  22. data/lib/multiwoven/integrations/destination/airtable/config/catalog.json +6 -0
  23. data/lib/multiwoven/integrations/destination/airtable/config/meta.json +15 -0
  24. data/lib/multiwoven/integrations/destination/airtable/config/spec.json +22 -0
  25. data/lib/multiwoven/integrations/destination/airtable/icon.svg +6 -0
  26. data/lib/multiwoven/integrations/destination/airtable/schema_helper.rb +141 -0
  27. data/lib/multiwoven/integrations/destination/facebook_custom_audience/client.rb +124 -0
  28. data/lib/multiwoven/integrations/destination/facebook_custom_audience/config/catalog.json +42 -0
  29. data/lib/multiwoven/integrations/destination/facebook_custom_audience/config/meta.json +15 -0
  30. data/lib/multiwoven/integrations/destination/facebook_custom_audience/config/spec.json +27 -0
  31. data/lib/multiwoven/integrations/destination/facebook_custom_audience/icon.svg +23 -0
  32. data/lib/multiwoven/integrations/destination/google_sheets/client.rb +231 -0
  33. data/lib/multiwoven/integrations/destination/google_sheets/config/catalog.json +6 -0
  34. data/lib/multiwoven/integrations/destination/google_sheets/config/meta.json +15 -0
  35. data/lib/multiwoven/integrations/destination/google_sheets/config/spec.json +74 -0
  36. data/lib/multiwoven/integrations/destination/google_sheets/icon.svg +1 -0
  37. data/lib/multiwoven/integrations/destination/hubspot/client.rb +107 -0
  38. data/lib/multiwoven/integrations/destination/hubspot/config/catalog.json +351 -0
  39. data/lib/multiwoven/integrations/destination/hubspot/config/meta.json +15 -0
  40. data/lib/multiwoven/integrations/destination/hubspot/config/spec.json +17 -0
  41. data/lib/multiwoven/integrations/destination/hubspot/icon.svg +5 -0
  42. data/lib/multiwoven/integrations/destination/klaviyo/client.rb +116 -0
  43. data/lib/multiwoven/integrations/destination/klaviyo/config/catalog.json +103 -0
  44. data/lib/multiwoven/integrations/destination/klaviyo/config/meta.json +15 -0
  45. data/lib/multiwoven/integrations/destination/klaviyo/config/spec.json +22 -0
  46. data/lib/multiwoven/integrations/destination/klaviyo/icon.svg +6 -0
  47. data/lib/multiwoven/integrations/destination/postgresql/client.rb +123 -0
  48. data/lib/multiwoven/integrations/destination/postgresql/config/meta.json +15 -0
  49. data/lib/multiwoven/integrations/destination/postgresql/config/spec.json +68 -0
  50. data/lib/multiwoven/integrations/destination/postgresql/icon.svg +20 -0
  51. data/lib/multiwoven/integrations/destination/salesforce_consumer_goods_cloud/client.rb +114 -0
  52. data/lib/multiwoven/integrations/destination/salesforce_consumer_goods_cloud/config/catalog.json +6 -0
  53. data/lib/multiwoven/integrations/destination/salesforce_consumer_goods_cloud/config/meta.json +16 -0
  54. data/lib/multiwoven/integrations/destination/salesforce_consumer_goods_cloud/config/spec.json +49 -0
  55. data/lib/multiwoven/integrations/destination/salesforce_consumer_goods_cloud/icon.svg +16 -0
  56. data/lib/multiwoven/integrations/destination/salesforce_consumer_goods_cloud/schema_helper.rb +132 -0
  57. data/lib/multiwoven/integrations/destination/salesforce_crm/client.rb +117 -0
  58. data/lib/multiwoven/integrations/destination/salesforce_crm/config/catalog.json +320 -0
  59. data/lib/multiwoven/integrations/destination/salesforce_crm/config/meta.json +15 -0
  60. data/lib/multiwoven/integrations/destination/salesforce_crm/config/spec.json +43 -0
  61. data/lib/multiwoven/integrations/destination/salesforce_crm/icon.svg +16 -0
  62. data/lib/multiwoven/integrations/destination/sftp/client.rb +133 -0
  63. data/lib/multiwoven/integrations/destination/sftp/config/catalog.json +16 -0
  64. data/lib/multiwoven/integrations/destination/sftp/config/meta.json +16 -0
  65. data/lib/multiwoven/integrations/destination/sftp/config/spec.json +50 -0
  66. data/lib/multiwoven/integrations/destination/sftp/icon.svg +1 -0
  67. data/lib/multiwoven/integrations/destination/slack/client.rb +114 -0
  68. data/lib/multiwoven/integrations/destination/slack/config/catalog.json +22 -0
  69. data/lib/multiwoven/integrations/destination/slack/config/meta.json +15 -0
  70. data/lib/multiwoven/integrations/destination/slack/config/spec.json +22 -0
  71. data/lib/multiwoven/integrations/destination/slack/icon.svg +26 -0
  72. data/lib/multiwoven/integrations/destination/stripe/client.rb +82 -0
  73. data/lib/multiwoven/integrations/destination/stripe/config/catalog.json +128 -0
  74. data/lib/multiwoven/integrations/destination/stripe/config/meta.json +15 -0
  75. data/lib/multiwoven/integrations/destination/stripe/config/spec.json +17 -0
  76. data/lib/multiwoven/integrations/destination/stripe/icon.svg +10 -0
  77. data/lib/multiwoven/integrations/destination/tally/client.rb +151 -0
  78. data/lib/multiwoven/integrations/destination/tally/config/catalog.json +62 -0
  79. data/lib/multiwoven/integrations/destination/tally/config/meta.json +15 -0
  80. data/lib/multiwoven/integrations/destination/tally/config/spec.json +45 -0
  81. data/lib/multiwoven/integrations/destination/tally/icon.svg +7 -0
  82. data/lib/multiwoven/integrations/protocol/protocol.json +189 -0
  83. data/lib/multiwoven/integrations/protocol/protocol.rb +216 -0
  84. data/lib/multiwoven/integrations/rollout.rb +32 -0
  85. data/lib/multiwoven/integrations/service.rb +79 -0
  86. data/lib/multiwoven/integrations/source/bigquery/client.rb +98 -0
  87. data/lib/multiwoven/integrations/source/bigquery/config/meta.json +15 -0
  88. data/lib/multiwoven/integrations/source/bigquery/config/spec.json +82 -0
  89. data/lib/multiwoven/integrations/source/bigquery/icon.svg +1 -0
  90. data/lib/multiwoven/integrations/source/databricks/client.rb +98 -0
  91. data/lib/multiwoven/integrations/source/databricks/config/meta.json +16 -0
  92. data/lib/multiwoven/integrations/source/databricks/config/spec.json +56 -0
  93. data/lib/multiwoven/integrations/source/databricks/icon.svg +19 -0
  94. data/lib/multiwoven/integrations/source/postgresql/client.rb +109 -0
  95. data/lib/multiwoven/integrations/source/postgresql/config/meta.json +15 -0
  96. data/lib/multiwoven/integrations/source/postgresql/config/spec.json +69 -0
  97. data/lib/multiwoven/integrations/source/postgresql/icon.svg +20 -0
  98. data/lib/multiwoven/integrations/source/redshift/client.rb +109 -0
  99. data/lib/multiwoven/integrations/source/redshift/config/meta.json +15 -0
  100. data/lib/multiwoven/integrations/source/redshift/config/spec.json +71 -0
  101. data/lib/multiwoven/integrations/source/redshift/icon.svg +15 -0
  102. data/lib/multiwoven/integrations/source/salesforce_consumer_goods_cloud/client.rb +123 -0
  103. data/lib/multiwoven/integrations/source/salesforce_consumer_goods_cloud/config/catalog.json +6 -0
  104. data/lib/multiwoven/integrations/source/salesforce_consumer_goods_cloud/config/meta.json +17 -0
  105. data/lib/multiwoven/integrations/source/salesforce_consumer_goods_cloud/config/spec.json +50 -0
  106. data/lib/multiwoven/integrations/source/salesforce_consumer_goods_cloud/icon.svg +16 -0
  107. data/lib/multiwoven/integrations/source/salesforce_consumer_goods_cloud/schema_helper.rb +130 -0
  108. data/lib/multiwoven/integrations/source/snowflake/client.rb +92 -0
  109. data/lib/multiwoven/integrations/source/snowflake/config/meta.json +15 -0
  110. data/lib/multiwoven/integrations/source/snowflake/config/spec.json +82 -0
  111. data/lib/multiwoven/integrations/source/snowflake/icon.svg +10 -0
  112. data/lib/multiwoven/integrations/source/zoho_books/client.rb +155 -0
  113. data/lib/multiwoven/integrations/source/zoho_books/config/meta.json +16 -0
  114. data/lib/multiwoven/integrations/source/zoho_books/config/spec.json +43 -0
  115. data/lib/multiwoven/integrations/source/zoho_books/icon.svg +16 -0
  116. data/lib/multiwoven/integrations.rb +71 -0
  117. data/multiwoven-integrations-0.1.68.gem +0 -0
  118. data/sig/multiwoven/integrations.rbs +6 -0
  119. metadata +515 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 6f6ac72a0e3d6f1c83a3edd5e2da1d4b3e5234ac75d222b8a3df8f37dab474c8
4
+ data.tar.gz: c56fc3a1ee95809f024cd13ac7afc7c29f977aee5bd7bde946b9c352a412efa1
5
+ SHA512:
6
+ metadata.gz: 269de2999365a4e65f8491d888df9ee57136f7f2f065aaf600dd1ddc65900d048c181cdd419b0ebd3b756776230e7d44e9291aea74e5759b497041389ec0435e
7
+ data.tar.gz: 6dec0f83e2f321332eccb0efd61f8da7f735e26cdcc4c1d304d98bcc298d70231da194578fa523fdfd5c42d1ee90fbaf71f232011b3f0584b3269c2e1759f82a
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,34 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.6
3
+
4
+ Style/StringLiterals:
5
+ Enabled: true
6
+ EnforcedStyle: double_quotes
7
+
8
+ Style/StringLiteralsInInterpolation:
9
+ Enabled: true
10
+ EnforcedStyle: double_quotes
11
+
12
+ Layout/LineLength:
13
+ Max: 300
14
+
15
+ Style/ClassAndModuleChildren:
16
+ Enabled: false
17
+
18
+ Style/Documentation:
19
+ Enabled: false
20
+
21
+ Metrics/ModuleLength:
22
+ Max: 500
23
+
24
+ Metrics/BlockLength:
25
+ Max: 120
26
+
27
+ Metrics/AbcSize:
28
+ Max: 30
29
+
30
+ Metrics/MethodLength:
31
+ Max: 50
32
+
33
+ Metrics/CyclomaticComplexity:
34
+ Max: 50
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 3.2.0
@@ -0,0 +1,5 @@
1
+ {
2
+ "cSpell.words": [
3
+ "multiwoven"
4
+ ]
5
+ }
data/CHANGELOG.md ADDED
@@ -0,0 +1,38 @@
1
+ ## [Unreleased]
2
+
3
+ ### [0.4.1](https://www.github.com/Multiwoven/multiwoven-integrations/compare/v0.4.0...v0.4.1) (2024-02-15)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * Add batch params to stream ([#68](https://www.github.com/Multiwoven/multiwoven-integrations/issues/68)) ([080530f](https://www.github.com/Multiwoven/multiwoven-integrations/commit/080530f8280b467c8e40a3b6429f178ad18fa05e))
9
+
10
+ ## [0.4.0](https://www.github.com/Multiwoven/multiwoven-integrations/compare/v0.3.0...v0.4.0) (2024-02-14)
11
+
12
+
13
+ ### Features
14
+
15
+ * Bump version to 1.21 ([#62](https://www.github.com/Multiwoven/multiwoven-integrations/issues/62)) ([7b1476d](https://www.github.com/Multiwoven/multiwoven-integrations/commit/7b1476d4b04a073ab060971019095d0a13ebd153))
16
+
17
+ ## [0.3.0](https://www.github.com/Multiwoven/multiwoven-integrations/compare/v0.2.0...v0.3.0) (2024-02-14)
18
+
19
+
20
+ ### Features
21
+
22
+ * Publish gem to rubygems ([#60](https://www.github.com/Multiwoven/multiwoven-integrations/issues/60)) ([04cfbb6](https://www.github.com/Multiwoven/multiwoven-integrations/commit/04cfbb60c78bc90d886ce691d5094fed9c6f078f))
23
+
24
+ ## [0.2.0](https://www.github.com/Multiwoven/multiwoven-integrations/compare/v0.1.0...v0.2.0) (2024-02-14)
25
+
26
+
27
+ ### Features
28
+
29
+ * Automate gem release ([#55](https://www.github.com/Multiwoven/multiwoven-integrations/issues/55)) ([1c3373b](https://www.github.com/Multiwoven/multiwoven-integrations/commit/1c3373bcedae60c6fb8171c54ce40de94f1537ce))
30
+
31
+
32
+ ### Bug Fixes
33
+
34
+ * Klaviyo discover ([#23](https://www.github.com/Multiwoven/multiwoven-integrations/issues/23)) ([7c43db6](https://www.github.com/Multiwoven/multiwoven-integrations/commit/7c43db6a369403748ed29085bb5254405ad1c95e))
35
+
36
+ ## [0.1.0] - 2023-12-01
37
+
38
+ - Initial release
@@ -0,0 +1,84 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
+
9
+ ## Our Standards
10
+
11
+ Examples of behavior that contributes to a positive environment for our community include:
12
+
13
+ * Demonstrating empathy and kindness toward other people
14
+ * Being respectful of differing opinions, viewpoints, and experiences
15
+ * Giving and gracefully accepting constructive feedback
16
+ * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
+ * Focusing on what is best not just for us as individuals, but for the overall community
18
+
19
+ Examples of unacceptable behavior include:
20
+
21
+ * The use of sexualized language or imagery, and sexual attention or
22
+ advances of any kind
23
+ * Trolling, insulting or derogatory comments, and personal or political attacks
24
+ * Public or private harassment
25
+ * Publishing others' private information, such as a physical or email
26
+ address, without their explicit permission
27
+ * Other conduct which could reasonably be considered inappropriate in a
28
+ professional setting
29
+
30
+ ## Enforcement Responsibilities
31
+
32
+ Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
33
+
34
+ Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
35
+
36
+ ## Scope
37
+
38
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
39
+
40
+ ## Enforcement
41
+
42
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at subinthattaparambil@gmail.com. All complaints will be reviewed and investigated promptly and fairly.
43
+
44
+ All community leaders are obligated to respect the privacy and security of the reporter of any incident.
45
+
46
+ ## Enforcement Guidelines
47
+
48
+ Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
49
+
50
+ ### 1. Correction
51
+
52
+ **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
53
+
54
+ **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
55
+
56
+ ### 2. Warning
57
+
58
+ **Community Impact**: A violation through a single incident or series of actions.
59
+
60
+ **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
61
+
62
+ ### 3. Temporary Ban
63
+
64
+ **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
65
+
66
+ **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
67
+
68
+ ### 4. Permanent Ban
69
+
70
+ **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
71
+
72
+ **Consequence**: A permanent ban from any sort of public interaction within the community.
73
+
74
+ ## Attribution
75
+
76
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
77
+ available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
78
+
79
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
80
+
81
+ [homepage]: https://www.contributor-covenant.org
82
+
83
+ For answers to common questions about this code of conduct, see the FAQ at
84
+ https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2023 Multiwoven
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,105 @@
1
+ <div align="center">
2
+ <a href="https://multiwoven.com?utm_source=github" target="_blank">
3
+ <img src="https://res.cloudinary.com/dspflukeu/image/upload/v1706696350/Multiwoven/Logo_hrkaxj.png" alt="Multiwoven" width="240" />
4
+ </a>
5
+ </div>
6
+ <br />
7
+ <p align="center">
8
+ <a href="http://badge.fury.io/rb/multiwoven-integrations">
9
+ <img src="https://badge.fury.io/rb/multiwoven-integrations.svg" alt="Gem Version">
10
+ </a>
11
+ <a href="https://github.com/Multiwoven/multiwoven-integrations/actions/workflows/ci.yml">
12
+ <img src="https://github.com/Multiwoven/multiwoven-integrations/actions/workflows/ci.yml/badge.svg" alt="CI">
13
+ </a>
14
+ <a href="https://codeclimate.com/repos/657d0a2a60265a2f2155ffca/maintainability">
15
+ <img src="https://api.codeclimate.com/v1/badges/d841270f1f7a966043c1/maintainability" alt="Maintainability">
16
+ </a>
17
+ <a href="https://codeclimate.com/repos/657d0a2a60265a2f2155ffca/test_coverage">
18
+ <img src="https://api.codeclimate.com/v1/badges/d841270f1f7a966043c1/test_coverage" alt="Test Coverage">
19
+ </a>
20
+ </p>
21
+ <h2 align="center">The open-source Reverse ETL platform for data teams</h2>
22
+
23
+ <p align="center">
24
+ <br />
25
+ <a href="https://docs.multiwoven.com" rel="">
26
+ <strong>Explore the docs »</strong>
27
+ </a>
28
+ <br />
29
+ <br />
30
+ <a href="https://join.slack.com/t/multiwoven/shared_invite/zt-2bnjye26u-~lu_FFOMLpChOYxvovep7g">Slack</a>
31
+ ·
32
+ <a href="https://multiwoven.com">Website</a>
33
+ ·
34
+ <a href="https://github.com/Multiwoven/multiwoven-integrations/issues">Report Issues</a>
35
+ ·
36
+ <a href="https://github.com/orgs/Multiwoven/projects/4">Roadmap</a>
37
+ </p>
38
+
39
+ ## Multiwoven Integrations
40
+
41
+ Multiwoven integrations is the collection of connectors built on top of [Multiwoven protocol](https://docs.multiwoven.com/guides/architecture/multiwoven-protocol).
42
+
43
+ Multiwoven protocol is an open source standard for moving data between data sources to any third-part destinations.
44
+ Anyone can build a connetor with basic ruby knowledge using the protocol.
45
+
46
+ ### Installation
47
+
48
+ Install the gem and add to the application's Gemfile by executing:
49
+
50
+ $ bundle add multiwoven-integrations
51
+
52
+
53
+ ### Usage
54
+
55
+ #### Source
56
+ ```
57
+ source = Multiwoven::Integrations::Source::[CONNECTOR_NAME]::Client.new
58
+ source.read(sync_config)
59
+ ```
60
+ #### Destination
61
+
62
+ ```
63
+ destination = Multiwoven::Integrations::Destination::[CONNECTOR_NAME]::Client.new
64
+ destination.write(sync_config, records)
65
+ ```
66
+
67
+ #### Supported methods
68
+ Please refer [Multiwoven Protocol](https://docs.multiwoven.com/guides/architecture/multiwoven-protocol) to understand more about the supported methods on source and destination
69
+
70
+ ## Development
71
+
72
+ - **Install Dependencies**
73
+ - Command: `bin/setup`
74
+ - Description: After checking out the repo, run this command to install dependencies.
75
+
76
+ - **Run Tests**
77
+ - Command: `rake spec`
78
+ - Description: Run this command to execute the tests.
79
+
80
+ - **Interactive Prompt**
81
+ - Command: `bin/console`
82
+ - Description: For an interactive prompt that allows you to experiment, run this command.
83
+
84
+ - **Install Gem Locally**
85
+ - Command: `bundle exec rake install`
86
+ - Description: To install this gem onto your local machine, run this command.
87
+
88
+ - **Release New Version**
89
+ - Steps:
90
+ 1. Update the version number in `rollout.rb`.
91
+ 2. Command: `bundle exec rake release`
92
+ 3. Description: This command will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
93
+
94
+
95
+ ## Contributing
96
+
97
+ Bug reports and pull requests are welcome on [GitHub](https://github.com/Multiwoven/multiwoven-integrations). This project aims to be a safe, welcoming space for collaboration.
98
+
99
+ ## Code of Conduct
100
+
101
+ Contributors are expected to adhere to the project's [code of conduct](https://github.com/Multiwoven/multiwoven-integrations/blob/main/CODE_OF_CONDUCT.md)
102
+
103
+ ## License
104
+
105
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ require "rubocop/rake_task"
9
+
10
+ RuboCop::RakeTask.new
11
+
12
+ task default: %i[spec rubocop]
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Multiwoven
4
+ module Integrations
5
+ class Config
6
+ attr_accessor :logger
7
+
8
+ def initialize(params = {})
9
+ @logger = params[:logger]
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,70 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Multiwoven
4
+ module Integrations::Core
5
+ class BaseConnector
6
+ include Integrations::Protocol
7
+ include Utils
8
+ include Constants
9
+
10
+ def connector_spec
11
+ @connector_spec ||= begin
12
+ spec_json = keys_to_symbols(read_json(CONNECTOR_SPEC_PATH)).to_json
13
+ # returns Protocol::ConnectorSpecification
14
+ ConnectorSpecification.from_json(spec_json)
15
+ end
16
+ end
17
+
18
+ def meta_data
19
+ client_meta_data = read_json(META_DATA_PATH).deep_symbolize_keys
20
+ icon_name = client_meta_data[:data][:icon]
21
+ icon_url = "https://raw.githubusercontent.com/Multiwoven/multiwoven/main/integrations#{relative_path}/#{icon_name}"
22
+ client_meta_data[:data][:icon] = icon_url
23
+ # returns hash
24
+ @meta_data ||= client_meta_data
25
+ end
26
+
27
+ def relative_path
28
+ path = Object.const_source_location(self.class.to_s)[0]
29
+ connector_folder = File.dirname(path)
30
+ marker = "/lib/multiwoven/integrations/"
31
+ parts = connector_folder.split(marker)
32
+
33
+ marker + parts.last if parts.length > 1
34
+ end
35
+
36
+ # Connection config is a hash
37
+ def check_connection(_connection_config)
38
+ raise "Not implemented"
39
+ # returns Protocol.ConnectionStatus
40
+ end
41
+
42
+ # Connection config is a hash
43
+ def discover(_connection_config)
44
+ raise "Not implemented"
45
+ # returns Protocol::Catalog
46
+ end
47
+
48
+ private
49
+
50
+ def read_json(file_path)
51
+ path = Object.const_source_location(self.class.to_s)[0]
52
+ connector_folder = File.dirname(path)
53
+ file_path = File.join(
54
+ "#{connector_folder}/",
55
+ file_path
56
+ )
57
+ file_contents = File.read(file_path)
58
+ JSON.parse(file_contents)
59
+ end
60
+
61
+ def success_status
62
+ ConnectionStatus.new(status: ConnectionStatusType["succeeded"]).to_multiwoven_message
63
+ end
64
+
65
+ def failure_status(error)
66
+ ConnectionStatus.new(status: ConnectionStatusType["failed"], message: error.message).to_multiwoven_message
67
+ end
68
+ end
69
+ end
70
+ end
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Multiwoven
4
+ module Integrations::Core
5
+ module Constants
6
+ # CONFIG
7
+ META_DATA_PATH = "config/meta.json"
8
+ CONNECTOR_SPEC_PATH = "config/spec.json"
9
+ CATALOG_SPEC_PATH = "config/catalog.json"
10
+ SNOWFLAKE_MAC_DRIVER_PATH = "/opt/snowflake/snowflakeodbc/lib/universal/libSnowflake.dylib"
11
+ DATABRICKS_MAC_DRIVER_PATH = "/Library/simba/spark/lib/libsparkodbc_sb64-universal.dylib"
12
+
13
+ SNOWFLAKE_DRIVER_PATH = ENV["SNOWFLAKE_DRIVER_PATH"] || SNOWFLAKE_MAC_DRIVER_PATH
14
+ DATABRICKS_DRIVER_PATH = ENV["DATABRICKS_DRIVER_PATH"] || DATABRICKS_MAC_DRIVER_PATH
15
+
16
+ JSON_SCHEMA_URL = "https://json-schema.org/draft-07/schema#"
17
+
18
+ # CONNECTORS
19
+ KLAVIYO_AUTH_ENDPOINT = "https://a.klaviyo.com/api/lists/"
20
+ KLAVIYO_AUTH_PAYLOAD = {
21
+ data: {
22
+ type: "list",
23
+ attributes: {
24
+ name: "THIS IS REQUIRED"
25
+ }
26
+ }
27
+ }.freeze
28
+
29
+ FACEBOOK_AUDIENCE_GET_ALL_ACCOUNTS = "https://graph.facebook.com/v18.0/me/adaccounts?fields=id,name"
30
+
31
+ AIRTABLE_URL_BASE = "https://api.airtable.com/v0/"
32
+ AIRTABLE_BASES_ENDPOINT = "https://api.airtable.com/v0/meta/bases"
33
+ AIRTABLE_GET_BASE_SCHEMA_ENDPOINT = "https://api.airtable.com/v0/meta/bases/{baseId}/tables"
34
+
35
+ # HTTP
36
+ HTTP_GET = "GET"
37
+ HTTP_POST = "POST"
38
+ HTTP_PUT = "PUT"
39
+ HTTP_DELETE = "DELETE"
40
+
41
+ # google sheets
42
+ GOOGLE_SHEETS_SCOPE = "https://www.googleapis.com/auth/drive"
43
+ GOOGLE_SPREADSHEET_ID_REGEX = %r{/d/([-\w]{20,})/}.freeze
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Multiwoven
4
+ module Integrations::Core
5
+ class DestinationConnector < BaseConnector
6
+ # Records are transformed json payload send it to the destination
7
+ # SyncConfig is the Protocol::SyncConfig object
8
+ def write(_sync_config, _records, _action = "insert")
9
+ raise "Not implemented"
10
+ # return Protocol::TrackingMessage
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Multiwoven
4
+ module Integrations::Core
5
+ module Fullrefresher
6
+ def write(sync_config, records, action = "insert")
7
+ if sync_config && sync_config.sync_mode == "full_refresh" && !@full_refreshed
8
+ response = clear_all_records(sync_config)
9
+ return response unless response &&
10
+ response.control.status == Multiwoven::Integrations::Protocol::ConnectionStatusType["succeeded"]
11
+
12
+ @full_refreshed = true
13
+ end
14
+
15
+ super(sync_config, records, action)
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Multiwoven
4
+ module Integrations::Core
5
+ class HttpClient
6
+ class << self
7
+ def request(url, method, payload: nil, headers: {})
8
+ uri = URI(url)
9
+ http = Net::HTTP.new(uri.host, uri.port)
10
+ http.use_ssl = (uri.scheme == "https")
11
+ request = build_request(method, uri, payload, headers)
12
+ http.request(request)
13
+ end
14
+
15
+ private
16
+
17
+ def build_request(method, uri, payload, headers)
18
+ request_class = case method.upcase
19
+ when Constants::HTTP_GET then Net::HTTP::Get
20
+ when Constants::HTTP_POST then Net::HTTP::Post
21
+ when Constants::HTTP_PUT then Net::HTTP::Put
22
+ when Constants::HTTP_DELETE then Net::HTTP::Delete
23
+ else raise ArgumentError, "Unsupported HTTP method: #{method}"
24
+ end
25
+
26
+ request = request_class.new(uri)
27
+ headers.each { |key, value| request[key] = value }
28
+ request.body = payload.to_json if payload && %w[POST PUT].include?(method.upcase)
29
+ request
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Multiwoven
4
+ module Integrations::Core
5
+ class QueryBuilder
6
+ def self.perform(action, table, record, primary_key = nil)
7
+ case action.downcase
8
+ when "insert"
9
+ columns = record.keys.join(", ")
10
+ values = record.values.map { |value| "'#{value}'" }.join(", ")
11
+ # TODO: support bulk insert
12
+ "INSERT INTO #{table} (#{columns}) VALUES (#{values});"
13
+ when "update"
14
+ # Ensure primary key is a string and exists within record for the WHERE clause
15
+ return "Primary key '#{primary_key}' not found in record." if record[primary_key].nil?
16
+
17
+ primary_key_value = record.delete(primary_key) # Remove and return the primary key value
18
+ set_clause = record.map { |key, value| "#{key} = '#{value}'" }.join(", ")
19
+ where_clause = "#{primary_key} = '#{primary_key_value}'"
20
+ "UPDATE #{table} SET #{set_clause} WHERE #{where_clause};"
21
+ else
22
+ "Invalid action specified."
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Multiwoven
4
+ module Integrations::Core
5
+ module RateLimiter
6
+ def write(sync_config, records, action = "insert")
7
+ stream = sync_config.stream
8
+
9
+ @queue ||= Limiter::RateQueue.new(stream.request_rate_limit, interval: stream.rate_limit_unit_seconds) do
10
+ Integrations::Service.logger.info("Hit the limit for stream: #{stream.name}, waiting")
11
+ end
12
+
13
+ @queue.shift
14
+
15
+ super(sync_config, records, action)
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Multiwoven
4
+ module Integrations::Core
5
+ class SourceConnector < BaseConnector
6
+ # accepts Protocol::SyncConfig
7
+ def read(_sync_config)
8
+ raise "Not implemented"
9
+ # setup sync configs
10
+ # call query(connection, query)
11
+ # Returns list of RecordMessage
12
+ end
13
+
14
+ private
15
+
16
+ # This needs to be implemented as private method
17
+ # In every source connector. This will be used for model preview
18
+ def query(connection, query)
19
+ # return list of RecordMessage
20
+ end
21
+
22
+ def batched_query(sql_query, limit, offset)
23
+ offset = offset.to_i
24
+ limit = limit.to_i
25
+ raise ArgumentError, "Offset and limit must be non-negative" if offset.negative? || limit.negative?
26
+
27
+ # Removing any trailing semicolons
28
+ sql_query.chomp!(";")
29
+
30
+ # Checking if the query already has a LIMIT clause
31
+ raise ArgumentError, "Query already contains a LIMIT clause" if sql_query.match?(/LIMIT \d+/i)
32
+
33
+ # Appending the LIMIT and OFFSET clauses to the SQL query
34
+ "#{sql_query} LIMIT #{limit} OFFSET #{offset}"
35
+ end
36
+ end
37
+ end
38
+ end