From 172c166cd09204f1ad13f91819d8de2a99969443 Mon Sep 17 00:00:00 2001 From: Kyle Le Date: Sun, 14 Apr 2024 22:55:23 +0700 Subject: [PATCH] Issue 88 Add new Role Apis --- lib/killbill_client/models/role_definition.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/lib/killbill_client/models/role_definition.rb b/lib/killbill_client/models/role_definition.rb index 240896c..369b819 100644 --- a/lib/killbill_client/models/role_definition.rb +++ b/lib/killbill_client/models/role_definition.rb @@ -2,6 +2,14 @@ module KillBillClient module Model class RoleDefinition < RoleDefinitionAttributes + class << self + def find_by_name(role_name, options = {}) + role = get "#{Security::KILLBILL_API_SECURITY_PREFIX}/roles/#{role_name}", + {}, + options + end + end + def create(user = nil, reason = nil, comment = nil, options = {}) created_role = self.class.post "#{Security::KILLBILL_API_SECURITY_PREFIX}/roles", to_json, @@ -13,6 +21,17 @@ def create(user = nil, reason = nil, comment = nil, options = {}) }.merge(options) created_role.refresh(options) end + + def update(user = nil, reason = nil, comment = nil, options = {}) + self.class.put "#{Security::KILLBILL_API_SECURITY_PREFIX}/roles", + to_json, + {}, + { + :user => user, + :reason => reason, + :comment => comment, + }.merge(options) + end end end end