mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 10:06:24 +05:00
Add new API: RankingSv1.GetRankingSummary
This commit is contained in:
committed by
Dan Christian Bogos
parent
14292a77ea
commit
1a38e51a5d
@@ -128,8 +128,17 @@ func (apierSv1 *APIerSv1) RemoveRankingProfile(ctx *context.Context, args *utils
|
||||
}
|
||||
|
||||
// NewRankingSv1 initializes RankingSV1
|
||||
func NewRankingSv1() *RankingSv1 {
|
||||
return &RankingSv1{}
|
||||
func NewRankingSv1(rnks *engine.RankingS) *RankingSv1 {
|
||||
return &RankingSv1{
|
||||
rnkS: rnks,
|
||||
}
|
||||
}
|
||||
|
||||
type RankingSv1 struct{}
|
||||
type RankingSv1 struct {
|
||||
rnkS *engine.RankingS
|
||||
}
|
||||
|
||||
// GetRankingSummary returns summary of the last updated ranking
|
||||
func (rnks *RankingSv1) GetRankingSummary(ctx *context.Context, arg utils.TenantIDWithAPIOpts, reply *engine.RankingSummary) error {
|
||||
return rnks.rnkS.V1GetRankingSummary(ctx, arg, reply)
|
||||
}
|
||||
|
||||
@@ -26,10 +26,14 @@ import (
|
||||
)
|
||||
|
||||
func TestNewRankingSv1(t *testing.T) {
|
||||
rankingSvc := NewRankingSv1()
|
||||
rankingS := &engine.RankingS{}
|
||||
rankingSvc := NewRankingSv1(rankingS)
|
||||
if rankingSvc == nil {
|
||||
t.Errorf("NewRankingSv1() returned nil")
|
||||
}
|
||||
if rankingSvc.rnkS != rankingS {
|
||||
t.Errorf("NewRankingSv1() did not correctly set rnkS field")
|
||||
}
|
||||
}
|
||||
|
||||
func TestRemoveRankingProfile(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user