class Wawka::Transactions::FetchHarvest

Public Instance Methods

call(date:) click to toggle source
# File lib/wawka/transactions/fetch_harvest.rb, line 4
def call(date:)
  page = 1
  entries = []
  loop do
    data = harvest.time_entries(from: date - 1.month, to: date, page: page)
    entries += data['time_entries']
    break if data['page'] == data['total_pages']
    page = data['page'] + 1
  end
  Success(entries)
end

Private Instance Methods

harvest() click to toggle source
# File lib/wawka/transactions/fetch_harvest.rb, line 18
def harvest
  @harvest ||= Harvest.new
end