Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion adWordsObject.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function AdWordsObject(options) {
// check if all credentials are supplied
if (
!options.ADWORDS_CLIENT_ID ||
!options.ADWORDS_CLIENT_CUSTOMER_ID ||
// !options.ADWORDS_CLIENT_CUSTOMER_ID || // ClientCustomerID is not requeried for customerService.js
!options.ADWORDS_DEVELOPER_TOKEN ||
!options.ADWORDS_REFRESH_TOKEN ||
!options.ADWORDS_SECRET ||
Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ module.exports = {
TrafficEstimatorService: require('./services/trafficEstimatorService'),

// Account management
CustomerService: null,
CustomerService: require('./services/customerService'),
CustomerSyncService: null,
ManagedCustomerService: require('./services/managedCustomerService'),

Expand Down
52 changes: 52 additions & 0 deletions services/customerService.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
var
_ = require('lodash'),
async = require('async'),
soap = require('soap');

var AdWordsService = require('./adWordsService');
var types = require('../types/customerService');

function Service(options) {
var self = this;
AdWordsService.call(self, options);
self.Collection = types.collection;
self.Model = types.model;

self.parseGetResponse = function(response) {
if (self.validateOnly) {
return {};
} else {
if (response.rval) {
return new self.Collection(response.rval);
} else {
return {};
}
}
};

self.parseQueryResponse = function(response) {
return self.parseGetResponse(response);
};

self.selectable = [
'customerId',
'currencyCode',
'dateTimeZone',
'descriptiveName',
'companyName',
'canManageClients',
'testAccount',
'autoTaggingEnabled',
'conversionTrackingSettings',
'remarketingSettings',
];

self.xmlns = 'https://adwords.google.com/api/adwords/mcm/' + self.version;
self.wsdlUrl = self.xmlns + '/CustomerService?wsdl';
}

Service.prototype = _.create(AdWordsService.prototype, {
'constructor': Service
});

module.exports = (Service);
12 changes: 12 additions & 0 deletions types/customerService.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
var Backbone = require('backbone');

var Customer = Backbone.Model.extend({});

var CustomerCollection = Backbone.Collection.extend({
model: Customer,
});

module.exports = {
collection: CustomerCollection,
model: Customer
};