Pending changes update

This commit is contained in:
Kifixo
2024-02-28 20:33:44 +01:00
parent 6032b33874
commit f2416ee35a
5 changed files with 84 additions and 39 deletions

View File

@@ -1,12 +1,14 @@
class Article:
def __init__(self, id, title, description, price, currency, url):
def __init__(self, id, title, description, price, currency, location, allows_shipping, url):
self._id = id
self._title = title
self._description = description
self._price = price
self._currency = currency
self._location = location
self._allows_shipping = allows_shipping
self._url = url
@classmethod
@@ -17,6 +19,8 @@ class Article:
json_data['description'],
json_data['price'],
json_data['currency'],
json_data['location']['city'],
json_data['shipping']['user_allows_shipping'],
json_data['web_slug']
)
@@ -35,8 +39,18 @@ class Article:
def get_currency(self):
return self._currency
def get_location(self):
return self._location
def get_allows_shipping(self):
return self._allows_shipping
def get_url(self):
return self._url
def __eq__(self, article2):
return self.get_id() == article2.get_id()
return self.get_id() == article2.get_id()
def __str__(self):
return f"Article(id={self._id}, title='{self._title}', description='{self._description}', " \
f"price={self._price} {self._currency}, url='{self._url}')"