From dac49d1abeb6b80e89ccac6e8390f0b69a40e423 Mon Sep 17 00:00:00 2001 From: Marcos Marx Date: Wed, 10 Nov 2021 17:28:11 -0300 Subject: [PATCH] Source Cart: add stream addresses (#7767) * change check_connection for Amazon Seller Partner * add new stream addresses * correct configured_catalog * correct abnormal_state * run airbyte config seed file --- .../bb1a6d31-6879-4819-a2bd-3eed299ea8e2.json | 2 +- .../resources/seed/source_definitions.yaml | 2 +- .../src/main/resources/seed/source_specs.yaml | 2 +- .../connectors/source-cart/Dockerfile | 2 +- .../integration_tests/abnormal_state.json | 3 +- .../integration_tests/configured_catalog.json | 12 ++++ .../source_cart/schemas/addresses.json | 62 +++++++++++++++++++ .../source-cart/source_cart/source.py | 4 +- .../source-cart/source_cart/streams.py | 6 ++ 9 files changed, 88 insertions(+), 7 deletions(-) create mode 100644 airbyte-integrations/connectors/source-cart/source_cart/schemas/addresses.json diff --git a/airbyte-config/init/src/main/resources/config/STANDARD_SOURCE_DEFINITION/bb1a6d31-6879-4819-a2bd-3eed299ea8e2.json b/airbyte-config/init/src/main/resources/config/STANDARD_SOURCE_DEFINITION/bb1a6d31-6879-4819-a2bd-3eed299ea8e2.json index 9e3f50a41eec7..eaf457cba306e 100644 --- a/airbyte-config/init/src/main/resources/config/STANDARD_SOURCE_DEFINITION/bb1a6d31-6879-4819-a2bd-3eed299ea8e2.json +++ b/airbyte-config/init/src/main/resources/config/STANDARD_SOURCE_DEFINITION/bb1a6d31-6879-4819-a2bd-3eed299ea8e2.json @@ -2,6 +2,6 @@ "sourceDefinitionId": "bb1a6d31-6879-4819-a2bd-3eed299ea8e2", "name": "Cart.com", "dockerRepository": "airbyte/source-cart", - "dockerImageTag": "0.1.3", + "dockerImageTag": "0.1.4", "documentationUrl": "https://docs.airbyte.io/integrations/sources/cart" } diff --git a/airbyte-config/init/src/main/resources/seed/source_definitions.yaml b/airbyte-config/init/src/main/resources/seed/source_definitions.yaml index b0237f26cff07..9cd8764f8d150 100644 --- a/airbyte-config/init/src/main/resources/seed/source_definitions.yaml +++ b/airbyte-config/init/src/main/resources/seed/source_definitions.yaml @@ -75,7 +75,7 @@ - name: Cart.com sourceDefinitionId: bb1a6d31-6879-4819-a2bd-3eed299ea8e2 dockerRepository: airbyte/source-cart - dockerImageTag: 0.1.3 + dockerImageTag: 0.1.4 documentationUrl: https://docs.airbyte.io/integrations/sources/cart sourceType: api - name: Chargebee diff --git a/airbyte-config/init/src/main/resources/seed/source_specs.yaml b/airbyte-config/init/src/main/resources/seed/source_specs.yaml index e3df4c92b55f4..1ed3ae9ad3d22 100644 --- a/airbyte-config/init/src/main/resources/seed/source_specs.yaml +++ b/airbyte-config/init/src/main/resources/seed/source_specs.yaml @@ -694,7 +694,7 @@ supportsNormalization: false supportsDBT: false supported_destination_sync_modes: [] -- dockerImage: "airbyte/source-cart:0.1.3" +- dockerImage: "airbyte/source-cart:0.1.4" spec: documentationUrl: "https://docs.airbyte.io/integrations/sources/cart" connectionSpecification: diff --git a/airbyte-integrations/connectors/source-cart/Dockerfile b/airbyte-integrations/connectors/source-cart/Dockerfile index eae19bf1b7002..b94ec7219bd9a 100644 --- a/airbyte-integrations/connectors/source-cart/Dockerfile +++ b/airbyte-integrations/connectors/source-cart/Dockerfile @@ -21,5 +21,5 @@ COPY source_cart ./source_cart ENV AIRBYTE_ENTRYPOINT "python /airbyte/integration_code/main.py" ENTRYPOINT ["python", "/airbyte/integration_code/main.py"] -LABEL io.airbyte.version=0.1.3 +LABEL io.airbyte.version=0.1.4 LABEL io.airbyte.name=airbyte/source-cart diff --git a/airbyte-integrations/connectors/source-cart/integration_tests/abnormal_state.json b/airbyte-integrations/connectors/source-cart/integration_tests/abnormal_state.json index dfe5615349f17..f6b575666d9d1 100644 --- a/airbyte-integrations/connectors/source-cart/integration_tests/abnormal_state.json +++ b/airbyte-integrations/connectors/source-cart/integration_tests/abnormal_state.json @@ -3,5 +3,6 @@ "orders": { "updated_at": "2051-07-01T08:59:28.457-05:00" }, "order_payments": { "updated_at": "2051-07-01T08:59:28.457-05:00" }, "order_items": { "updated_at": "2051-07-01T08:59:28.457-05:00" }, - "products": { "updated_at": "2051-07-01T08:59:28.457-05:00" } + "products": { "updated_at": "2051-07-01T08:59:28.457-05:00" }, + "addresses": { "updated_at": "2051-07-01T08:59:28.457-05:00" } } diff --git a/airbyte-integrations/connectors/source-cart/integration_tests/configured_catalog.json b/airbyte-integrations/connectors/source-cart/integration_tests/configured_catalog.json index ecad4beb43c8f..aa213fa766779 100644 --- a/airbyte-integrations/connectors/source-cart/integration_tests/configured_catalog.json +++ b/airbyte-integrations/connectors/source-cart/integration_tests/configured_catalog.json @@ -24,6 +24,18 @@ "cursor_field": ["updated_at"], "destination_sync_mode": "append" }, + { + "stream": { + "name": "addresses", + "json_schema": {}, + "supported_sync_modes": ["full_refresh", "incremental"], + "source_defined_cursor": true, + "default_cursor_field": ["updated_at"] + }, + "sync_mode": "incremental", + "cursor_field": ["updated_at"], + "destination_sync_mode": "append" + }, { "stream": { "name": "order_payments", diff --git a/airbyte-integrations/connectors/source-cart/source_cart/schemas/addresses.json b/airbyte-integrations/connectors/source-cart/source_cart/schemas/addresses.json new file mode 100644 index 0000000000000..98fe097f17794 --- /dev/null +++ b/airbyte-integrations/connectors/source-cart/source_cart/schemas/addresses.json @@ -0,0 +1,62 @@ +{ + "type": "object", + "properties": { + "id": { + "type": "integer" + }, + "customer_id": { + "type": ["integer", "null"] + }, + "address_line_1": { + "type": ["string", "null"] + }, + "address_line_2": { + "type": ["string", "null"] + }, + "city": { + "type": ["string", "null"] + }, + "state": { + "type": ["string", "null"] + }, + "postal_code": { + "type": ["string", "null"] + }, + "country": { + "type": ["string", "null"] + }, + "is_default_shipping_address": { + "type": ["boolean", "null"] + }, + "phone": { + "type": ["string", "null"] + }, + "company": { + "type": ["string", "null"] + }, + "alternate_phone": { + "type": ["string", "null"] + }, + "fax": { + "type": ["string", "null"] + }, + "comments": { + "type": ["string", "null"] + }, + "is_default_billing_address": { + "type": ["boolean", "null"] + }, + "created_at": { + "type": ["string", "null"] + }, + "updated_at": { + "type": ["string", "null"] + }, + "first_name": { + "type": ["string", "null"] + }, + "last_name": { + "type": ["string", "null"] + } + } +} diff --git a/airbyte-integrations/connectors/source-cart/source_cart/source.py b/airbyte-integrations/connectors/source-cart/source_cart/source.py index 21b071157391c..cdaacec0686c1 100644 --- a/airbyte-integrations/connectors/source-cart/source_cart/source.py +++ b/airbyte-integrations/connectors/source-cart/source_cart/source.py @@ -14,7 +14,7 @@ from airbyte_cdk.sources.streams.http.auth import HttpAuthenticator from pendulum.parsing.exceptions import ParserError -from .streams import CustomersCart, OrderItems, OrderPayments, Orders, Products +from .streams import Addresses, CustomersCart, OrderItems, OrderPayments, Orders, Products class CustomHeaderAuthenticator(HttpAuthenticator): @@ -74,4 +74,4 @@ def streams(self, config: Mapping[str, Any]) -> List[Stream]: "store_name": config["store_name"], "end_date": config.get("end_date"), } - return [CustomersCart(**args), Orders(**args), OrderPayments(**args), OrderItems(**args), Products(**args)] + return [CustomersCart(**args), Orders(**args), OrderPayments(**args), OrderItems(**args), Products(**args), Addresses(**args)] diff --git a/airbyte-integrations/connectors/source-cart/source_cart/streams.py b/airbyte-integrations/connectors/source-cart/source_cart/streams.py index 3db6147db0e2e..7915ba0c71cbe 100644 --- a/airbyte-integrations/connectors/source-cart/source_cart/streams.py +++ b/airbyte-integrations/connectors/source-cart/source_cart/streams.py @@ -138,3 +138,9 @@ class Products(IncrementalCartStream): """ Docs: https://developers.cart.com/docs/rest-api/restapi.json/paths/~1products/get """ + + +class Addresses(IncrementalCartStream): + """ + Docs: https://developers.cart.com/docs/rest-api/b3A6MjMzMTc3Njc-get-addresses + """