Sha256: 3abbe210d0c1b8950e8b3b214810d938ad5fa92ea8187775e5bb43b690af3532

Contents?: true

Size: 772 Bytes

Versions: 2

Compression:

Stored size: 772 Bytes

Contents

module Datacentred
  module Request
    class Roles < Base

      def self.create(payload={})
        post('roles', payload.to_json)['role']
      end

      def self.list
        get('roles')['roles']
      end

      def self.show(id)
        get("roles/#{id}")['role']
      end

      def self.update(id, payload={})
        put("roles/#{id}", payload.to_json)['role']
      end

      def self.destroy(id)
        delete("roles/#{id}")
      end

      def self.list_users(role_id)
        get("roles/#{role_id}/users")['users']
      end

      def self.add_user(role_id, user_id)
        put("roles/#{role_id}/users/#{user_id}")
      end

      def self.remove_user(role_id, user_id)
        delete("roles/#{role_id}/users/#{user_id}")
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
datacentred-0.1.1pre lib/datacentred/request/roles.rb
datacentred-0.1.0pre lib/datacentred/request/roles.rb