Module: LAA::FeeCalculator::HasManyable::ClassMethods
- Defined in:
- lib/laa/fee_calculator/has_manyable.rb
Defined Under Namespace
Modules: Searchable
Instance Method Summary collapse
Instance Method Details
#has_many(association) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/laa/fee_calculator/has_manyable.rb', line 21 def has_many(association) define_method(association) do |id = nil, **| uri = uri_for(association, id: id || [:id]) filtered_params = .except(:id) json = get(uri, filtered_params).body ostruct = JSON.parse(json, object_class: OpenStruct) return ostruct unless ostruct.respond_to?(:results) ostruct.results.extend Searchable end end |