mirror of
https://github.com/andwati/telecom-platform.git
synced 2026-10-18 11:02:54 +00:00
- Add AnalyticsAPI with churn prediction (predict, metrics, at-risk), market analytics (metrics, competitors, opportunities), predictive maintenance (metrics, assets, alerts, predict), and pricing optimization (metrics, optimize, elasticity) endpoints - Add SecurityAPI with fraud detection (analyze, alerts, update status, metrics, patterns) and SIM swap protection (verify, history) endpoints - Add CurrencyAPI with currency conversion (convert, exchange rates, rate
74 lines
1.9 KiB
Ruby
74 lines
1.9 KiB
Ruby
module TelecomSDK
|
|
class AnalyticsAPI
|
|
def initialize(http_client)
|
|
@http_client = http_client
|
|
end
|
|
|
|
# Churn Analysis
|
|
|
|
def predict_churn(profile_id)
|
|
@http_client.post("/api/v1/analytics/churn/predict", { profile_id: profile_id })
|
|
end
|
|
|
|
def get_churn_metrics(period: "monthly")
|
|
@http_client.get("/api/v1/analytics/churn/metrics", { period: period })
|
|
end
|
|
|
|
def get_at_risk_customers(risk_level:, limit: 100)
|
|
@http_client.post("/api/v1/analytics/churn/at-risk", {
|
|
risk_level: risk_level,
|
|
limit: limit
|
|
})
|
|
end
|
|
|
|
# Market Analytics
|
|
|
|
def get_market_metrics(period: "monthly")
|
|
@http_client.get("/api/v1/analytics/market/metrics", { period: period })
|
|
end
|
|
|
|
def get_competitors
|
|
@http_client.get("/api/v1/analytics/market/competitors")
|
|
end
|
|
|
|
def get_market_opportunities
|
|
@http_client.get("/api/v1/analytics/market/opportunities")
|
|
end
|
|
|
|
# Predictive Maintenance
|
|
|
|
def get_maintenance_metrics(period: "monthly")
|
|
@http_client.get("/api/v1/analytics/maintenance/metrics", { period: period })
|
|
end
|
|
|
|
def get_assets_health
|
|
@http_client.get("/api/v1/analytics/maintenance/assets")
|
|
end
|
|
|
|
def get_maintenance_alerts
|
|
@http_client.get("/api/v1/analytics/maintenance/alerts")
|
|
end
|
|
|
|
def predict_failure(asset_id)
|
|
@http_client.post("/api/v1/analytics/maintenance/predict/#{asset_id}", {})
|
|
end
|
|
|
|
# Pricing Optimization
|
|
|
|
def get_pricing_metrics(period: "monthly")
|
|
@http_client.get("/api/v1/analytics/pricing/metrics", { period: period })
|
|
end
|
|
|
|
def optimize_pricing(rate_plan_ids:, strategy: "revenue_maximization")
|
|
@http_client.post("/api/v1/analytics/pricing/optimize", {
|
|
rate_plan_ids: rate_plan_ids,
|
|
strategy: strategy
|
|
})
|
|
end
|
|
|
|
def get_price_elasticity
|
|
@http_client.get("/api/v1/analytics/pricing/elasticity")
|
|
end
|
|
end
|
|
end
|