<commit_before>require 'logan/HashConstructed'
require 'logan/todolist'

module Logan
  class Project
    include HashConstructed
    
    attr_accessor :id
    attr_accessor :name
    
    def todolists
      active_response = Logan::Client.get "/projects/#{@id}/todolists.json"
      lists_array = active_response.parsed_response.map do |h| 
        Logan::TodoList.new h.merge({ :project_id => @id })
      end
    end
    
    def completed_todolists
      completed_response = Logan::Client.get "/projects/#{@id}/todolists/completed.json"
      lists_array = completed_response.parsed_response.map do |h| 
        Logan::TodoList.new h.merge({ :project_id => @id })
      end
    end
    
    def all_todolists
      todolists + completed_todolists
    end
    
    def todolist(list_id)
      response = Logan::Client.get "/projects/#{@id}/todolists/#{list_id}.json"
      Logan::TodoList.new response.parsed_response.merge({ :project_id => @id })
    end
    
    def create_todolist(todolist)
      post_params = {
        :body => todolist.post_json,
        :headers => Logan::Client.headers.merge({'Content-Type' => 'application/json'})
      }<commit_msg>documentation for Project class<commit_after>require 'logan/HashConstructed'
require 'logan/todolist'

module Logan
  class Project
    include HashConstructed
    
    attr_accessor :id
    attr_accessor :name
    
    # get active todo lists for this project from Basecamp API
    # 
    # @return [Array<Logan::TodoList>] array of active todo lists for this project
    def todolists
      active_response = Logan::Client.get "/projects/#{@id}/todolists.json"
      lists_array = active_response.parsed_response.map do |h| 
        Logan::TodoList.new h.merge({ :project_id => @id })
      end
    end
    
    # get completed todo lists for this project from Basecamp API
    # 
    # @return [Array<Logan::TodoList>] array of completed todo lists for this project
    def completed_todolists
      completed_response = Logan::Client.get "/projects/#{@id}/todolists/completed.json"
      lists_array = completed_response.parsed_response.map do |h| 
        Logan::TodoList.new h.merge({ :project_id => @id })
      end
    end
    
    # get both active and completed todo lists for this project from Basecamp API
    # 
    # @return [Array<Logan::TodoList>] array of active and completed todo lists for this project
    def all_todolists
      todolists + completed_todolists
    end
    
    # get an individual todo list for this project from Basecamp API
    # 
    # @param [String] list_id id for the todo list
    # @return [Logan::TodoList] todo list instance
    def todolist(list_id)
      response = Logan::Client.get "/projects/#{@id}/todolists/#{list_id}.json"
      Logan::TodoList.new response.parsed_response.merge({ :project_id => @id })
    end
    
    # create a todo list in this project via Basecamp API
    # 
    # @param [Logan::TodoList] todo_list todo list instance to be created
    # @return [Logan::TodoList] todo list instance from Basecamp API response
    def create_todolist(todo_list)
      post_params = {
        :body => todo_list.post_json,
        :headers => Logan::Client.headers.merge({'Content-Type' => 'application/json'})
      }
{'fraction_non_alphanumeric': 0.10163227594702802, 'fraction_numerical': 0.0, 'mean_word_length': 3.004932182490752, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 18, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2807740', 'n_tokens_mistral': 1020, 'n_tokens_neox': 1017, 'n_words': 254}