Sha256: a064291679adbe0397aa262b7a7071c139e1322e3bc9509ddf7f84c9f479f25d

Contents?: true

Size: 820 Bytes

Versions: 7

Compression:

Stored size: 820 Bytes

Contents

require 'modelish'

module G5AuthenticationClient
  # G5 Authentication user role info
  class Role < Modelish::Base
    ignore_unknown_properties!

    GLOBAL = 'GLOBAL'

    # @!attribute [rw] name
    #   @return [String]
    #   The name associated with this user role
    property :name, type: String, required: true

    # @!attribute [rw] type
    #   @return [String]
    #   The role's type. If 'GLOBAL' then not role not associated with a resource
    property :type, type: String, required: true

    # @!attribute [rw] urn
    #   @return [String]
    #   The role's resource urn. Will be nil if type='GLOBAL'
    property :urn, type: String

    def validate_for_create!
      validate!
      raise ArgumentError.new("URN required when type != '#{GLOBAL}'") if urn.nil? && type != GLOBAL
    end

  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
g5_authentication_client-0.5.5 lib/g5_authentication_client/role.rb
g5_authentication_client-1.0.0.pre.1 lib/g5_authentication_client/role.rb
g5_authentication_client-0.5.4 lib/g5_authentication_client/role.rb
g5_authentication_client-0.5.3 lib/g5_authentication_client/role.rb
g5_authentication_client-0.5.2 lib/g5_authentication_client/role.rb
g5_authentication_client-0.5.1 lib/g5_authentication_client/role.rb
g5_authentication_client-0.5.0 lib/g5_authentication_client/role.rb