lib/zoom/actions/roles.rb in zoom_rb-0.11.0 vs lib/zoom/actions/roles.rb in zoom_rb-1.0.0
- old
+ new
@@ -1,41 +1,24 @@
# frozen_string_literal: true
module Zoom
module Actions
module Roles
- def roles_list(*_args)
- Utils.parse_response self.class.get("/roles", headers: request_headers)
- end
+ extend Zoom::Actions
- def roles_create(*args)
- params = Zoom::Params.new(Utils.extract_options!(args))
- params.require(:name).permit(%i[description privileges])
- Utils.parse_response self.class.post("/roles", body: params.to_json, headers: request_headers)
- end
+ get 'roles_list', '/roles'
- def roles_members(*args)
- params = Zoom::Params.new(Utils.extract_options!(args))
- params.require(:role_id)
- Utils.parse_response self.class.get("/roles/#{params[:role_id]}/members", headers: request_headers)
- end
+ post 'roles_create', '/roles',
+ require: :name,
+ permit: %i[description privileges]
- def roles_assign(*args)
- params = Zoom::Params.new(Utils.extract_options!(args))
- params.require(%i[role_id members])
- Utils.parse_response self.class.post("/roles/#{params[:role_id]}/members", body: params.except(:role_id).to_json, headers: request_headers)
- end
+ get 'roles_members', '/roles/:role_id/members'
- def roles_unassign(*args)
- params = Zoom::Params.new(Utils.extract_options!(args))
- params.require(%i[role_id member_id])
- Utils.parse_response self.class.delete("/roles/#{params[:role_id]}/members/#{params[:member_id]}", headers: request_headers)
- end
+ post 'roles_assign', '/roles/:role_id/members',
+ require: :members
- def roles_get(*args)
- params = Zoom::Params.new(Utils.extract_options!(args))
- params.require(:role_id)
- Utils.parse_response self.class.get("/roles/#{params[:role_id]}", headers: request_headers)
- end
+ delete 'roles_unassign', '/roles/:role_id/members/:member_id'
+
+ get 'roles_get', '/roles/:role_id'
end
end
end