예제 #1
0
 def createAudienceGroupRequest(requestParam={}, audienceType='FILTER_BASED'):
     csobj = campaignShardObject()
     tmpDict = {
         'orgId': constant.config['orgId'],
         'label': 'createGroupRecipient_{}'.format(int(time.time() * 1000)),
         'description': 'createGroupRecipient_Description_{}'.format(int(time.time() * 1000)),
         'type': csobj.CampaignGroupType[audienceType],
         'createdBy': int(constant.config['userId']),
         'requestId': Utils.generateGUID()
     }
     tmpDict.update(requestParam)
     return campaignShard.CreateAudienceRequest(**tmpDict)
예제 #2
0
 def createAudienceRequest(requestParam={}, audienceType='FILTER_BASED'):
     csobj = campaignShardObject()
     tmpDict = {
         'orgId': constant.config['orgId'],
         'label': 'createGroupRecipient_{}'.format(int(time.time() * 1000)),
         'description': 'createGroupRecipient_Description_{}'.format(int(time.time() * 1000)),
         'type': csobj.CampaignGroupType[audienceType],
         'createdBy': int(constant.config['userId']),
         'requestId': Utils.generateGUID()
     }
     if audienceType == 'FILTER_BASED':
         filterRequestDict = {'s3BucketTag': 'reon', 's3Headers': 'test_control_status,USER_ID'}
         filterRequestDict.update(constant.orgDetails[constant.config['cluster']][constant.config['orgId']]['s3'])
         filterRequestObj = {'filterRequest': campaignShard.FilterAudienceRequest(**filterRequestDict)}
         tmpDict.update(filterRequestObj)
     elif audienceType == 'UPLOAD':  # Still in Development & testcases not implemented
         tmpDict.update({'type': 0, 'identifiers': [], 's3BucketTag': 'reon', 'dataSource': 0})
     elif audienceType == 'DERIVED':  # Still in Development & testcases not implemented
         tmpDict.update({'includeGroups': 12, 'excludeGroups': 21})
     tmpDict.update(requestParam)
     return campaignShard.CreateAudienceRequest(**tmpDict)
예제 #3
0
    def communicationDetail(messageDetails={}, extraParams={}):
        tmpDict = {
            'orgId': constant.config['orgId'],
            'guid': Utils.generateGUID(),
            'subject': 'Veneno Thrift Automation',
            'body': 'Thirft Created Automation Test Body {{optout}}',
            'priority': 2,
            'defaultArguments': '',
            'messageProperties': '',
            'communicationType': 'EMAIL',
            'targetType': 'GROUPED',
            'message_queue_id': 0,
            'receivedTime': str(Utils.getTime(milliSeconds=True)),
            'lastUpdatedBy': int(constant.config['userId'])
        }
        messageExtraUpdate = {}
        defaultExtraParam = {}

        if extraParams != {}:
            if 'voucher_series' in extraParams:
                messageExtraUpdate.update(
                    {'voucher_series': extraParams['voucher_series']})
            if 'default_argument' in extraParams:
                defaultExtraParam.update(extraParams['default_argument'])

        tmpDict.update(messageDetails)
        venObj = VenenoObject()
        tmpDict['defaultArguments'] = VenenoHelper.getDefaultArguments(
            channel=tmpDict['communicationType'],
            fieldsToUpdate=defaultExtraParam)
        tmpDict['messageProperties'] = VenenoHelper.getMessageProperties(
            channel=tmpDict['communicationType'],
            fieldsToUpdate=messageExtraUpdate)
        tmpDict['communicationType'] = venObj.CommunicationType[
            tmpDict['communicationType']]
        tmpDict['targetType'] = venObj.TargetType[tmpDict['targetType']]
        return veneno.CommunicationDetail(**tmpDict)