Class: Economic::NestedBaseRepo

Inherits:
BaseRepo
  • Object
show all
Defined in:
lib/economic/nested_base_repo.rb

Direct Known Subclasses

CustomerContactRepo

Constant Summary

Constants inherited from BaseRepo

BaseRepo::URL

Class Method Summary collapse

Methods inherited from BaseRepo

endpoint_url, id_to_url_formatted_id, send_request, updated_after

Class Method Details

.all(filter_text: "", on:) ⇒ Object



4
5
6
# File 'lib/economic/nested_base_repo.rb', line 4

def all(filter_text: "", on:)
  super(filter_text: filter_text, url: nested_endpoint_url(on))
end

.destroy(id, on:) ⇒ Object



28
29
30
# File 'lib/economic/nested_base_repo.rb', line 28

def destroy(id, on:)
  super(id, url: nested_endpoint_url(on))
end

.filter(filter_text, on:) ⇒ Object



8
9
10
# File 'lib/economic/nested_base_repo.rb', line 8

def filter(filter_text, on:)
  all(filter_text: filter_text, on: on)
end

.find(id, on:) ⇒ Object



24
25
26
# File 'lib/economic/nested_base_repo.rb', line 24

def find(id, on:)
  super(id, url: nested_endpoint_url(on))
end

.nested_endpoint_name(model) ⇒ Object



16
17
18
# File 'lib/economic/nested_base_repo.rb', line 16

def nested_endpoint_name(model)
  "#{kebab(model.class.name.demodulize.pluralize)}/#{model.id_key}/#{endpoint_name}"
end

.nested_endpoint_url(model) ⇒ Object



12
13
14
# File 'lib/economic/nested_base_repo.rb', line 12

def nested_endpoint_url(model)
  Economic::BaseRepo::URL + nested_endpoint_name(model)
end

.save(model, on:) ⇒ Object



20
21
22
# File 'lib/economic/nested_base_repo.rb', line 20

def save(model, on:)
  super(model, url: nested_endpoint_url(on))
end