Skip to content

Commit

Permalink
add expand param for lines discounts (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
keyn4 authored Dec 4, 2023
1 parent 2247beb commit 3c8275b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
12 changes: 10 additions & 2 deletions tap_stripe/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ def get_starting_time(self, context):
rep_key = self.get_starting_timestamp(context)
return rep_key or start_date

def expand(self,second_request=False):
def expand(self):
return None

def lines_expand(self):
return None

@property
Expand Down Expand Up @@ -85,7 +88,9 @@ def get_url_params(
expansion = self.expand()
if not self.get_from_events and expansion:
params["expand[]"] = expansion

lines_expand = self.lines_expand()
if lines_expand:
params["expand[]"] = [expansion, lines_expand]
return params

@property
Expand Down Expand Up @@ -134,6 +139,9 @@ def parse_response(self, response: requests.Response) -> Iterable[dict]:
params = {}
if self.expand():
params["expand[]"] = self.expand()
lines_expand = self.lines_expand()
if lines_expand:
params["expand[]"] = [self.expand(), lines_expand]

response_obj = decorated_request(self.prepare_request_lines(url,params), {})
if response_obj.status_code in self.ignore_statuscode:
Expand Down
6 changes: 6 additions & 0 deletions tap_stripe/streams.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ def expand(self):
return "discounts"
else:
return "data.discounts"

def lines_expand(self):
if self.get_from_events:
return "lines.data.discounts"
else:
return "data.lines.data.discounts"

schema = th.PropertiesList(
th.Property("id", th.StringType),
Expand Down

0 comments on commit 3c8275b

Please sign in to comment.