"use strict";
/**
* @module Provider
* @overview Defines the utility service `Provider` class
*
* @author Animesh Mishra <hello@animesh.ltd>
* @copyright © 2018 Animesh Ltd. All Rights Reserved.
*/
Object.defineProperty(exports, "__esModule", { value: true });
/** Utility providers as supported by Rocket in Pocket */
class Provider {
constructor(json) {
this.code = json.provider_code;
this.name = json.connection_provider;
}
/**
* Given an array of provider responses from Rocket in Pocket, instantiates and
* returns a `Provider` array.
*/
static InitList(json) {
let providers = Array();
for (var provider of json) {
providers.push(new Provider(provider));
}
return providers;
}
/**
* Returns a `Provider` with the given provider `code` amongst the list of
* `providers` given. If no match is found, returns `null`.
*/
static WithCode(code, providers) {
for (var operator of providers) {
if (operator.code == code) {
return operator;
}
}
return null;
}
}
exports.Provider = Provider;
//# sourceMappingURL=Provider.js.map