Skip to content

Commit

Permalink
Source Cart.com: add order_statuses and increase pagesize to 1000 (#1…
Browse files Browse the repository at this point in the history
…4752)

* add order_statuses

* update schema

* update schema

* bump connector dockerfile version

* update changelog

* increase pagesize limit from 100 to 1000

* correct schemas

* auto-bump connector version

Co-authored-by: Octavia Squidington III <octavia-squidington-iii@users.noreply.github.com>
  • Loading branch information
marcosmarxm and octavia-squidington-iii authored Jul 16, 2022
1 parent 133ae07 commit db8a200
Show file tree
Hide file tree
Showing 11 changed files with 70 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
- name: Cart.com
sourceDefinitionId: bb1a6d31-6879-4819-a2bd-3eed299ea8e2
dockerRepository: airbyte/source-cart
dockerImageTag: 0.1.5
dockerImageTag: 0.1.6
documentationUrl: https://docs.airbyte.io/integrations/sources/cart
icon: cart.svg
sourceType: api
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1036,7 +1036,7 @@
supportsNormalization: false
supportsDBT: false
supported_destination_sync_modes: []
- dockerImage: "airbyte/source-cart:0.1.5"
- dockerImage: "airbyte/source-cart:0.1.6"
spec:
documentationUrl: "https://docs.airbyte.io/integrations/sources/cart"
connectionSpecification:
Expand Down
2 changes: 1 addition & 1 deletion airbyte-integrations/connectors/source-cart/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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.5
LABEL io.airbyte.version=0.1.6
LABEL io.airbyte.name=airbyte/source-cart
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
"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" },
"addresses": { "updated_at": "2051-07-01T08:59:28.457-05:00" }
"addresses": { "updated_at": "2051-07-01T08:59:28.457-05:00" },
"order_statuses": { "updated_at": "2051-07-01T08:59:28.457-05:00" }
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,18 @@
"cursor_field": ["updated_at"],
"destination_sync_mode": "append"
},
{
"stream": {
"name": "order_statuses",
"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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
"type": ["string", "null"]
},
"is_approved": {
"type": "boolean"
"type": ["boolean", "null"]
},
"is_declined": {
"type": "boolean"
"type": ["boolean", "null"]
},
"card_type": {
"type": ["string", "null"]
Expand Down Expand Up @@ -65,16 +65,16 @@
"type": ["string", "null"]
},
"updated_at": {
"type": "string"
"type": ["string", "null"]
},
"created_at": {
"type": "string"
"type": ["string", "null"]
},
"gift_certificate_id": {
"type": ["integer", "null"]
},
"is_captured": {
"type": "boolean"
"type": ["boolean", "null"]
},
"transaction_id": {
"type": ["string", "null"]
Expand All @@ -83,7 +83,7 @@
"type": ["string", "null"]
},
"is_void": {
"type": "boolean"
"type": ["boolean", "null"]
},
"gateway_response_code": {
"type": ["string", "null"]
Expand All @@ -92,7 +92,7 @@
"type": ["string", "null"]
},
"sent_to_spark_pay": {
"type": "boolean"
"type": ["boolean", "null"]
},
"token": {
"type": ["string", "null"]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"type": "object",
"properties": {
"id": { "type": "integer" },
"name": { "type": ["null", "string"] },
"is_open": { "type": ["null", "boolean"] },
"is_declined": { "type": ["null", "boolean"] },
"is_cancelled": { "type": ["null", "boolean"] },
"is_shipped": { "type": ["null", "boolean"] },
"color": { "type": ["null", "string"] },
"email_template_id": { "type": ["null", "integer"] },
"updated_at": { "type": ["null", "string"] },
"created_at": { "type": ["null", "string"] },
"is_fully_refunded": { "type": ["null", "boolean"] },
"is_partially_refunded": { "type": ["null", "boolean"] },
"is_quote_status": { "type": ["null", "boolean"] }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
"type": ["string", "null"]
},
"is_ppc": {
"type": "boolean"
"type": ["boolean", "null"]
},
"ppc_keyword": {
"type": ["string", "null"]
Expand All @@ -86,7 +86,7 @@
"type": ["number", "null"]
},
"is_payment_order_only": {
"type": "boolean"
"type": ["boolean", "null"]
},
"selected_shipping_provider_service": {
"type": ["string", "null"]
Expand All @@ -98,13 +98,13 @@
"type": ["integer", "null"]
},
"updated_at": {
"type": "string"
"type": ["string", "null"]
},
"created_at": {
"type": "string"
"type": ["string", "null"]
},
"is_gift": {
"type": "boolean"
"type": ["boolean", "null"]
},
"gift_message": {
"type": ["string", "null"]
Expand Down Expand Up @@ -143,7 +143,7 @@
"type": ["string", "null"]
},
"expires": {
"type": "boolean"
"type": ["boolean", "null"]
},
"from_quote_id": {
"type": ["integer", "null"]
Expand All @@ -152,7 +152,7 @@
"type": ["string", "null"]
},
"reward_points_credited": {
"type": "boolean"
"type": ["boolean", "null"]
},
"channel": {
"type": ["string", "null"]
Expand All @@ -167,7 +167,7 @@
"type": ["number", "null"]
},
"manufacturer_invoice_paid": {
"type": "boolean"
"type": ["boolean", "null"]
},
"entered_by": {
"type": ["string", "null"]
Expand Down
12 changes: 10 additions & 2 deletions airbyte-integrations/connectors/source-cart/source_cart/source.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from airbyte_cdk.sources.streams.http.auth import HttpAuthenticator
from pendulum.parsing.exceptions import ParserError

from .streams import Addresses, CustomersCart, OrderItems, OrderPayments, Orders, Products
from .streams import Addresses, CustomersCart, OrderItems, OrderPayments, Orders, OrderStatuses, Products


class CustomHeaderAuthenticator(HttpAuthenticator):
Expand Down Expand Up @@ -74,4 +74,12 @@ 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), Addresses(**args)]
return [
CustomersCart(**args),
Orders(**args),
OrderPayments(**args),
OrderStatuses(**args),
OrderItems(**args),
Products(**args),
Addresses(**args),
]
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def parse_response(self, response: requests.Response, stream_state: Mapping[str,
def request_params(
self, stream_state: Mapping[str, Any], stream_slice: Mapping[str, Any] = None, next_page_token: Mapping[str, Any] = None
) -> MutableMapping[str, Any]:
params = {"count": 100}
params = {"count": 1000}
if next_page_token:
params.update(next_page_token)
return params
Expand Down Expand Up @@ -134,6 +134,14 @@ class OrderItems(IncrementalCartStream):
data_field = "items"


class OrderStatuses(IncrementalCartStream):
"""
Docs: https://developers.cart.com/docs/rest-api/ff5ada86bc8a0-get-order-statuses
"""

data_field = "order_statuses"


class Products(IncrementalCartStream):
"""
Docs: https://developers.cart.com/docs/rest-api/restapi.json/paths/~1products/get
Expand Down
1 change: 1 addition & 0 deletions docs/integrations/sources/cart.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ Please follow these [steps](https://developers.cart.com/docs/rest-api/docs/READM

| Version | Date | Pull Request | Subject |
| :--- | :--- | :--- | :--- |
| 0.1.6 | 2022-07-15 | [14752](https://github.com/airbytehq/airbyte/pull/14752) | Add `order_statuses` stream |
| 0.1.5 | 2021-12-23 | [8434](https://github.com/airbytehq/airbyte/pull/8434) | Update fields in source-connectors specifications |
| 0.1.3 | 2021-08-26 | [5465](https://github.com/airbytehq/airbyte/pull/5465) | Add the end\_date option for limitation of the amount of synced data |
| 0.1.2 | 2021-08-23 | [1111](https://github.com/airbytehq/airbyte/pull/1111) | Add `order_items` stream |
Expand Down

0 comments on commit db8a200

Please sign in to comment.