Skip to content

Commit ff4a1ab

Browse files
committed
WIP
1 parent 9709a5e commit ff4a1ab

2 files changed

Lines changed: 36 additions & 0 deletions

File tree

lib/cgrates/client.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,14 @@ def remove_tp_rating_profile(tp_id:, load_id:, tenant:, category:, subject:)
150150
)
151151
end
152152

153+
def get_rating_plan(id)
154+
api_request("APIerSv1.GetRatingPlan", id)
155+
end
156+
157+
def remove_rating_plan(id)
158+
api_request("APIerSv1.RemoveRatingPlan", id)
159+
end
160+
153161
def set_rating_profile(rating_plan_activations:, category:, subject:, tenant: nil, overwrite: nil, **)
154162
api_request(
155163
"APIerSv1.SetRatingProfile",

spec/cgrates/client_spec.rb

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,34 @@ module CGRateS
449449
end
450450
end
451451

452+
describe "#remove_rating_plan" do
453+
it "executes the request" do
454+
client = build_client
455+
set_tp_rating_plan(client, tp_id: "cgrates_client_test", id: "Test_Rating_Plan")
456+
client.load_tariff_plan_from_stor_db(tp_id: "cgrates_client_test")
457+
458+
stub_api_request(
459+
result: {
460+
"Id" => "Test_Rating_Plan"
461+
}
462+
)
463+
response = client.get_rating_plan("Test_Rating_Plan")
464+
expect(response).to have_attributes(
465+
result: hash_including(
466+
"Id" => "Test_Rating_Plan"
467+
)
468+
)
469+
expect(WebMock).to have_requested_api_method("APIerSv1.GetRatingPlan")
470+
471+
stub_api_request(result: "OK")
472+
473+
response = client.remove_rating_plan("Test_Rating_Plan")
474+
475+
expect(response).to have_attributes(result: "OK")
476+
expect(WebMock).to have_requested_api_method("APIerSv1.RemoveRatingPlan")
477+
end
478+
end
479+
452480
describe "#set_account" do
453481
it "executes the request" do
454482
client = build_client

0 commit comments

Comments
 (0)