#coding=utf-8
#
#
module Trustie
  module Gitlab
    class Api
      # attr_accessor :g

      def initialize(client=nil)
        @g = client || ::Gitlab.client 
      end

      def trees(project_id)
        @g.trees(project_id)
      end 

      def entries(project)
        entries  = []
        api = Trustie::Gitlab::Api.new
        trees = api.trees(11)
        trees.each do |tree|
          entries << Redmine::Scm::Adapters::Entry.new({
            :name => tree.name,
            :path => tree.id,
            :kind => tree.type == 'tree' ? 'dir' : 'file',
            :size => nil,
            :lastrev =>  nil
          }) 
        end
        entries
      end
      
    end
  end
end