Skip to content

Commit

Permalink
Merge pull request #109 from tungleduyxyz/issue_88_update_role_apis
Browse files Browse the repository at this point in the history
Issue 88 Add new Role Apis
  • Loading branch information
reshmabidikar authored Apr 17, 2024
2 parents f8082f9 + 172c166 commit f030b55
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions lib/killbill_client/models/role_definition.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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

0 comments on commit f030b55

Please sign in to comment.