Class: OpenFga::TypeName

Inherits:
Object
  • Object
show all
Defined in:
lib/openfga/models/type_name.rb

Constant Summary collapse

UNSPECIFIED =
'TYPE_NAME_UNSPECIFIED'.freeze
ANY =
'TYPE_NAME_ANY'.freeze
BOOL =
'TYPE_NAME_BOOL'.freeze
STRING =
'TYPE_NAME_STRING'.freeze
INT =
'TYPE_NAME_INT'.freeze
UINT =
'TYPE_NAME_UINT'.freeze
DOUBLE =
'TYPE_NAME_DOUBLE'.freeze
DURATION =
'TYPE_NAME_DURATION'.freeze
TIMESTAMP =
'TYPE_NAME_TIMESTAMP'.freeze
MAP =
'TYPE_NAME_MAP'.freeze
LIST =
'TYPE_NAME_LIST'.freeze
IPADDRESS =
'TYPE_NAME_IPADDRESS'.freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.all_varsObject



32
33
34
# File 'lib/openfga/models/type_name.rb', line 32

def self.all_vars
  @all_vars ||= [UNSPECIFIED, ANY, BOOL, STRING, INT, UINT, DOUBLE, DURATION, TIMESTAMP, MAP, LIST, IPADDRESS].freeze
end

.build_from_hash(value) ⇒ String

Builds the enum from string

Parameters:

  • The (String)

    enum value in the form of the string

Returns:



39
40
41
# File 'lib/openfga/models/type_name.rb', line 39

def self.build_from_hash(value)
  new.build_from_hash(value)
end

Instance Method Details

#build_from_hash(value) ⇒ String

Builds the enum from string

Parameters:

  • The (String)

    enum value in the form of the string

Returns:



46
47
48
49
# File 'lib/openfga/models/type_name.rb', line 46

def build_from_hash(value)
  return value if TypeName.all_vars.include?(value)
  raise "Invalid ENUM value #{value} for class #TypeName"
end