Module: Proxima::Paths::ClassMethods
- Defined in:
- lib/proxima/paths.rb
Instance Method Summary collapse
- #base_uri(base_uri = nil) ⇒ Object
- #create_path(create_path = nil) ⇒ Object
- #delete_by_id_path(delete_by_id_path = nil) ⇒ Object
- #find_by_id_path(find_by_id_path = nil) ⇒ Object
- #find_path(find_path = nil) ⇒ Object
- #restore_by_id_path(restore_by_id_path = nil) ⇒ Object
- #update_by_id_path(update_by_id_path = nil) ⇒ Object
Instance Method Details
#base_uri(base_uri = nil) ⇒ Object
7 8 9 10 11 12 13 14 |
# File 'lib/proxima/paths.rb', line 7 def base_uri(base_uri = nil) if base_uri.is_a? String base_uri_str = base_uri base_uri = ->(m) { base_uri_str } end @base_uri = base_uri if base_uri @base_uri ||= ->(m) { "" } end |
#create_path(create_path = nil) ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/proxima/paths.rb', line 16 def create_path(create_path = nil) if create_path.is_a? String create_path_str = create_path create_path = ->(m) { create_path_str } end @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
52 53 54 55 56 57 58 59 |
# File 'lib/proxima/paths.rb', line 52 def delete_by_id_path(delete_by_id_path = nil) if delete_by_id_path.is_a? String delete_by_id_path_str = delete_by_id_path delete_by_id_path = ->(m) { delete_by_id_path_str } end @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
34 35 36 37 38 39 40 41 |
# File 'lib/proxima/paths.rb', line 34 def find_by_id_path(find_by_id_path = nil) if find_by_id_path.is_a? String find_by_id_path_str = find_by_id_path find_by_id_path = ->(m) { find_by_id_path_str } end @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
25 26 27 28 29 30 31 32 |
# File 'lib/proxima/paths.rb', line 25 def find_path(find_path = nil) if find_path.is_a? String find_path_str = find_path find_path = ->(m) { find_path_str } end @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
61 62 63 64 65 66 67 68 |
# File 'lib/proxima/paths.rb', line 61 def restore_by_id_path(restore_by_id_path = nil) if restore_by_id_path.is_a? String restore_by_id_path_str = restore_by_id_path restore_by_id_path = ->(m) { restore_by_id_path_str } end @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
43 44 45 46 47 48 49 50 |
# File 'lib/proxima/paths.rb', line 43 def update_by_id_path(update_by_id_path = nil) if update_by_id_path.is_a? String update_by_id_path_str = update_by_id_path update_by_id_path = ->(m) { update_by_id_path_str } end @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 |