Class: RiddlerAdmin::ContentDefinition

Inherits:
ApplicationRecord show all
Defined in:
app/models/riddler_admin/content_definition.rb

Constant Summary collapse

MODEL_KEY =
"cdef".freeze
ID_LENGTH =

916_132_832 per second

5
DEFINITION_SCHEMA_VERSION =
1

Instance Method Summary collapse

Instance Method Details

#descriptionObject



23
24
25
# File 'app/models/riddler_admin/content_definition.rb', line 23

def description
  publish_request.title
end

#publish_to_remoteObject



44
45
46
# File 'app/models/riddler_admin/content_definition.rb', line 44

def publish_to_remote
  content_management_grpc.create_content_definition create_request_proto
end

#titleObject



27
28
29
# File 'app/models/riddler_admin/content_definition.rb', line 27

def title
  "#{content.title} v#{version} - #{description}"
end

#to_protoObject



31
32
33
34
35
36
37
38
39
40
41
42
# File 'app/models/riddler_admin/content_definition.rb', line 31

def to_proto
  ::Riddler::Protobuf::ContentDefinition.new \
    id: id,
    created_at: created_at_proto,
    content_type: content.content_type.upcase.to_sym,
    content_id: content.id,
    title: content.title,
    description: description,
    version: version,
    definition_schema_version: DEFINITION_SCHEMA_VERSION,
    definition_string: definition.to_json
end