Class: DomoscioRails::Resource
- Inherits:
-
Object
- Object
- DomoscioRails::Resource
show all
- Defined in:
- lib/domoscio_rails/resource.rb
Direct Known Subclasses
Content, Event, GameplayUtil, Instance, KnowledgeEdge, KnowledgeGraph, KnowledgeNode, KnowledgeNodeContent, KnowledgeNodeStudent, LearningSession, Objective, ObjectiveKnowledgeNode, ObjectiveKnowledgeNodeStudent, ObjectiveStudent, RecommendationUtil, ReviewUtil, Student, Tag, TagEdge, TagSet, Tagging
Class Method Summary
collapse
Class Method Details
.class_name ⇒ Object
4
5
6
|
# File 'lib/domoscio_rails/resource.rb', line 4
def class_name
name.split('::')[-1]
end
|
.url(id = nil, util_name = nil, on_self = nil) ⇒ Object
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/domoscio_rails/resource.rb', line 7
def url(id = nil, util_name = nil, on_self = nil )
if self == Resource
raise NotImplementedError.new('Resource is an abstract class. Do not use it directly.')
end
build_url = "/v#{DomoscioRails.configuration.version}/instances/#{DomoscioRails.configuration.client_id}"
if !on_self
build_url << "/#{class_name.underscore}s"
if util_name
build_url << "/#{util_name}"
end
if id
build_url << "/#{CGI.escape(id.to_s)}"
end
end
return build_url
end
|