Class: ConferenceManager::Resource

Inherits:
ActiveResource::Base
  • Object
show all
Defined in:
lib/conference_manager/resource.rb

Class Method Summary collapse

Class Method Details

.collection_path(prefix_options = {}, query_options = nil) ⇒ Object

redefine this two methods to remove .format extension



29
30
31
32
33
34
# File 'lib/conference_manager/resource.rb', line 29

def collection_path(prefix_options = {}, query_options = nil)
  prefix_options, query_options = split_options(prefix_options) if query_options.nil?
  @singleton ?
  "#{prefix(prefix_options)}#{collection_name.singularize}#{query_string(query_options)}" :
  "#{prefix(prefix_options)}#{collection_name}#{query_string(query_options)}"
end

.domainObject



4
5
6
# File 'lib/conference_manager/resource.rb', line 4

def domain
  Site.current.cm_domain.present? ? Site.current.cm_domain : "http://vcc-test.dit.upm.es:8080"
end

.element_path(id, prefix_options = {}, query_options = nil) ⇒ Object



37
38
39
40
41
42
# File 'lib/conference_manager/resource.rb', line 37

def element_path(id, prefix_options = {}, query_options = nil)
  prefix_options, query_options = split_options(prefix_options) if query_options.nil?
  @singleton ?
  "#{prefix(prefix_options)}#{collection_name.singularize}#{query_string(query_options)}" :
  "#{prefix(prefix_options)}#{collection_name}/#{id}#{query_string(query_options)}"
end

.inherited(subclass) ⇒ Object



12
13
14
15
# File 'lib/conference_manager/resource.rb', line 12

def inherited(subclass)
  @subclasses = subclasses | Array(subclass)
  super
end

.reloadObject



17
18
19
20
21
# File 'lib/conference_manager/resource.rb', line 17

def reload
  subclasses.each{ |subclass|
    subclass.site = subclass.domain
  }
end

.singletonObject

This is a single resource, like web or recording, but not events.



24
25
26
# File 'lib/conference_manager/resource.rb', line 24

def singleton
  @singleton = true
end

.subclassesObject



8
9
10
# File 'lib/conference_manager/resource.rb', line 8

def subclasses
  @subclasses ||= []
end