Skip to content

Commit

Permalink
Merge pull request #23 from ingresse/bugfix/csv-export-with-filters
Browse files Browse the repository at this point in the history
Add filters to my clients CSV export method
  • Loading branch information
vitorleal committed Feb 17, 2016
2 parents 69a06a7 + 9ad0342 commit 843c977
Showing 1 changed file with 30 additions and 2 deletions.
32 changes: 30 additions & 2 deletions app/scripts/IngresseAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,36 @@ angular.module('ingresseSDK')

return API._get('producer', identifier, filters);
},
getCustomerListCSVExportURL: function (producerId, token) {
return ingresseApiPreferences.getHost() + '/producer/' + producerId + '/customerExport' + API._generateAuthKey() + '&usertoken=' + token;
getCustomerListCSVExportURL: function (producerId, token, filters) {
var url = ingresseApiPreferences.getHost() + '/producer/' + producerId + '/customerExport' + API._generateAuthKey() + '&usertoken=' + token;

if (filters) {
if (filters.scorefrom) {
url += '&scorefrom=' + filters.scorefrom;
}

if (filters.scoreto) {
url += '&scoreto=' + filters.scoreto;
}

if (filters.event) {
url += '&event=' + filters.event;
}

if (filters.platform) {
url += '&platform=' + filters.platform;
}

if (filters.classification) {
url += '&classification=' + filters.classification;
}

if (filters.term) {
url += '&term=' + filters.term;
}
}

return url;
},
getSalesGroupReport: function (identifier, filters, token) {
identifier += '/salesgroupReport';
Expand Down

0 comments on commit 843c977

Please sign in to comment.