-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Recurly #1058
Merged
Merged
Recurly #1058
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
8ed90b9
First version of implementation source 'Recurly'
yevhenii-ldv 24a9813
add documentation
yevhenii-ldv 75258f5
update json schema files
yevhenii-ldv d9b93ff
update README.md, add comment into code
yevhenii-ldv 09e95c1
Merge branch 'master' of github.com:yevhenii-ldv/airbyte into recurly
yevhenii-ldv 042e678
update Dockerfile, setup.py
yevhenii-ldv File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
...ain/resources/config/STANDARD_SOURCE_DEFINITION/cd42861b-01fc-4658-a8ab-5d11d0510f01.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"sourceDefinitionId": "cd42861b-01fc-4658-a8ab-5d11d0510f01", | ||
"name": "Recurly", | ||
"dockerRepository": "airbyte/source-recurly", | ||
"dockerImageTag": "0.1.0", | ||
"documentationUrl": "https://hub.docker.com/r/airbyte/source-recurly" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
FROM airbyte/integration-base-python:dev | ||
|
||
# Bash is installed for more convenient debugging. | ||
RUN apt-get update && apt-get install -y bash && rm -rf /var/lib/apt/lists/* | ||
|
||
ENV CODE_PATH="source_recurly" | ||
ENV AIRBYTE_IMPL_MODULE="source_recurly" | ||
ENV AIRBYTE_IMPL_PATH="SourceRecurly" | ||
|
||
WORKDIR /airbyte/integration_code | ||
COPY $CODE_PATH ./$CODE_PATH | ||
COPY setup.py ./ | ||
RUN pip install ".[main]" | ||
|
||
LABEL io.airbyte.version=0.1.0 | ||
LABEL io.airbyte.name=airbyte/source-recurly |
22 changes: 22 additions & 0 deletions
22
airbyte-integrations/connectors/source-recurly/Dockerfile.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
FROM airbyte/base-python-test:dev | ||
|
||
RUN apt-get update && apt-get install -y bash && rm -rf /var/lib/apt/lists/* | ||
|
||
ENV CODE_PATH="integration_tests" | ||
ENV AIRBYTE_TEST_MODULE="integration_tests" | ||
ENV AIRBYTE_TEST_PATH="RecurlyStandardSourceTest" | ||
|
||
LABEL io.airbyte.version=0.1.0 | ||
LABEL io.airbyte.name=airbyte/source-recurly-standard-test | ||
|
||
|
||
WORKDIR /airbyte/integration_code | ||
COPY source_recurly source_recurly | ||
COPY $CODE_PATH $CODE_PATH | ||
COPY secrets/* $CODE_PATH | ||
COPY source_recurly/*.json $CODE_PATH | ||
COPY setup.py ./ | ||
|
||
RUN pip install ".[tests]" | ||
|
||
WORKDIR /airbyte |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# Recurly Source | ||
|
||
This is the repository for the Recurly source connector, written in Python. | ||
For information about how to use this connector within Airbyte, see [the documentation](https://docs.airbyte.io/integrations/sources/recurly). | ||
|
||
## Local development | ||
|
||
### Prerequisites | ||
**To iterate on this connector, make sure to complete this prerequisites section.** | ||
|
||
#### Build & Activate Virtual Environment | ||
First, build the module by running the following from the `airbyte` project root directory: | ||
``` | ||
./gradlew :airbyte-integrations:connectors:source-recurly:build | ||
``` | ||
|
||
This will generate a virtualenv for this module in `source-recurly/.venv`. Make sure this venv is active in your | ||
development environment of choice. To activate the venv from the terminal, run: | ||
``` | ||
cd airbyte-integrations/connectors/source-recurly # cd into the connector directory | ||
source .venv/bin/activate | ||
``` | ||
If you are in an IDE, follow your IDE's instructions to activate the virtualenv. | ||
|
||
#### Create credentials | ||
**If you are a community contributor**, follow the instructions in the [documentation](https://docs.airbyte.io/integrations/sources/recurly) | ||
to generate the necessary credentials. Then create a file `secrets/config.json` conforming to the `source_recurly/spec.json` file. | ||
See `sample_files/sample_config.json` for a sample config file. | ||
|
||
**If you are an Airbyte core member**, copy the credentials in RPass under the secret name `source-recurly-integration-test-config` | ||
and place them into `secrets/config.json`. | ||
|
||
|
||
### Locally running the connector | ||
``` | ||
python main_dev.py spec | ||
python main_dev.py check --config secrets/config.json | ||
python main_dev.py discover --config secrets/config.json | ||
python main_dev.py read --config secrets/config.json --catalog sample_files/sample_catalog.json | ||
``` | ||
|
||
### Unit Tests | ||
To run unit tests locally, from the connector directory run: | ||
``` | ||
pytest unit_tests | ||
``` | ||
|
||
### Locally running the connector docker image | ||
``` | ||
# in airbyte root directory | ||
./gradlew :airbyte-integrations:connectors:source-recurly:airbyteDocker | ||
docker run --rm airbyte/source-recurly:dev spec | ||
docker run --rm -v $(pwd)/airbyte-integrations/connectors/source-recurly/secrets:/secrets airbyte/source-recurly:dev check --config /secrets/config.json | ||
docker run --rm -v $(pwd)/airbyte-integrations/connectors/source-recurly/secrets:/secrets airbyte/source-recurly:dev discover --config /secrets/config.json | ||
docker run --rm -v $(pwd)/airbyte-integrations/connectors/source-recurly/secrets:/secrets -v $(pwd)/airbyte-integrations/connectors/source-recurly/sample_files:/sample_files airbyte/source-recurly:dev read --config /secrets/config.json --catalog /sample_files/sample_catalog.json | ||
``` | ||
|
||
### Integration Tests | ||
1. From the airbyte project root, run `./gradlew :airbyte-integrations:connectors:source-recurly:standardSourceTestPython` to run the standard integration test suite. | ||
1. To run additional integration tests, place your integration tests in the `integration_tests` directory and run them with `pytest integration_tests`. | ||
Make sure to familiarize yourself with [pytest test discovery](https://docs.pytest.org/en/latest/goodpractices.html#test-discovery) to know how your test files and methods should be named. | ||
|
||
## Dependency Management | ||
All of your dependencies should go in `setup.py`, NOT `requirements.txt`. The requirements file is only used to connect internal Airbyte dependencies in the monorepo for local development. |
14 changes: 14 additions & 0 deletions
14
airbyte-integrations/connectors/source-recurly/build.gradle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
plugins { | ||
id 'airbyte-docker' | ||
id 'airbyte-integration-test-java' | ||
id 'airbyte-python' | ||
id 'airbyte-source-test' | ||
} | ||
|
||
airbytePython { | ||
moduleDirectory 'source_recurly' | ||
} | ||
|
||
dependencies { | ||
implementation files(project(':airbyte-integrations:bases:base-python').airbyteDocker.outputs) | ||
} |
27 changes: 27 additions & 0 deletions
27
airbyte-integrations/connectors/source-recurly/integration_tests/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
""" | ||
MIT License | ||
|
||
Copyright (c) 2020 Airbyte | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
""" | ||
|
||
from .standard_source_test import RecurlyStandardSourceTest | ||
|
||
__all__ = ["RecurlyStandardSourceTest"] |
100 changes: 100 additions & 0 deletions
100
airbyte-integrations/connectors/source-recurly/integration_tests/catalog.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
{ | ||
"streams": [ | ||
{ | ||
"name": "accounts", | ||
"json_schema": { | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"type": "object", | ||
"properties": { | ||
"id": { | ||
"type": "string" | ||
}, | ||
"object": { | ||
"type": "string" | ||
}, | ||
"code": { | ||
"type": "string" | ||
}, | ||
"parent_account_id": { | ||
"type": "string" | ||
}, | ||
"bill_to": { | ||
"type": "string" | ||
}, | ||
"state": { | ||
"type": "string" | ||
}, | ||
"username": { | ||
"type": "string" | ||
}, | ||
"email": { | ||
"type": "string" | ||
}, | ||
"cc_emails": { | ||
"type": "string" | ||
}, | ||
"preferred_locale": { | ||
"type": "string" | ||
}, | ||
"first_name": { | ||
"type": "string" | ||
}, | ||
"last_name": { | ||
"type": "string" | ||
}, | ||
"company": { | ||
"type": "string" | ||
}, | ||
"vat_number": { | ||
"type": "string" | ||
}, | ||
"tax_exempt": { | ||
"type": "boolean" | ||
}, | ||
"exemption_certificate": { | ||
"type": "string" | ||
}, | ||
"address": { | ||
"type": "object" | ||
}, | ||
"billing_info": { | ||
"type": "object" | ||
}, | ||
"shipping_addresses": { | ||
"type": "array" | ||
}, | ||
"custom_fields": { | ||
"type": "array" | ||
}, | ||
"has_live_subscription": { | ||
"type": "boolean" | ||
}, | ||
"has_active_subscription": { | ||
"type": "boolean" | ||
}, | ||
"has_future_subscription": { | ||
"type": "boolean" | ||
}, | ||
"has_canceled_subscription": { | ||
"type": "boolean" | ||
}, | ||
"has_paused_subscription": { | ||
"type": "boolean" | ||
}, | ||
"has_past_due_invoice": { | ||
"type": "boolean" | ||
}, | ||
"created_at": { | ||
"type": "string" | ||
}, | ||
"updated_at": { | ||
"type": "string" | ||
}, | ||
"deleted_at": { | ||
"type": "string" | ||
} | ||
} | ||
} | ||
} | ||
] | ||
} |
48 changes: 48 additions & 0 deletions
48
airbyte-integrations/connectors/source-recurly/integration_tests/standard_source_test.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
""" | ||
MIT License | ||
|
||
Copyright (c) 2020 Airbyte | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
""" | ||
|
||
import json | ||
import pkgutil | ||
|
||
from airbyte_protocol import AirbyteCatalog, ConnectorSpecification | ||
from base_python_test import StandardSourceTestIface | ||
|
||
|
||
class RecurlyStandardSourceTest(StandardSourceTestIface): | ||
def get_spec(self) -> ConnectorSpecification: | ||
raw_spec = pkgutil.get_data(self.__class__.__module__.split(".")[0], "spec.json") | ||
return ConnectorSpecification.parse_obj(json.loads(raw_spec)) | ||
|
||
def get_config(self) -> object: | ||
return json.loads(pkgutil.get_data(self.__class__.__module__.split(".")[0], "config.json")) | ||
|
||
def get_catalog(self) -> AirbyteCatalog: | ||
raw_spec = pkgutil.get_data(self.__class__.__module__.split(".")[0], "catalog.json") | ||
return AirbyteCatalog.parse_obj(json.loads(raw_spec)) | ||
|
||
def setup(self) -> None: | ||
pass | ||
|
||
def teardown(self) -> None: | ||
pass |
32 changes: 32 additions & 0 deletions
32
airbyte-integrations/connectors/source-recurly/main_dev.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
""" | ||
MIT License | ||
|
||
Copyright (c) 2020 Airbyte | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
""" | ||
|
||
import sys | ||
|
||
from base_python.entrypoint import launch | ||
from source_recurly import SourceRecurly | ||
|
||
if __name__ == "__main__": | ||
source = SourceRecurly() | ||
launch(source, sys.argv[1:]) |
2 changes: 2 additions & 0 deletions
2
airbyte-integrations/connectors/source-recurly/requirements.standard-test.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
-e ../../bases/base-python-test | ||
-e . |
4 changes: 4 additions & 0 deletions
4
airbyte-integrations/connectors/source-recurly/requirements.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
-e ../../bases/airbyte-protocol | ||
-e ../../bases/base-python | ||
-e ../../bases/base-python-test | ||
-e . |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This readme looks out of date. Could you reference the latest template and update accordingly?