Module: Panda::Router::ClassMethods

Included in:
Proxy
Defined in:
lib/panda/modules/router.rb

Instance Method Summary collapse

Instance Method Details

#build_hash_many_path(end_path, relation_attr) ⇒ Object



27
28
29
30
31
# File 'lib/panda/modules/router.rb', line 27

def build_hash_many_path(end_path, relation_attr)
  relation_class_name = relation_attr[0..relation_attr.rindex("_id")-1].capitalize
  prefix_path = Panda::const_get(relation_class_name).resource_path + "/:" + relation_attr
  prefix_path + end_path
end

#create_rest_url(url, map) ⇒ Object



33
34
35
36
# File 'lib/panda/modules/router.rb', line 33

def create_rest_url(url, map)
  new_url = replace_pattern_with_variables(url, map)
  json_path(new_url)
end

#many_pathObject



19
20
21
# File 'lib/panda/modules/router.rb', line 19

def many_path
  resource_path
end

#match(url) ⇒ Object



15
16
17
# File 'lib/panda/modules/router.rb', line 15

def match(url)
  @url = url
end

#one_pathObject



23
24
25
# File 'lib/panda/modules/router.rb', line 23

def one_path
  resource_path + "/:id"
end

#resource_pathObject



11
12
13
# File 'lib/panda/modules/router.rb', line 11

def resource_path
  @url || "/#{sti_name.downcase}s"
end