mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-05-13 13:11:03 +00:00
Merge branch 'master' of https://github.com/gnh1201/welsonjs
This commit is contained in:
commit
67d365026a
|
@ -1,3 +1,4 @@
|
||||||
|
var RAND = require("lib/rand");
|
||||||
var HTTP = require("lib/http");
|
var HTTP = require("lib/http");
|
||||||
|
|
||||||
var WebSMSObject = function() {
|
var WebSMSObject = function() {
|
||||||
|
@ -6,6 +7,7 @@ var WebSMSObject = function() {
|
||||||
this.country = "any";
|
this.country = "any";
|
||||||
this.operator = "any";
|
this.operator = "any";
|
||||||
this.product = "";
|
this.product = "";
|
||||||
|
this.profiles = [];
|
||||||
|
|
||||||
this.setHost = function(host) {
|
this.setHost = function(host) {
|
||||||
this.host = host;
|
this.host = host;
|
||||||
|
@ -31,9 +33,25 @@ var WebSMSObject = function() {
|
||||||
this.product = product;
|
this.product = product;
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.addProfile = function(product, country, operator) {
|
||||||
|
this.profiles.push({
|
||||||
|
"product": product,
|
||||||
|
"country": country,
|
||||||
|
"operator": operator
|
||||||
|
});
|
||||||
|
return this;
|
||||||
|
};
|
||||||
|
|
||||||
this.buy = function() {
|
this.buy = function() {
|
||||||
try {
|
try {
|
||||||
|
if (this.profiles.length > 0) {
|
||||||
|
var pf = RAND.one(this.profiles);
|
||||||
|
this.setProduct(pf.product);
|
||||||
|
this.setOperator(pf.operator);
|
||||||
|
this.setCountry(pf.country);
|
||||||
|
}
|
||||||
|
|
||||||
var response = HTTP.create()
|
var response = HTTP.create()
|
||||||
.setBearerAuth(this.token)
|
.setBearerAuth(this.token)
|
||||||
.setUseCache(false)
|
.setUseCache(false)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user