cc-os/plugins/os-vault/eval/fixture/project/lib/reportgen/fetcher.rb

27 lines
635 B
Ruby

# frozen_string_literal: true
module Reportgen
# Pulls the raw records for a client/month from the Finch API.
class Fetcher
FINCH_RECORDS_URL = "https://api.finch.example.com/v1/records"
def initialize(client:)
@client = client
end
# Fetches the records for the requested client/month in a single GET.
def fetch_records(client:, month:)
params = { client: client, month: month }
response = get(FINCH_RECORDS_URL, params)
response.fetch("records")
end
private
def get(_url, _params)
# Placeholder for the real HTTP call.
{ "records" => [] }
end
end
end