Sha256: 67ccaa3de199102a7a6bb5a14d64d424201b60e7fa01361239a4f32a6317220a

Contents?: true

Size: 1.81 KB

Versions: 18

Compression:

Stored size: 1.81 KB

Contents

# frozen_string_literal: true
require 'dato/site/repo/base'

module Dato
  module Site
    module Repo
      class Role < Base
        def create(resource_attributes)
          body = JsonApiSerializer.new(
            type: :role,
            attributes: %i(can_edit_favicon can_edit_schema can_edit_site can_manage_access_tokens can_manage_users can_perform_site_search can_publish_to_production can_publish_to_staging name negative_item_type_permissions positive_item_type_permissions),
            required_attributes: %i(can_edit_favicon can_edit_schema can_edit_site can_manage_access_tokens can_manage_users can_perform_site_search can_publish_to_production can_publish_to_staging name negative_item_type_permissions positive_item_type_permissions)
          ).serialize(resource_attributes)

          post_request '/roles', body
        end

        def update(role_id, resource_attributes)
          body = JsonApiSerializer.new(
            type: :role,
            attributes: %i(can_edit_favicon can_edit_schema can_edit_site can_manage_access_tokens can_manage_users can_perform_site_search can_publish_to_production can_publish_to_staging name negative_item_type_permissions positive_item_type_permissions),
            required_attributes: %i(can_edit_favicon can_edit_schema can_edit_site can_manage_access_tokens can_manage_users can_perform_site_search can_publish_to_production can_publish_to_staging name negative_item_type_permissions positive_item_type_permissions)
          ).serialize(resource_attributes, role_id)

          put_request "/roles/#{role_id}", body
        end

        def all
          get_request '/roles'
        end

        def find(role_id)
          get_request "/roles/#{role_id}"
        end

        def destroy(role_id)
          delete_request "/roles/#{role_id}"
        end
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
dato-0.5.1 lib/dato/site/repo/role.rb
dato-0.5.0 lib/dato/site/repo/role.rb
dato-0.4.3 lib/dato/site/repo/role.rb
dato-0.4.2 lib/dato/site/repo/role.rb
dato-0.4.1 lib/dato/site/repo/role.rb
dato-0.4.0 lib/dato/site/repo/role.rb
dato-0.3.31 lib/dato/site/repo/role.rb
dato-0.4.0.pre lib/dato/site/repo/role.rb
dato-0.3.30 lib/dato/site/repo/role.rb
dato-0.3.29 lib/dato/site/repo/role.rb
dato-0.3.28 lib/dato/site/repo/role.rb
dato-0.3.27 lib/dato/site/repo/role.rb
dato-0.3.26 lib/dato/site/repo/role.rb
dato-0.3.25 lib/dato/site/repo/role.rb
dato-0.3.24 lib/dato/site/repo/role.rb
dato-0.3.23 lib/dato/site/repo/role.rb
dato-0.3.22 lib/dato/site/repo/role.rb
dato-0.3.21 lib/dato/site/repo/role.rb