diff --git a/airbyte-integrations/connectors/source-cart/Dockerfile b/airbyte-integrations/connectors/source-cart/Dockerfile index 992246e6f08f2..3397e09ea518a 100644 --- a/airbyte-integrations/connectors/source-cart/Dockerfile +++ b/airbyte-integrations/connectors/source-cart/Dockerfile @@ -12,5 +12,5 @@ RUN pip install . ENV AIRBYTE_ENTRYPOINT "python /airbyte/integration_code/main.py" ENTRYPOINT ["python", "/airbyte/integration_code/main.py"] -LABEL io.airbyte.version=0.1.1 +LABEL io.airbyte.version=0.1.2 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 07ecbf4ecb643..dfe5615349f17 100644 --- a/airbyte-integrations/connectors/source-cart/integration_tests/abnormal_state.json +++ b/airbyte-integrations/connectors/source-cart/integration_tests/abnormal_state.json @@ -2,5 +2,6 @@ "customers_cart": { "updated_at": "2051-07-01T08:59:28.457-05:00" }, "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" } } 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 1654d2a2374c6..ecad4beb43c8f 100644 --- a/airbyte-integrations/connectors/source-cart/integration_tests/configured_catalog.json +++ b/airbyte-integrations/connectors/source-cart/integration_tests/configured_catalog.json @@ -36,6 +36,18 @@ "cursor_field": ["updated_at"], "destination_sync_mode": "append" }, + { + "stream": { + "name": "order_items", + "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": "products", diff --git a/airbyte-integrations/connectors/source-cart/source_cart/schemas/order_items.json b/airbyte-integrations/connectors/source-cart/source_cart/schemas/order_items.json new file mode 100644 index 0000000000000..e803c78c5ac1a --- /dev/null +++ b/airbyte-integrations/connectors/source-cart/source_cart/schemas/order_items.json @@ -0,0 +1,86 @@ +{ + "type": "object", + "properties": { + "id": { + "type": "integer" + }, + "order_id": { + "type": ["integer", "null"] + }, + "product_id": { + "type": ["integer", "null"] + }, + "item_number": { + "type": ["string", "null"] + }, + "item_name": { + "type": ["string", "null"] + }, + "price": { + "type": ["number", "null"] + }, + "cost": { + "type": ["number", "null"] + }, + "quantity": { + "type": ["integer", "null"] + }, + "is_discount_item": { + "type": ["boolean", "null"] + }, + "weight": { + "type": ["number", "null"] + }, + "is_taxable": { + "type": ["boolean", "null"] + }, + "weigh_unit": { + "type": ["string", "null"] + }, + "parent_order_item_id": { + "type": ["integer", "null"] + }, + "is_quantity_bound_to_parent": { + "type": ["boolean", "null"] + }, + "updated_at": { + "type": ["string", "null"] + }, + "created_at": { + "type": ["string", "null"] + }, + "height": { + "type": ["number", "null"] + }, + "length": { + "type": ["number", "null"] + }, + "width": { + "type": ["number", "null"] + }, + "size_unit": { + "type": ["string", "null"] + }, + "admin_comments": { + "type": ["string", "null"] + }, + "do_not_discount": { + "type": ["boolean", "null"] + }, + "line_item_note": { + "type": ["string", "null"] + }, + "gift_message": { + "type": ["string", "null"] + }, + "delivery_date": { + "type": ["string", "null"] + }, + "is_subscription_product": { + "type": ["boolean", "null"] + }, + "warehouse_id": { + "type": ["integer", "null"] + } + } +} diff --git a/airbyte-integrations/connectors/source-cart/source_cart/source.py b/airbyte-integrations/connectors/source-cart/source_cart/source.py index 047a8869ad97a..8ac6178dcdcda 100644 --- a/airbyte-integrations/connectors/source-cart/source_cart/source.py +++ b/airbyte-integrations/connectors/source-cart/source_cart/source.py @@ -32,7 +32,7 @@ from airbyte_cdk.sources.streams import Stream from airbyte_cdk.sources.streams.http.auth import HttpAuthenticator -from .streams import CustomersCart, OrderPayments, Orders, Products +from .streams import CustomersCart, OrderItems, OrderPayments, Orders, Products class CustomHeaderAuthenticator(HttpAuthenticator): @@ -63,4 +63,4 @@ def check_connection(self, logger: AirbyteLogger, config: Mapping[str, Any]) -> def streams(self, config: Mapping[str, Any]) -> List[Stream]: authenticator = CustomHeaderAuthenticator(access_token=config["access_token"]) args = {"authenticator": authenticator, "start_date": config["start_date"], "store_name": config["store_name"]} - return [CustomersCart(**args), Orders(**args), OrderPayments(**args), Products(**args)] + return [CustomersCart(**args), Orders(**args), OrderPayments(**args), OrderItems(**args), Products(**args)] diff --git a/airbyte-integrations/connectors/source-cart/source_cart/spec.json b/airbyte-integrations/connectors/source-cart/source_cart/spec.json index 50155c988dd3d..62b9adba25884 100644 --- a/airbyte-integrations/connectors/source-cart/source_cart/spec.json +++ b/airbyte-integrations/connectors/source-cart/source_cart/spec.json @@ -5,7 +5,7 @@ "title": "Cart Spec", "type": "object", "required": ["access_token", "start_date", "store_name"], - "additionalProperties": false, + "additionalProperties": true, "properties": { "access_token": { "type": "string", @@ -17,7 +17,7 @@ "type": "string", "description": "The date from which you'd like to replicate the data", "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z$", - "examples": "2021-01-01T00:00:00Z" + "examples": ["2021-01-01T00:00:00Z"] }, "store_name": { "type": "string", diff --git a/airbyte-integrations/connectors/source-cart/source_cart/streams.py b/airbyte-integrations/connectors/source-cart/source_cart/streams.py index 6187bfad62a86..2eb47fd720d32 100644 --- a/airbyte-integrations/connectors/source-cart/source_cart/streams.py +++ b/airbyte-integrations/connectors/source-cart/source_cart/streams.py @@ -136,6 +136,17 @@ def path(self, **kwargs) -> str: return "order_payments" +class OrderItems(IncrementalCartStream): + """ + Docs: https://developers.cart.com/docs/rest-api/restapi.json/paths/~1order_items/get + """ + + data_field = "items" + + def path(self, **kwargs) -> str: + return "order_items" + + class Products(IncrementalCartStream): """ Docs: https://developers.cart.com/docs/rest-api/restapi.json/paths/~1products/get diff --git a/airbyte-integrations/connectors/source-intercom/unit_tests/unit_test.py b/airbyte-integrations/connectors/source-intercom/unit_tests/unit_test.py index b4b7b7b583cff..a5673d0d84e1b 100644 --- a/airbyte-integrations/connectors/source-intercom/unit_tests/unit_test.py +++ b/airbyte-integrations/connectors/source-intercom/unit_tests/unit_test.py @@ -43,8 +43,9 @@ Contacts, { "data": [], - "pages": {"next": {"starting_after": "1HaSB+xrOyyMXAkS/c1RteCL7BzOzTvYjmjakgTergIH31eoe2v4/sbLsJWP" - "\nIncfQLD3ouPkZlCwJ86F\n"}}, + "pages": { + "next": {"starting_after": "1HaSB+xrOyyMXAkS/c1RteCL7BzOzTvYjmjakgTergIH31eoe2v4/sbLsJWP" "\nIncfQLD3ouPkZlCwJ86F\n"} + }, }, {"starting_after": "1HaSB+xrOyyMXAkS/c1RteCL7BzOzTvYjmjakgTergIH31eoe2v4/sbLsJWP\nIncfQLD3ouPkZlCwJ86F\n"}, ), diff --git a/docs/integrations/sources/cart.md b/docs/integrations/sources/cart.md index 3def5e1ba9579..0125ddd2f876b 100644 --- a/docs/integrations/sources/cart.md +++ b/docs/integrations/sources/cart.md @@ -51,4 +51,5 @@ Please follow these [steps](https://developers.cart.com/docs/rest-api/docs/READM | Version | Date | Pull Request | Subject | | :------ | :-------- | :----- | :------ | +| 0.1.2 | 2021-08-23 | [1111](https://github.com/airbytehq/airbyte/pull/1111) | Add `order_items` stream | | 0.1.0 | 2021-06-08 | [4574](https://github.com/airbytehq/airbyte/pull/4574) | Initial Release |