Sha256: 8ac84b659676b8ba8df87c550958fd1db79045565d4bb30551b61db7340387c9

Contents?: true

Size: 903 Bytes

Versions: 12

Compression:

Stored size: 903 Bytes

Contents

require_relative 'resource'

module Contentful
  module Management
    # Resource class for Role.
    class Role
      include Contentful::Management::Resource
      include Contentful::Management::Resource::SystemProperties
      include Contentful::Management::Resource::Refresher

      property :name, :string
      property :description, :string
      property :permissions, :hash
      property :policies, :array

      # @private
      def self.create_attributes(_client, attributes)
        {
          'name' => attributes.fetch(:name),
          'description' => attributes.fetch(:description),
          'permissions' => attributes.fetch(:permissions),
          'policies' => attributes.fetch(:policies)
        }
      end

      protected

      def query_attributes(attributes)
        attributes.each_with_object({}) { |(k, v), result| result[k.to_sym] = v }
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
contentful-management-1.10.1 lib/contentful/management/role.rb
contentful-management-1.10.0 lib/contentful/management/role.rb
contentful-management-1.9.0 lib/contentful/management/role.rb
contentful-management-1.8.1 lib/contentful/management/role.rb
contentful-management-1.8.0 lib/contentful/management/role.rb
contentful-management-1.7.0 lib/contentful/management/role.rb
contentful-management-1.6.0 lib/contentful/management/role.rb
contentful-management-1.5.0 lib/contentful/management/role.rb
contentful-management-1.4.0 lib/contentful/management/role.rb
contentful-management-1.3.0 lib/contentful/management/role.rb
contentful-management-1.2.0 lib/contentful/management/role.rb
contentful-management-1.1.0 lib/contentful/management/role.rb