mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-05-11 20:21: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 WebSMSObject = function() {
|
||||
|
@ -6,6 +7,7 @@ var WebSMSObject = function() {
|
|||
this.country = "any";
|
||||
this.operator = "any";
|
||||
this.product = "";
|
||||
this.profiles = [];
|
||||
|
||||
this.setHost = function(host) {
|
||||
this.host = host;
|
||||
|
@ -31,9 +33,25 @@ var WebSMSObject = function() {
|
|||
this.product = product;
|
||||
return this;
|
||||
};
|
||||
|
||||
this.addProfile = function(product, country, operator) {
|
||||
this.profiles.push({
|
||||
"product": product,
|
||||
"country": country,
|
||||
"operator": operator
|
||||
});
|
||||
return this;
|
||||
};
|
||||
|
||||
this.buy = function() {
|
||||
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()
|
||||
.setBearerAuth(this.token)
|
||||
.setUseCache(false)
|
||||
|
|
Loading…
Reference in New Issue
Block a user