def call_rank(self, client, cfg, aid, customer, entity): view, ids = json.loads(entity).popitem() p = RankingParams() p.anonymous = aid p.customer = customer p.view = view p.ids = ids p.application = cfg['application'] p.entity_type = cfg['entityType'] log.debug('Running client.get_rankings("%s", "%s", "%s", {...})' % (p.anonymous, p.customer, p.view)) return client.get_rankings(p, oauth_token=cfg['authToken'])
def make_scope_ranking_call(self, sale_id, id_list): rankingParams = RankingParams() rankingParams.anonymous = 'some-anon-id' rankingParams.view = "/sales/" + sale_id rankingParams.entity_source = "scope" def entry(name, value): item = ScopeEntry() item.name = name item.value = value return item rankingParams.scope = [ entry('sale', sale_id), entry('color', 'red'), entry('size', 'M') ] rankingParams.entity_type = "products" rankingParams.application = "mobile_event_page" return self.client.get_rankings(rankingParams, oauth_token=self.oauth_token)
def make_scope_ranking_call(self, sale_id, id_list): rankingParams = RankingParams() rankingParams.anonymous = 'some-anon-id' rankingParams.view = "/sales/" + sale_id rankingParams.entity_source = "scope" def entry(name, value): item = ScopeEntry() item.name = name item.value = value return item rankingParams.scope = [ entry('sale', sale_id), entry('color', 'red'), entry('size', 'M') ] rankingParams.entity_type = "products" rankingParams.application = "mobile_event_page" return self.client.get_rankings(rankingParams, oauth_token=self.oauth_token)