lib/zendesk_api/sideloading.rb
def _side_load(name, klass, resources)
      associations = klass.associated_with(name)

      associations.each do |association|
        association.side_load(resources, @included[name])
      end

      resources.each do |resource|
        loaded_associations = resource.loaded_associations
        loaded_associations.each do |association|
          loaded = resource.send(association[:name])
          next unless loaded
          _side_load(name, association[:class], to_array(loaded))
        end
      end
    end
def _side_load(name, klass, resources)
      associations = klass.associated_with(name)

      associations.each do |association|
        association.side_load(resources, @included[name])
      end

      resources.each do |resource|
        loaded_associations = resource.loaded_associations
        loaded_associations.each do |association|
          loaded = resource.send(association[:name])
          next unless loaded
          _side_load(name, association[:class], to_array(loaded))
        end
      end
    end
def _side_load ( name , klass , resources ) associations = klass . associated_with ( name ) associations . each do | association | association . side_load ( resources , @included [ name ] ) end resources . each do | resource | loaded_associations = resource . loaded_associations loaded_associations . each do | association | loaded = resource . send ( association [ :name ] ) next unless loaded _side_load ( name , association [ :class ] , to_array ( loaded ) ) end end end
Traverses the resource looking for associations
 then descends into those associations and checks for applicable
 resources to side load
Traverses the resource looking for associations then descends into those associations and checks for applicable resources to side load