new Customer()
Create a new instance of Customer
- Source:
- Customer/Customer.js, line 59
- See:
Properties:
Name | Type | Description |
---|---|---|
status |
String | status of the customer loaded |
title |
String | customer's title |
country |
String | customer's country |
referer |
String | customer's referer |
published |
Date | published date |
renewalDate |
Date | date of renewal |
userCount |
Number | number of users |
userCredit |
Number | number of credit users |
subscriptions |
Array | list of subscriptions asociated to this customer |
traffics |
Array | list of traffics asociated to this customer |
i18n |
Object | internationalization obect containing different libraries |
users |
Array | list of users asociated to this customer |
domains |
Array | list of domains asociated to this customer |
overdue |
Object | overdue users status and quantity |
inOrder |
Object | inOrder users status and quantity |
Examples
Load customer
var c = new Customer();
c.load({
onSuccess:function(){
alert('"'+c.title + '" loaded!');
}
});
Load customer User information
var c = new Customer();
c.load({
onSuccess:function(){
alert(c.inOrder.ACTIVE);
}
});
Methods
-
generate_xml()
-
Generates a save/update xml to be posted to the server
- Source:
- Customer/Customer.js, line 170
-
generateUrl()
-
Overrides Resource's generateUrl method to return the request url
- Source:
- Customer/Customer.js, line 93
- See:
-
loadDomains(options)
-
Load a list the list of Domains.
Parameters:
Name Type Description options
object options to be used during the call
Properties
Name Type Argument Description onSuccess
Resource~onSuccess a callback function called in case of a success onFailure
Resource~onFailure <optional>
a callback function called in case of a failure baseUrl
String <optional>
base URL. If not set the current base URL will be used - Source:
- Customer/Customer.js, line 338
- See:
Example
Load domains function loadDomains(p_customer){//customer object p_customer.loadDomains({ onSuccess:function(){ alert("there are " +p_customer.domains.length+" domains"); } }); };
-
loadPreset()
-
Overrides Resource's loadPreset method.
- Source:
- Customer/Customer.js, line 87
- See:
-
loadSet(rObject)
-
Overrides Resource's loadSet method to set local variables after request.
Parameters:
Name Type Description rObject
json JSON representation of the loaded data. - Source:
- Customer/Customer.js, line 103
- See:
-
loadSubscriptions(options)
-
Load a list the list of subscriptions.
Parameters:
Name Type Description options
object options to be used during the call
Properties
Name Type Argument Description onSuccess
Resource~onSuccess a callback function called in case of a success onFailure
Resource~onFailure <optional>
a callback function called in case of a failure baseUrl
String <optional>
base URL. If not set the current base URL will be used - Source:
- Customer/Customer.js, line 209
- See:
Example
Load subscriptions function loadSubscriptions(p_customer){//customer object p_customer.loadSubscriptions({ onSuccess:function(){ alert("there are " +p_customer.subscriptions.length+" subscriptions"); } }); };
-
loadTraffics(options)
-
Load a list the list of traffics.
Parameters:
Name Type Description options
object options to be used during the call
Properties
Name Type Argument Description onSuccess
Resource~onSuccess a callback function called in case of a success onFailure
Resource~onFailure <optional>
a callback function called in case of a failure baseUrl
String <optional>
base URL. If not set the current base URL will be used - Source:
- Customer/Customer.js, line 252
- See:
Example
Load traffics function loadTraffics(p_customer){//customer object p_customer.loadTraffics({ onSuccess:function(){ alert("there are " +p_customer.traffics.length+" traffics"); } }); };
-
loadUsers(options)
-
Load a list the list of Users.
Parameters:
Name Type Description options
object options to be used during the call
Properties
Name Type Argument Description onSuccess
Resource~onSuccess a callback function called in case of a success onFailure
Resource~onFailure <optional>
a callback function called in case of a failure baseUrl
String <optional>
base URL. If not set the current base URL will be used - Source:
- Customer/Customer.js, line 295
- See:
Example
Load users function loadUsers(p_customer){//customer object p_customer.loadUsers({ onSuccess:function(){ alert("there are " +p_customer.users.length+" users"); } }); };
-
update(options)
-
Overrides Resource's loadPreset method.
Parameters:
Name Type Description options
object options to be used during the call
Properties
Name Type Argument Description onSuccess
Resource~onSuccess a callback function called in case of a success onFailure
Resource~onFailure <optional>
a callback function called in case of a failure baseUrl
String <optional>
base URL. If not set the current base URL will be used - Source:
- Customer/Customer.js, line 156
- See:
Example
update a Customer function updateCustomer(cust){//loaded customer object cust.title = 'new_title';//data change example cust.update({ onSuccess:function(){ alert("Customer Updated!"); } }); }