Sha256: 348f66db6420612d1e834605a55144c872fdbade2f8317b0b3c213aab80962ea

Contents?: true

Size: 925 Bytes

Versions: 102

Compression:

Stored size: 925 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)
        logger.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)
        logger.info("Loaded #{cnt} people in #{secs} seconds (#{per_sec} people/sec)")

        file   = file_manager.save_json(people, filename, :timestamp)
        logger.info("#{people.length} people loaded and saved locally to #{file}.")
        Eco::API::Organization::People.new(people)
      end

    end
  end
end

Version data entries

102 entries across 102 versions & 1 rubygems

Version Path
eco-helpers-2.0.39 lib/eco/api/microcases/people_cache.rb
eco-helpers-2.0.38 lib/eco/api/microcases/people_cache.rb
eco-helpers-2.0.37 lib/eco/api/microcases/people_cache.rb
eco-helpers-2.0.36 lib/eco/api/microcases/people_cache.rb
eco-helpers-2.0.35 lib/eco/api/microcases/people_cache.rb
eco-helpers-2.0.34 lib/eco/api/microcases/people_cache.rb
eco-helpers-2.0.33 lib/eco/api/microcases/people_cache.rb
eco-helpers-2.0.32 lib/eco/api/microcases/people_cache.rb
eco-helpers-2.0.31 lib/eco/api/microcases/people_cache.rb
eco-helpers-2.0.30 lib/eco/api/microcases/people_cache.rb
eco-helpers-2.0.29 lib/eco/api/microcases/people_cache.rb
eco-helpers-2.0.28 lib/eco/api/microcases/people_cache.rb
eco-helpers-2.0.27 lib/eco/api/microcases/people_cache.rb
eco-helpers-2.0.26 lib/eco/api/microcases/people_cache.rb
eco-helpers-2.0.25 lib/eco/api/microcases/people_cache.rb
eco-helpers-2.0.24 lib/eco/api/microcases/people_cache.rb
eco-helpers-2.0.23 lib/eco/api/microcases/people_cache.rb
eco-helpers-2.0.22 lib/eco/api/microcases/people_cache.rb
eco-helpers-2.0.21 lib/eco/api/microcases/people_cache.rb
eco-helpers-2.0.19 lib/eco/api/microcases/people_cache.rb