Skip to content

Commit

Permalink
Pass client to base method from entity create classmethods (#112)
Browse files Browse the repository at this point in the history
  • Loading branch information
rushabhvaria committed Jul 19, 2023
1 parent f48ced9 commit 929027c
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 4 deletions.
1 change: 1 addition & 0 deletions pinterest/ads/ad_accounts.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ def create(
},
api=AdAccountsApi,
create_fn=AdAccountsApi.ad_accounts_create,
client=cls._get_client(client),
)
return cls(ad_account_id=response.id, client=cls._get_client(client))

Expand Down
3 changes: 2 additions & 1 deletion pinterest/ads/ad_groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,8 @@ def create(
},
api=AdGroupsApi,
create_fn=AdGroupsApi.ad_groups_create,
map_fn=lambda obj: obj.items[0].data
map_fn=lambda obj: obj.items[0].data,
client=cls._get_client(client),
)
return cls(
ad_account_id=response.ad_account_id,
Expand Down
3 changes: 2 additions & 1 deletion pinterest/ads/ads.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,8 @@ def create(cls,
},
api=AdsApi,
create_fn=AdsApi.ads_create,
map_fn=lambda obj: obj.items[0].data
map_fn=lambda obj: obj.items[0].data,
client=cls._get_client(client),
)
return cls(
ad_account_id=response.ad_account_id,
Expand Down
3 changes: 2 additions & 1 deletion pinterest/ads/audiences.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,8 @@ def create(
),
},
api=AudiencesApi,
create_fn=AudiencesApi.audiences_create
create_fn=AudiencesApi.audiences_create,
client=cls._get_client(client),
)

return cls(
Expand Down
3 changes: 2 additions & 1 deletion pinterest/ads/campaigns.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,8 @@ def create(
},
api=CampaignsApi,
create_fn=CampaignsApi.campaigns_create,
map_fn=lambda obj: obj.items[0].data
map_fn=lambda obj: obj.items[0].data,
client=cls._get_client(client),
)

return cls(
Expand Down
1 change: 1 addition & 0 deletions pinterest/ads/conversion_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ def create(
api = ConversionTagsApi,
create_fn = ConversionTagsApi.conversion_tags_create,
map_fn = lambda obj : obj,
client=cls._get_client(client),
)


Expand Down
1 change: 1 addition & 0 deletions pinterest/ads/customer_lists.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ def create(
},
api=CustomerListsApi,
create_fn=CustomerListsApi.customer_lists_create,
client=cls._get_client(client),
)

return cls(
Expand Down
1 change: 1 addition & 0 deletions pinterest/ads/keywords.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ def map_fn(obj):
api=KeywordsApi,
create_fn=KeywordsApi.keywords_create,
map_fn=map_fn,
client=cls._get_client(client),
)

return cls(
Expand Down

0 comments on commit 929027c

Please sign in to comment.