diff --git a/pyproject.toml b/pyproject.toml index a9e6b50..5e20ce5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "tap-googleads" -version = "0.3.1" +version = "0.3.2" description = "`tap-googleads` is a Singer tap for GoogleAds, built with the Meltano SDK for Singer Taps." authors = ["AutoIDM", "Matatika"] keywords = [ diff --git a/tap_googleads/client.py b/tap_googleads/client.py index 99b9721..305d8e8 100644 --- a/tap_googleads/client.py +++ b/tap_googleads/client.py @@ -24,7 +24,7 @@ class GoogleAdsStream(RESTStream): """GoogleAds stream class.""" - url_base = "https://googleads.googleapis.com/v9" + url_base = "https://googleads.googleapis.com/v12" records_jsonpath = "$[*]" # Or override `parse_response`. next_page_token_jsonpath = "$.nextPageToken" # Or override `get_next_page_token`. diff --git a/tap_googleads/streams.py b/tap_googleads/streams.py index 357f2e1..f5fbd68 100644 --- a/tap_googleads/streams.py +++ b/tap_googleads/streams.py @@ -14,19 +14,6 @@ # - Copy-paste as many times as needed to create multiple stream types. -class CustomerStream(GoogleAdsStream): - """Define custom stream.""" - - @property - def path(self): - return "/customers/" + self.config["customer_id"] - - name = "stream_customers" - primary_keys = ["id"] - replication_key = None - schema_filepath = SCHEMAS_DIR / "customer.json" - - class AccessibleCustomers(GoogleAdsStream): """Accessible Customers""" @@ -34,8 +21,6 @@ class AccessibleCustomers(GoogleAdsStream): name = "stream_accessible_customers" primary_keys = ["resource_names"] replication_key = None - # TODO add an assert for one record - # schema_filepath = SCHEMAS_DIR / "customer.json" schema = th.PropertiesList( th.Property("resourceNames", th.ArrayType(th.StringType)) ).to_dict() @@ -55,13 +40,12 @@ class CustomerHierarchyStream(GoogleAdsStream): """ - # TODO add a seperate stream to get the Customer information and return i rest_method = "POST" @property def path(self): # Paramas - path = "/customers/{client_id}" + path = f"/customers/{self.config.get('customer_id')}" path = path + "/googleAds:search" path = path + "?pageSize=10000" path = path + f"&query={self.gaql}" @@ -117,7 +101,6 @@ def get_records(self, context: Optional[dict]) -> Iterable[Dict[str, Any]]: One item per (possibly processed) record in the API. """ - context["client_id"] = self.config.get("customer_id") for row in self.request_records(context): row = self.post_process(row, context) # Don't search Manager accounts as we can't query them for everything @@ -166,7 +149,7 @@ def gaql(self): @property def path(self): # Paramas - path = "/customers/{client_id}" + path = f"/customers/{self.config.get('customer_id')}" path = path + "/googleAds:search" path = path + "?pageSize=10000" path = path + f"&query={self.gaql}" diff --git a/tap_googleads/tap.py b/tap_googleads/tap.py index 29f6ad5..9a78714 100644 --- a/tap_googleads/tap.py +++ b/tap_googleads/tap.py @@ -6,7 +6,6 @@ from singer_sdk import typing as th # JSON schema typing helpers from tap_googleads.streams import ( - CustomerStream, CampaignsStream, AdGroupsStream, AdGroupsPerformance, @@ -20,7 +19,6 @@ ) STREAM_TYPES = [ - CustomerStream, CampaignsStream, AdGroupsStream, AdGroupsPerformance, diff --git a/tap_googleads/tests/test_base_credentials.py b/tap_googleads/tests/test_base_credentials.py index 1e99656..86139a1 100644 --- a/tap_googleads/tests/test_base_credentials.py +++ b/tap_googleads/tests/test_base_credentials.py @@ -33,7 +33,7 @@ def test_base_credentials_discovery(self): catalog = TapGoogleAds(self.mock_config).discover_streams() # expect valid catalog to be discovered - self.assertEqual(len(catalog), 11, "Total streams from default catalog") + self.assertEqual(len(catalog), 10, "Total streams from default catalog") @responses.activate def test_googleads_sync_accessible_customers(self): @@ -53,7 +53,7 @@ def test_googleads_sync_accessible_customers(self): responses.add( responses.GET, - "https://googleads.googleapis.com/v9/customers:listAccessibleCustomers", + "https://googleads.googleapis.com/v12/customers:listAccessibleCustomers", json=test_utils.accessible_customer_return_data, status=200, ) diff --git a/tap_googleads/tests/test_proxy_oauth.py b/tap_googleads/tests/test_proxy_oauth.py index 28b6d71..480bc66 100644 --- a/tap_googleads/tests/test_proxy_oauth.py +++ b/tap_googleads/tests/test_proxy_oauth.py @@ -32,7 +32,7 @@ def test_proxy_oauth_discovery(self): catalog = TapGoogleAds(self.mock_config).discover_streams() # Assert the correct number of default streams found - self.assertEqual(len(catalog), 11, "Total streams from default catalog") + self.assertEqual(len(catalog), 10, "Total streams from default catalog") @responses.activate def test_proxy_oauth_refresh(self): @@ -51,7 +51,7 @@ def test_proxy_oauth_refresh(self): responses.add( responses.GET, - "https://googleads.googleapis.com/v9/customers:listAccessibleCustomers", + "https://googleads.googleapis.com/v12/customers:listAccessibleCustomers", json=test_utils.accessible_customer_return_data, status=200, )