コード例 #1
0
ファイル: legacy.py プロジェクト: matcher/glacier
	def _get_cached_merchant_items(self,merchantid):
                """
		Belirli bir merchant icin cache'de kayitli merchant itemlari alir

                @type merchantid: str
                @param merchantid: itemlarin ait oldugu merchantin IDsi

                @rtype: list (L{cimri.api.cimriservice.data.merchantitem.MerchantItem})
                @return: cache'de bulunan itemlarin listesi. cache bolumu yoksa ya da bir hata olusursa None
                """

		#check if we should use the cache
		if "cache.read" not in self.task.meta:
			return None

		#get section to use
		section=self.task.meta["cache.read"]

		#read cache
		content=Cache(section).get("matcher.legacy.items."+str(merchantid))
		if content is None:
			return None

		#parse
                try:
                        return MerchantItem.list_from_json(content,[])

                except Exception as e:
                        return None
コード例 #2
0
ファイル: merchants.py プロジェクト: matcher/glacier
	def get_item(self,id,**args):
		"""
		Kullanilmiyor
		"""

		self.logger.info("api call...")

		#make call
		packet=self.call(Template("merchants/items/$id").substitute(id=id),args=args)

		#parse and return item
		items=MerchantItem.list_from_json(packet,["merchant"])

		#return item
		return items[0] if items!=None else None
コード例 #3
0
ファイル: merchants.py プロジェクト: matcher/glacier
	def get_items_by_mpn(self,**args):
		"""
		MPN degerlerine dayanarak merchant itemlari alir

		@type	args: dict
		@param	args: API call icin url parametreleri. desteklenen bazi parametreler: 
				mpntype, mpnvalue, start (default=0), max (default=-1), fields (default=""), expandLevel (default=1)

		@rtype: L{cimri.api.cimriservice.data.merchantitem.MerchantItem}
		@return: MerchantItem listesi ya da hata durumunda None
		"""

		self.logger.info("api call...")

		#make call
		packet=self.call("merchants/items/search/mpn",args=args)
		if packet is None:
			return None

		#parse and return items
		return MerchantItem.list_from_json(packet,["merchantItem"])
コード例 #4
0
ファイル: merchants.py プロジェクト: matcher/glacier
	def search_items(self,**args):
		"""
		Merchant itemlar icin arama yapar

		@type	args: dict
		@param	args: API call icin url parametreleri. desteklenen bazi parametreler: 
			      queryString, start (default==0), max (default==-1), status, fields (default==""), expandLevel (default==1)

		@rtype: L{cimri.api.cimriservice.data.merchantitem.MerchantItem}
		@return: MerchantItem listesi ya da hata durumunda None
		"""

		self.logger.info("api call...")

		#make call
		packet=self.call(Template("merchants/$id/items/search/title").substitute(id=id),args=args)
		if packet is None:
			return None
		
		#parse and return items
		return MerchantItem.list_from_json(packet,["merchantItem"])
コード例 #5
0
ファイル: merchants.py プロジェクト: matcher/glacier
	def get_items(self,**args):
		"""
		Merchant itemlarini alir

		@type	args: dict
		@param	args: API call icin url parametreleri. desteklenen bazi parametreler: 
				status, sid, start (default=0), max (default=-1), fields (default=""), expandLevel (default=1),
				catIds, catId, merchantId, sortField, sortOrder, filter, itemId, cimriUrl, mCatNames

		@rtype: L{cimri.api.cimriservice.data.merchantitem.MerchantItem}
		@return: MerchantItem listesi ya da hata durumunda None
		"""

		self.logger.info("api call...")

		#sample http://glacier.cimri.com:8080/cimri-service/merchants/items?status=1&max=10
		packet=self.call("merchants/items",args=args)
		if packet is None:
			return None

		return MerchantItem.list_from_json(packet,["merchantItem"])
コード例 #6
0
ファイル: merchants.py プロジェクト: matcher/glacier
	def get_items_by_category(self,**args):
		"""
		Kategoriye gore merchant itemlari alir

		@type	args: dict
		@param	args: API call icin url parametreleri. desteklenen bazi parametreler: 
				mStatus, status, sortField, sortOrder, merchantId, start (default=0), max (default=-1),
				merchantCategory, filter, fields (default=""), expandLevel (default=1)

		@rtype: L{cimri.api.cimriservice.data.merchantitem.MerchantItem}
		@return: MerchantItem listesi ya da hata durumunda None
		"""

		self.logger.info("api call...")

		#sample http://glacier.cimri.com:8080/cimri-service/merchant/mItems/category?max-10
		packet=self.call("merchants/mItems/category",args=args)
		if packet is None:
			return None

		#parse and return items
		return MerchantItem.list_from_json(packet,["merchantItem"])
コード例 #7
0
ファイル: merchants.py プロジェクト: matcher/glacier
	def get_item_by_title(self,**args):
		"""
		Merchant item title'ina gore merchant itemlari alir

		@type	args: dict
		@param	args: API call icin url parametreleri. desteklenen bazi parametreler: 
				status, merchantItemTitle, merchantId,
				start (default=0), max (default=-1), fields (default=""), expandLevel (default=1), merchantItemId

		@rtype: L{cimri.api.cimriservice.data.merchantitem.MerchantItem}
		@return: MerchantItem listesi ya da hata durumunda None
		"""

		self.logger.info("api call...")

		#make call
		packet=self.call("merchants/itembyTitle",args=args)
		if packet is None:
			return None

		#parse and return items
		return MerchantItem.list_from_json(packet,["merchantItem"])
コード例 #8
0
ファイル: merchants.py プロジェクト: matcher/glacier
	def get_merchant_items(self,id,**args):
		"""
		Belli bir merchantin itemlarini alir

		@type 	id: str
		@param 	id: merchantId

		@type	args: dict
		@param	args: API call icin url parametreleri. desteklenen bazi parametreler: 
			      status, itemId, start (default==0), max (default==-1), fields (default==""), expandLebel (defaul==1)

		@rtype: L{cimri.api.cimriservice.data.merchantitem.MerchantItem}
		@return: MerchantItem listesi ya da hata durumunda None
		"""

		self.logger.info("api call...")

		#sample http://glacier.cimri.com:8080/cimri-service/merchants/2158/items
		packet=self.call(Template("merchants/$id/items").substitute(id=id),args=args)
		if packet is None:
			return None

		#parse and return items
		return MerchantItem.list_from_json(packet,["merchantItem"])