module Support
  module Services
    class VectorApi
      include HTTParty

      base_uri DOMAINS[:vector_api]

      class << self
        def active_accounting_period
          path = "/vectorapi/activeperiod"
          query = { "access_token" => ENV["QA_VAPI_TOKEN"] }
          response = get(
            path,
            query: query
          )

          JSON.parse(response.body)["envelope"]["response"]["active_period"]["id"]
        end
      end
    end
  end
end
