Sha256: 6a825de926accbef5e7ed25b37828249f31de65a36f8eced76c3a740e67b8e5c

Contents?: true

Size: 793 Bytes

Versions: 25

Compression:

Stored size: 793 Bytes

Contents

# frozen_string_literal: true
require 'dato/local/entities_repo'
require 'dato/local/items_repo'

module Dato
  module Local
    class Loader
      attr_reader :client
      attr_reader :entities_repo
      attr_reader :items_repo

      def initialize(client)
        @client = client
        @entities_repo = EntitiesRepo.new
        @items_repo = ItemsRepo.new(@entities_repo)
      end

      def load
        @entities_repo = EntitiesRepo.new(site, all_items)
        @items_repo = ItemsRepo.new(@entities_repo)
      end

      private

      def site
        include = [
          'item_types',
          'item_types.fields'
        ]
        client.request(:get, '/site', include: include)
      end

      def all_items
        client.items.all({}, false)
      end
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
dato-0.3.28 lib/dato/local/loader.rb
dato-0.3.27 lib/dato/local/loader.rb
dato-0.3.26 lib/dato/local/loader.rb
dato-0.3.25 lib/dato/local/loader.rb
dato-0.3.24 lib/dato/local/loader.rb
dato-0.3.23 lib/dato/local/loader.rb
dato-0.3.22 lib/dato/local/loader.rb
dato-0.3.21 lib/dato/local/loader.rb
dato-0.3.20 lib/dato/local/loader.rb
dato-0.3.19 lib/dato/local/loader.rb
dato-0.3.18 lib/dato/local/loader.rb
dato-0.3.17 lib/dato/local/loader.rb
dato-0.3.16 lib/dato/local/loader.rb
dato-0.3.15 lib/dato/local/loader.rb
dato-0.3.14 lib/dato/local/loader.rb
dato-0.3.13 lib/dato/local/loader.rb
dato-0.3.12 lib/dato/local/loader.rb
dato-0.3.9.1 lib/dato/local/loader.rb
dato-0.3.11 lib/dato/local/loader.rb
dato-0.3.10 lib/dato/local/loader.rb