Sha256: 508d2e2ed7825dabb864922fd8307c534495a95fa2f1d4a5a4e0ffe4982e570a
Contents?: true
Size: 976 Bytes
Versions: 23
Compression:
Stored size: 976 Bytes
Contents
module Eco module API class MicroCases # Helper to locally cache the people manager. # @param filename [String] the name of the file where the data should be cached. # @return [Eco::API::Organization::People] the `People` object with the data. def people_cache(filename = enviro.config.people.cache) log(:info) { "Going to get all the people via API" } start = Time.now people = session.batch.get_people secs = (Time.now - start).round(3) cnt = people.count per_sec = (cnt.to_f / secs).round(2) log(:info) { "Loaded #{cnt} people in #{secs} seconds (#{per_sec} people/sec)" } file = file_manager.save_json(people, filename, :timestamp) log(:info) { "#{people.length} people loaded and saved locally to #{file}." } Eco::API::Organization::People.new(people) end end end end
Version data entries
23 entries across 23 versions & 1 rubygems