Module: Economic::FindByDateInterval
- Included in:
- CurrentInvoiceProxy, InvoiceProxy, OrderProxy
- Defined in:
- lib/economic/proxies/actions/find_by_date_interval.rb
Instance Method Summary collapse
-
#find_by_date_interval(from, unto) ⇒ Object
Returns entity objects for a given interval of days.
Instance Method Details
#find_by_date_interval(from, unto) ⇒ Object
Returns entity objects for a given interval of days.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/economic/proxies/actions/find_by_date_interval.rb', line 6 def find_by_date_interval(from, unto) response = request(:find_by_date_interval, "first" => from.iso8601, "last" => unto.iso8601) handle_key = "#{Support::String.underscore(entity_class_name)}_handle".intern handles = [response[handle_key]].flatten.reject(&:blank?).collect do |handle| Entity::Handle.build(handle) end get_data_array(handles).collect do |entity_hash| entity = build(entity_hash) entity.persisted = true entity end end |