Module: Proxima::Paths::ClassMethods

Defined in:
lib/proxima/paths.rb

Instance Method Summary collapse

Instance Method Details

#base_uri(base_uri = nil) ⇒ Object



7
8
9
10
11
# File 'lib/proxima/paths.rb', line 7

def base_uri(base_uri = nil)
  base_uri = ->(m) { base_uri } if base_uri.is_a? String
  @base_uri = base_uri if base_uri
  @base_uri ||= ->(m) { "" }
end

#create_path(create_path = nil) ⇒ Object



13
14
15
16
17
# File 'lib/proxima/paths.rb', line 13

def create_path(create_path = nil)
  create_path = ->(m) { create_path } if create_path.is_a? String
  @create_path = create_path if create_path
  @create_path ||= ->(m) { "#{@base_uri.call(m)}" }
end

#delete_by_id_path(delete_by_id_path = nil) ⇒ Object



37
38
39
40
41
# File 'lib/proxima/paths.rb', line 37

def delete_by_id_path(delete_by_id_path = nil)
  delete_by_id_path = ->(m) { delete_by_id_path } if delete_by_id_path.is_a? String
  @delete_by_id_path = delete_by_id_path if delete_by_id_path
  @delete_by_id_path ||= ->(m) { "#{@base_uri.call(m)}/#{m[:id]}" }
end

#find_by_id_path(find_by_id_path = nil) ⇒ Object



25
26
27
28
29
# File 'lib/proxima/paths.rb', line 25

def find_by_id_path(find_by_id_path = nil)
  find_by_id_path = ->(m) { find_by_id_path } if find_by_id_path.is_a? String
  @find_by_id_path = find_by_id_path if find_by_id_path
  @find_by_id_path ||= ->(m) { "#{@base_uri.call(m)}/#{m[:id]}" }
end

#find_path(find_path = nil) ⇒ Object



19
20
21
22
23
# File 'lib/proxima/paths.rb', line 19

def find_path(find_path = nil)
  find_path = ->(m) { find_path } if find_path.is_a? String
  @find_path = find_path if find_path
  @find_path ||= ->(m) { "#{@base_uri.call(m)}" }
end

#restore_by_id_path(restore_by_id_path = nil) ⇒ Object



43
44
45
46
47
# File 'lib/proxima/paths.rb', line 43

def restore_by_id_path(restore_by_id_path = nil)
  restore_by_id_path = ->(m) { restore_by_id_path } if restore_by_id_path.is_a? String
  @restore_by_id_path = restore_by_id_path if restore_by_id_path
  @restore_by_id_path ||= ->(m) { "#{@base_uri.call(m)}/restore/#{m[:id]}" }
end

#update_by_id_path(update_by_id_path = nil) ⇒ Object



31
32
33
34
35
# File 'lib/proxima/paths.rb', line 31

def update_by_id_path(update_by_id_path = nil)
  update_by_id_path = ->(m) { update_by_id_path } if update_by_id_path.is_a? String
  @update_by_id_path = update_by_id_path if update_by_id_path
  @update_by_id_path ||= ->(m) { "#{@base_uri.call(m)}/#{m[:id]}" }
end