Skip to content

Commit 6e180fa

Browse files
committed
Added a class for Deals.
1 parent 77320de commit 6e180fa

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

yelp.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,3 +319,43 @@ def NewFromJsonDict(data):
319319
neighborhoods=data.get("neighborhoods", None),
320320
postal_code=data.get("postal_code", None),
321321
state_code=data.get("state_code", None))
322+
323+
324+
class Deal(object):
325+
def __init__(self,
326+
id=None,
327+
title=None,
328+
url=None,
329+
currency_code=None,
330+
time_start=None,
331+
time_end=None,
332+
is_popular=None,
333+
what_you_get=None,
334+
important_restrictions=None,
335+
additional_restrictions=None,
336+
options=None,):
337+
self.id = id
338+
self.title = title
339+
self.url = url
340+
self.currency_code = currency_code
341+
self.time_start = time_start
342+
self.time_end = time_end
343+
self.is_popular = is_popular
344+
self.what_you_get = what_you_get
345+
self.important_restrictions = important_restrictions
346+
self.additional_restrictions = additional_restrictions
347+
self.options = options
348+
349+
@staticmethod
350+
def NewFromJsonDict(data):
351+
return Deal(id=data.get("id", None),
352+
title=data.get("title", None),
353+
url=data.get("url", None),
354+
currency_code=data.get("currency_code", None),
355+
time_start=data.get("time_start", None),
356+
time_end=data.get("time_end", None),
357+
is_popular=data.get("is_popular", None),
358+
what_you_get=data.get("what_you_get", None),
359+
important_restrictions=data.get("what_you_get", None),
360+
additional_restrictions=data.get("additional_restrictions", None),
361+
options=data.get("options"))

0 commit comments

Comments
 (0)