Skip to content

Commit

Permalink
adding credit_block_id to columns obtained from Orb API (#16017)
Browse files Browse the repository at this point in the history
* adding credit_block_id to columns obtained from Orb API

* switch additional properties from false to true

* Update orb.md (#16020)

updating changelog for orb credit block id upgrade

* bump image tag

* auto-bump connector version [ci skip]

Co-authored-by: Tim Chan <tim@chan.net>
Co-authored-by: Octavia Squidington III <octavia-squidington-iii@users.noreply.github.com>
  • Loading branch information
3 people authored Aug 26, 2022
1 parent f63d9f8 commit 00aca98
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,7 @@
- name: Orb
sourceDefinitionId: 7f0455fb-4518-4ec0-b7a3-d808bf8081cc
dockerRepository: airbyte/source-orb
dockerImageTag: 0.1.2
dockerImageTag: 0.1.3
documentationUrl: https://docs.airbyte.io/integrations/sources/orb
icon: orb.svg
sourceType: api
Expand Down
4 changes: 2 additions & 2 deletions airbyte-config/init/src/main/resources/seed/source_specs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6964,7 +6964,7 @@
supportsNormalization: false
supportsDBT: false
supported_destination_sync_modes: []
- dockerImage: "airbyte/source-orb:0.1.2"
- dockerImage: "airbyte/source-orb:0.1.3"
spec:
documentationUrl: "https://docs.withorb.com/"
connectionSpecification:
Expand All @@ -6973,7 +6973,7 @@
type: "object"
required:
- "api_key"
additionalProperties: false
additionalProperties: true
properties:
api_key:
type: "string"
Expand Down
2 changes: 1 addition & 1 deletion airbyte-integrations/connectors/source-orb/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ COPY source_orb ./source_orb
ENV AIRBYTE_ENTRYPOINT "python /airbyte/integration_code/main.py"
ENTRYPOINT ["python", "/airbyte/integration_code/main.py"]

LABEL io.airbyte.version=0.1.2
LABEL io.airbyte.version=0.1.3
LABEL io.airbyte.name=airbyte/source-orb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@
},
"description": {
"type": ["null", "string"]
},
"credit_block_id": {
"type": ["null", "string"]
}
},
"required": [
Expand All @@ -48,6 +51,7 @@
"customer_id",
"entry_type",
"credit_block_per_unit_cost_basis",
"description"
"description",
"credit_block_id"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -275,11 +275,13 @@ def transform_record(self, ledger_entry_record):
del ledger_entry_record["customer"]
ledger_entry_record["customer_id"] = nested_customer_id

# Un-nest credit_block -> expiry_date into block_expiry_date and per_unit_cost_basis
# Un-nest credit_block -> expiry_date into block_expiry_date and id and per_unit_cost_basis
nested_expiry_date = ledger_entry_record["credit_block"]["expiry_date"]
nested_id = ledger_entry_record["credit_block"]["id"]
nested_per_unit_cost_basis = ledger_entry_record["credit_block"]["per_unit_cost_basis"]
del ledger_entry_record["credit_block"]
ledger_entry_record["block_expiry_date"] = nested_expiry_date
ledger_entry_record["credit_block_id"] = nested_id
ledger_entry_record["credit_block_per_unit_cost_basis"] = nested_per_unit_cost_basis

return ledger_entry_record
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"title": "Orb Spec",
"type": "object",
"required": ["api_key"],
"additionalProperties": false,
"additionalProperties": true,
"properties": {
"api_key": {
"type": "string",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ def test_credits_ledger_entries_transform_record(mocker):
"customer": {
"id": "foo-customer-id",
},
"credit_block": {"expiry_date": "2023-01-25T12:00:00+00:00", "per_unit_cost_basis": "2.50"},
"credit_block": {"expiry_date": "2023-01-25T12:00:00+00:00", "id": "2k6hj0s8dfhj0d7h", "per_unit_cost_basis": "2.50"},
}

# Validate that calling transform record unwraps nested customer and credit block fields.
Expand All @@ -187,6 +187,7 @@ def test_credits_ledger_entries_transform_record(mocker):
"entry_type": "decrement",
"customer_id": "foo-customer-id",
"block_expiry_date": "2023-01-25T12:00:00+00:00",
"credit_block_id": "2k6hj0s8dfhj0d7h",
"credit_block_per_unit_cost_basis": "2.50",
}

Expand Down
1 change: 1 addition & 0 deletions docs/integrations/sources/orb.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ an Orb Account and API Key.

| Version | Date | Pull Request | Subject |
| --- | --- | --- | --- |
| 0.1.3 | 2022-08-26 | [16017](https://github.com/airbytehq/airbyte/pull/16017) | Add credit block id to ledger entries
| 0.1.2 | 2022-04-20 | [11528](https://github.com/airbytehq/airbyte/pull/11528) | Add cost basis to ledger entries, update expiration date, sync only committed entries
| 0.1.1 | 2022-03-03 | [10839](https://github.com/airbytehq/airbyte/pull/10839) | Support ledger entries with numeric properties + schema fixes
| 0.1.0 | 2022-02-01 | | New Source: Orb
Expand Down

0 comments on commit 00aca98

Please sign in to comment.